EvType:
TYPE = { tsOff, tsOn, spOff, spOn, spClick, spNone };
spOn is transition away from middle on speaker switch that lasts more than a few hundred ms.
spOff is transition to middle when spOn.
spClick is transition away from and back to middle after a few hundred ms.
Note: spNone is used to indicate that no interesting action took place.
newStates:
ARRAY SwitchState
OF
ARRAY EvType
OF SwitchState ← [
See ThSmartsPrivate.SwitchState for the legal state transitions; others are made harmless here.
[ $onhook, $telset, $onhook, $sPEAKER, $speaker, $onhook ], -- onhook
[ $onhook, $telset, $telset, $mONITOR, $monitor, $telset ], -- telset
[ $speaker, $telset, $onhook, $sPEAKER, $onhook, $speaker ], -- speaker
[ $sPEAKER, $mONITOR, $onhook, $sPEAKER, $onhook, $sPEAKER ], -- sPEAKER
[ $speaker, $monitor, $telset, $mONITOR, $telset, $monitor ], -- monitor
[ $sPEAKER, $mONITOR, $telset, $mONITOR, $telset, $mONITOR ] -- mONITOR
];
Scenario: user picks up telset and talks for a while, then clicks the speaker switch; the speaker comes on but the telset is still active. Hanging up switches to $speaker mode; picking up the telset reverts to $telset mode, whence hanging up would terminate the conversation unless the user clicks the switch again.
Scenario: user picks up telset and talks for a while, then turns on the speaker switch; the speaker comes on but the telset is still active. Hanging up switches to $sPEAKER mode; picking up the telset reverts to $mONITOR mode, and hanging up alternates back to sPEAKER mode, since the switch is still on.
When calls are terminated from Finch or the other party, the terminal state goes $onhook anyhow, so the distinctions between switch-on modes and click modes are not as great as they once were.
Commander.Register["VuLarkIn", ViewCmd, "Program Management variables for Lark Input"];