DIRECTORY IO USING [ STREAM ], Lark USING [ CommandEvents, disabled, enabled, Event, LarkModel, o3i1, StatusEvent, ts0 ], LarkRpcControl USING [ InterfaceRecord ], Rope USING [ROPE], BasicTime USING [ GMT ], Thrush USING [ ConversationHandle, ConvEvent, ConvEventBody, Disposition, IntervalSpec, NetAddress, nullHandle, nullConvHandle, PartyHandle, Reason, ROPE, SHHH, SmartsHandle, StateInConv, Tune, VoiceDirection, VoiceInterval ], ThPartyPrivate USING [ SmartsData ]; ThSmartsPrivate: CEDAR DEFINITIONS = { ConversationHandle: TYPE = Thrush.ConversationHandle; nullConvHandle: ConversationHandle = Thrush.nullConvHandle; PartyHandle: TYPE = Thrush.PartyHandle; Reason: TYPE = Thrush.Reason; ROPE: TYPE = Thrush.ROPE; SHHH: TYPE = Thrush.SHHH; SmartsData: TYPE = ThPartyPrivate.SmartsData; SmartsHandle: TYPE = Thrush.SmartsHandle; StatusEvent: TYPE = Lark.StatusEvent; ParseState: TYPE = { idle, getStr, getSeq, getFeep, getNum, inStr, inSeq, inFeep, inNum, inTossStr }; LarkState: TYPE = { none, -- Initial state idle, -- Phone not in use talking, -- Etherphone conversation in progress trunkSignalling, -- "Feeping" trunkTalking, -- Standard telephone conversation in progress trunkForwarding, -- Like trunkTalking, but call is forwarded to some other Lark trunkFlashing, -- Implementing special switchhook flash failed, -- This Lark has died and its brain is dying, too. recovering, -- Lark is presumed not to work, but use attempts don't raise ERRORS ringing, -- Ringing loudly through Lark speaker silence, -- Dial tone has been broken, dialing in progress. dialTone, -- Caller hears dial tone. ringBack, -- Caller hears ringing. busyTone, -- Caller hears busy signal. errorTone -- Caller hears fast busy signal. }; ProgressTones: TYPE = LarkState[dialTone..errorTone]; HookState: TYPE = { onhook, telset, spkr, sPkr, spKr, both, bOth, monitor }; TerminalType: TYPE = {std, spkr, monitor, radio}; RingDetState: TYPE = { idle, maybe, ring1, between, ring }; RingMode: TYPE = { internal, -- standard ringing cadence trunk -- distinctive ringing for incoming back door calls }; RingEnable: TYPE = { off, -- Incoming calls do not make noise. offTimed, -- Incoming calls will not make noise until a specified later time. subdued, -- Incoming calls will make less of a racket subduedTimed, -- Incoming calls will make less of a racket until a specified later time. on -- Incoming calls make noise. }; Orig: TYPE = { unknown, us, them }; click: Lark.Event = Lark.ts0; -- Momentary closure of speaker box switch. LSwitches: TYPE = { xBarAll, hook, aSwitch, sideTone, ringO, revert, revertHook, led, spMode, none }; LState: TYPE = RECORD [ voiceMode: Lark.Event_Lark.o3i1, echoStyle: CHAR_'0, xbar: PACKED ARRAY[0..8) OF [0..256) _ ALL[0], lSw: ARRAY LSwitches OF Lark.Event _ ALL[Lark.disabled] ]; SmartsInfo: TYPE = REF SmartsInfoBody; SmartsInfoBody: TYPE = MONITORED RECORD [ smarts: SmartsData, -- back pointer to my smarts. otherSmarts: SmartsData_NIL, -- trunk or station smarts, depending on which this is. larkInfo: LarkInfo, conversations: OpenConversations_NIL, currentConvID: ConversationHandle_nullConvHandle, -- the one we're dealing with. thProcess: PROCESS_NIL, -- the process that manages Lark smarts thAction: CONDITION, -- poke this when something has happened. apprise: BOOL_FALSE, -- needs to be true before waking to thAction has any meaning. ParseEvent: PROC[smartsInfo: SmartsInfo, sEvent: StatusEvent], Command: PROC[info: SmartsInfo, val: INT_0]_NIL, Supervise: PROC[info: SmartsInfo], parseState: ParseState _ idle, arguments: ROPE_NIL, argLength: NAT_0, offset: NAT_0, -- kludge allowing more than ten touchpad commands haveArguments, cmdOrRecip, haveOne: BOOLEAN_FALSE, phoneNumber: Rope.ROPE_NIL -- signalling information for TelCo. ]; OpenConversations: TYPE = LIST OF ConvDesc; ConvDesc: TYPE = REF ConvDescBody; ConvDescBody: TYPE = RECORD [ cState: Thrush.ConvEventBody, -- amalgam of useful info from reported events desiredState: Thrush.StateInConv_any, -- what we're aiming for desiredPartyID: PartyHandle_NULL, desiredReason: Reason_wontSay, desiredComment: ROPE_NIL, newIntervals: LIST OF Thrush.IntervalSpec _ NIL, iTail: LIST OF Thrush.IntervalSpec _ NIL, originator: Orig _ unknown, newSpec, newKeys, newAddress: BOOL _FALSE, newEvent: BOOL_FALSE, signallingStarted: BOOL_FALSE, descValid: BOOL_FALSE ]; LarkInfo: TYPE = REF LarkInfoBody; LarkInfoBody: TYPE = MONITORED RECORD [ interface: LarkRpcControl.InterfaceRecord, -- here's how you make calls to Lark -- shh: SHHH, -- here's what you use to encrypt them -- netAddress: Thrush.NetAddress, -- <> -- model: Lark.LarkModel, -- what does this Lark look like? -- debugIn: IO.STREAM, debugPrint: IO.STREAM_NIL, larkState: LarkState _ none, -- tone/crossbar/connect state of actual Lark hardware newActions: LIST OF REF_NIL, -- queue of low-level requests to supervisor process lastAction: LIST OF REF_NIL, -- used in request-queue maintenance, larkProcess: PROCESS_NIL, -- maintains same stateChange: CONDITION, -- larkProcess should notice change hookState: HookState _ onhook, -- state of switchhook/speakerphone switch... terminalType: TerminalType _ std, -- telset, speakerphone, or monitor switching. hotLine: BOOL_FALSE, -- answers when called. radio: BOOL_FALSE, -- used with hotline; connects line in instead of telset when called. monitor: BOOL_FALSE, -- speaker repeats telset receiver in telset mode. swOnTime: CARDINAL_0, ringChangeTime: CARDINAL_0, ringDetState: RingDetState _ idle, ringDetWaitState: RingDetState_idle, ringDetCondition: CONDITION, ringDetInstance: CARDINAL_0, -- paranoia ringMode: RingMode _ internal, -- what kind of ringing should we do next time? ringEnable: RingEnable _ on, -- are we noisily accepting calls? ringTime: BasicTime.GMT_NULL, -- if not, when again? ringVolume: CARDINAL_1, -- waveTable value indicating how loud ringing will be. ringTune: ROPE, -- a PlayTune or other tune specification lastTerminalType: TerminalType _ std, lState: LState _ [lSw: ALL[Lark.enabled]], scratchEv: Lark.CommandEvents _ NIL ]; LarkStateSpec: TYPE = RECORD [ state: LarkState, sInfo: SmartsInfo ]; EnterLarkState: PROC [ info: LarkInfo, newState: LarkState, sInfo: SmartsInfo ]; EnterLarkSt: PROC [ info: LarkInfo, newState: LarkState, sInfo: SmartsInfo ]; SetRingingParameters: PROC[ info: LarkInfo, ringMode: ThSmartsPrivate.RingMode_internal, ringEnable: ThSmartsPrivate.RingEnable_on, ringVolume: CARDINAL_1, ringInterval: INT_NULL, -- Seconds to disable ringTune: ROPE -- a PlayTune to be played when normal ringing is enabled. See Play.df for documentation ]; InterpretHookState: PROC [ info: LarkInfo, rawEvent: Lark.StatusEvent ] RETURNS [ processedEvent: Lark.StatusEvent ]; CheckHookState: PROC [ info: LarkInfo] RETURNS [ onHook: BOOL_TRUE ]; RegisterTrunk: PROC[ hostPartyID: Thrush.PartyHandle, hostSmarts: ThPartyPrivate.SmartsData, hostInfo: SmartsInfo ] RETURNS [ smartsID: Thrush.SmartsHandle ]; EnableSmarts: PROC[info: SmartsInfo] RETURNS[enabled: BOOL]; Deregister: PROC[info: SmartsInfo ]; LarkParseEvent: -- INTERNAL -- PROC[smartsInfo: SmartsInfo, sEvent: StatusEvent]; LarkProgress: PROC[ shh: SHHH, smartsID: Thrush.SmartsHandle, event: Thrush.ConvEvent, yourParty: BOOL, latestEvent: BOOL, informationOnly: BOOL ] RETURNS [ d: Thrush.Disposition ]; LarkSupervise: PROC[info: SmartsInfo]; LarkSetInterval: PROC[ shh: SHHH, smartsID: SmartsHandle, tune: Thrush.Tune, interval: Thrush.VoiceInterval, direction: Thrush.VoiceDirection, queueIt: BOOLEAN ] RETURNS [ d: Thrush.Disposition, u: Thrush.Tune ]; LarkFailed: ERROR[sInfo: SmartsInfo]; GetSmartsInfo: PROC[smartsID: SmartsHandle_Thrush.nullHandle, smarts: ThPartyPrivate.SmartsData_NIL] RETURNS [info: SmartsInfo]; GetSIC: PROC[info: SmartsInfo] RETURNS [ state: Thrush.StateInConv ]; Apprise: PROC[info: SmartsInfo]; ChangeState: PROC[ info: SmartsInfo, cDesc: ConvDesc, state: Thrush.StateInConv _ idle, reason: Reason _ wontSay, comment: ROPE_NIL ]; GetConvDesc: PROC[info: SmartsInfo] RETURNS [ cDesc: ConvDesc_NIL ]; GetConv: PROC[info: SmartsInfo, convID: ConversationHandle, validIfNew: BOOL] RETURNS [ cDesc: ConvDesc_NIL ]; }. ’ThSmartsPrivate.mesa Last modified by D. Swinehart, December 28, 1983 9:34 pm Last Edited by: Pier, May 3, 1984 1:04:49 pm PDT Copies Types States (enumerated types) and other scalars Parser is controlled by state sequence that's largely independent of the state of the smarts in any conversation. Parser represents the user's wishes. After parsing is complete, other processing determines whether these wishes can be granted. This state is essentially a superset of Thrush.StateInConv. It is used to express the user's wishes; when wish and reality coincide, it is set to the corresponding StateInConv, and quiescence follows, at least temporarily. Control of the Lark hardware state (remaining types) no ring, glitch interval, first (partial?) ring, break, nth ring Structures Information used by LarkSmarts and LarkTrunkSmarts implementations They require similar information, although the trunk does not use all of it. State of Lark hardware, shared between Lark and Trunk Parsing control fields Allows Lark, Lark trunk, Radio, ... smarts to parse different command languages Command procedure to act on results of completely parsed command Command procedure to act on results of completely parsed command Independent of any notion of what's going on in eventInfo; desire of local user LarkTrunkSmarts fields; something feels pretty wrong here. Access to the Lark hardware via the Lark interface. This monitored record is shared by the Smarts info for both the LarkSmarts and LarkTrunkSmarts. There are also some random shared fields kept here. Special attributes. << Not clear how set >> Click and ring detect timings Ringing control information LarkSupervisor Variables Procedures ENTRY version INTERNAL version Determines if user terminal appears to be offhook. May not be able to tell if there's a "click-mode" speakerphone call in progress. Registration of Lark trunks (back doors) Return current state Ê ž˜Jšœ™Jšœ8™8J™0J˜šÏk ˜ Jšœœœ˜šœœ˜ JšœM˜M—Jšœœ˜)Jšœœœ˜Jšœ œœ˜šœœ˜Jšœ†œœC˜Ó—Jšœœ˜$J˜—šœœ œ˜&J™—šÏc™J™šœœ˜5J˜;—Jšœ œ˜'Jšœœ˜Jšœœ œ˜Jšœœ œ˜Jšœ œ˜-Jšœœ˜)Jšœ œ˜%J™—šž™J™™+J˜J™ôšœ œ˜J˜Y—J™J™ßJ˜Jšœ4™4šœ œ˜Jšœ ž˜Jšœ ž˜Jšœ ž&˜2Jšœž ˜Jšœž.˜=Jšœž>˜OJšœž(˜8Jšœ ž2˜=JšœžD˜RJšœ ž&˜2Jšœ ž2˜>Jšœ ž˜'Jšœ ž˜%Jšœ ž˜(Jšœ ž!˜.J˜—Jšœœ"˜5J˜Jšœ œ=˜LJ˜Jšœœ˜1J˜šœœ)˜;J™@—J™šœ œ˜Jšœ ž˜'Jšœ ž3˜Jšœ œœž>˜SJ™J™šÏn œœ.˜>J™O—šŸœœœœ˜0J™@—šŸ œœ˜"J™@—˜J™O—Jšœ œœ˜Jšœ œ˜Jšœœž2˜AJšœ$œœ˜2J™Jšœ:™:Jšœœœž$˜?J˜J˜—J˜Jšœœœœ ˜+Jšœ œœ˜"šœœœ˜Jšœž.˜MJšœ&ž˜>Jšœœ˜!J˜Jšœœœ˜Jšœœœœ˜0Jšœœœœ˜)J˜Jšœœ˜*Jšœ œœ˜Jšœœœ˜Jšœ œ˜J˜J˜——šœÉ™ÉJ™Jšœ œœ˜"šœœ œ˜%J˜Jšœ+ž'˜RJšœœž)˜4Jšœž.˜MJšœž$˜;Jš œ œœœœœ˜/J˜Jšœž6˜TJš œ œœœœž4˜QJš œ œœœœž%˜BJšœ œœž˜+Jšœ œž#˜