<> <> <> <> <> DIRECTORY Atom USING [ PropList ], IO USING [ Value ], Lark USING [ CommandEvents, ConnectionSpec, disabled, enabled, Event, KeyTable, LarkModel, o3i1, StatusEvent, ToneSpec, ts0, ts12 ], LarkPlay USING [ ToneList, ToneSpec ], LarkOpsRpcControl USING [ InterfaceRecord ], MBQueue USING [ Queue ], RefID USING [ nullID ], Rope USING [ROPE], BasicTime USING [ GMT ], Thrush USING [ ActionID, ActionReport, ConversationID, ConvEvent, ConvEventBody, Credentials, NB, NetAddress, nullID, nullConvID, PartyID, PartyType, Reason, ROPE, SHHH, SmartsID, StateInConv ], ThParty USING [ PartyInfo ], ThPartyPrivate USING [ SmartsData ], ThSmartsRpcControl USING [ InterfaceRecord ] ; ThSmartsPrivate: CEDAR DEFINITIONS = { <<>> <> <<>> SHHH: TYPE = Thrush.SHHH; SmartsData: TYPE = ThPartyPrivate.SmartsData; <<>> <> <<>> <> <> 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 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]; SwitchState: TYPE = { onhook, telset, speaker, sPEAKER, monitor, mONITOR }; <> < telset (sh on), speaker (sw click), sPEAKER (sw on)>> < onhook (sh off), monitor (sw click), mONITOR (sw on)>> < onhook (sw click), sPEAKER (sw on), telset (sh on)>> < onhook (sw off), mONITOR (sh on)>> < telset (sw click), speaker (sh off), mONITOR (sh on)>> < telset (sw off), sPEAKER (sh off)>> <> RingDetState: TYPE = { idle, maybe, ring, between }; <> Orig: TYPE = { unknown, us, them }; AudioSource: TYPE = ATOM; -- = {$telset (NIL), $lineA, $lineB}; click: Lark.Event = Lark.ts0; -- Momentary closure of speaker box switch. spkrOn: Lark.Event = Lark.ts12; -- Longer-than-momentary closure. LSwitches: TYPE = { xBarAll, hook, aSwitch, sideTone, ringO, revert, revertHook, led, spMode, none }; LState: TYPE = RECORD [ voiceMode: Lark.Event_Lark.o3i1, echoStyle: [0..3]_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 [ smartsID: Thrush.SmartsID, -- back pointer to my smarts. otherSmartsID: Thrush.SmartsID_Thrush.nullID, <> partyType: Thrush.PartyType_NIL, -- type of party this smarts represents. larkInfo: LarkInfo, <> conversations: OpenConversations_NIL, currentConvID: Thrush.ConversationID_Thrush.nullConvID, -- the one we're dealing with. requests: MBQueue.Queue_NIL, -- serialize progress reports, requests for actions <<>> <> ParseEvent: PROC[r: REF], -- r is an EventSpecBody; MBQueued <> Command: PROC[info: SmartsInfo, val: INT_0]_NIL, <> NoteNewStateP: PROC[cDesc: ConvDesc, convEvent: Thrush.ConvEvent]_NIL, <> lastTouchpadChar: Lark.Event _ '\000, parseState: ParseState _ $idle, <> arguments: Rope.ROPE_NIL, argLength: NAT_0, offset: NAT_0, -- kludge allowing more than ten touchpad commands haveArguments, cmdOrRecip, haveOne: BOOLEAN_FALSE, failed: BOOL_FALSE ]; <> <<1. Input events>> InputEventSpec: TYPE = REF InputEventSpecBody; InputEventSpecBody: TYPE = RECORD [ smartsInfo: SmartsInfo, sEvent: Lark.StatusEvent _ [0, nothing, '\000] ]; <<2. Lark Failure -- just the LarkInfo>> <<3. Registration -- see LarkSmartsInitImpl.Register>> OpenConversations: TYPE = LIST OF ConvDesc; ConvDesc: TYPE = REF ConvDescBody; ConvDescBody: TYPE = RECORD [ info: SmartsInfo, -- corresponding to credentials.smartsID (or else!) situation: Thrush.ConvEventBody, -- .self describes current state in conv. keyTable: Lark.KeyTable _ NIL, ringCheckProcess: PROCESS _ NIL, -- For ringing after someone has answered. lastActionID: Thrush.ActionID _ RefID.nullID -- for remembering last-started request, see LarkSmartsSupImpl.LarkReportAction ]; <<>> ConvRequest: TYPE = REF ConvRequestBody; ConvRequestBody: TYPE = RECORD [ cDesc: ConvDesc, -- present state, desiredSituation: Thrush.ConvEventBody _ [], bilateral: BOOL ]; <> <<>> LarkInfo: TYPE = REF LarkInfoBody; LarkInfoBody: TYPE = MONITORED RECORD [ interface: LarkOpsRpcControl.InterfaceRecord, -- here's how you make calls to Lark -- shh: SHHH, -- here's what you use to encrypt them -- larkSmartsInfo: SmartsInfo, -- back pointers larkTrunkSmartsInfo: SmartsInfo, -- back pointers netAddress: Thrush.NetAddress, -- <> -- model: Lark.LarkModel, -- what does this Lark look like? -- larkState: LarkState _ $none, -- tone/crossbar/connect state of actual Lark hardware failed: BOOL _ FALSE, -- set when this (instance of) Lark is no longer viable. debugging: BOOL _ FALSE, -- if TRUE, Lark is in development mode: reaction to failure is less drastic. 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 blinkProcess: PROCESS _ NIL, -- created if LED must flash. stateChange: CONDITION, -- larkProcess should notice change inputQueue: MBQueue.Queue _ NIL, audioSource: AudioSource _ NIL, -- e.g., $telset switchState: SwitchState _ $onhook, -- state of switchhook/speakerphone switch... textToSpeech: BOOL_FALSE, -- Prose 2000 or DecTalk synthesizer is available on this Lark. transmitOnly: BOOL_FALSE, -- w/line(A/B), inhibit spkr, rcvr, line(A/B) out for svcs. <> forwardedCall: BOOL_FALSE, multicasting: BOOL_FALSE, spec: ThParty.PartyInfo_NIL, cSpec: Lark.ConnectionSpec_NIL, keyTable: Lark.KeyTable _ NIL, keySynch: CONDITION, -- used to lock pieces of LarkOutImpl together while keys are distributed keyTableDistrsRequested: INT_0, keyTablesDistributed: INT _ 0, toneSpec: LarkPlay.ToneSpec_NIL, nextToneList: LIST OF LarkPlay.ToneList_NIL, larkToneSpec: Lark.ToneSpec_NIL, <<>> <> swOnTime: CARDINAL_0, <> ringChangeTime: CARDINAL_0, ringDetState: RingDetState _ $idle, ringDetCondition: CONDITION, ringDetInstance: INT_0, -- timeout routine is relevant only if this matches <> <> expectedNotification: Lark.Event _ 'z, receivedNotification: Lark.Event _ 'Y, <> lastSwitchState: SwitchState _ $onhook, lState: LState _ [lSw: ALL[Lark.enabled]], scratchEv: Lark.CommandEvents _ NIL, <> props: Atom.PropList _ NIL, <> <> keyboardEventHandler: PROC[info: LarkInfo, sEvent: Lark.StatusEvent], keyboardResetHandler: PROC[info: LarkInfo] ]; LarkCall: TYPE = REF LarkCallBody; <> LarkCallBody: TYPE = RECORD [ proc: PROC[info: LarkInfo, clientData: REF], clientData: REF ]; <<>> <<*SmartsImpl Inter-module communication (including TrunkSmarts)>> <<>> RegisterTrunk: PROC[ <> <> hostSmartsID: Thrush.SmartsID, hostInfo: SmartsInfo, partyRname: Thrush.ROPE ] RETURNS [ nb: Thrush.NB, smartsID: Thrush.SmartsID ]; EnableSmarts: PROC[r: REF]; -- r is really a LarkInfo <> <<>> Deregister: PROC[r: REF]; <> FlashDone: PROC[r: REF]; <> <<>> LarkParseEvent: -- INTERNAL -- PROC[r: REF]; NoteNewState: PROC[cDesc: ConvDesc, convEvent: Thrush.ConvEvent]; ComputeConnection: PROC[cDesc: ConvDesc] RETURNS [pInfo: ThParty.PartyInfo _ NIL]; <> << Crowbar: obsolete. See LarkSmartsImpl.LarkAvailable.>> LarkProgress: PROC[ <> interface: ThSmartsRpcControl.InterfaceRecord, shh: SHHH, convEvent: Thrush.ConvEvent ]; LarkSubstitution: PROC[ interface: ThSmartsRpcControl.InterfaceRecord, shh: SHHH, convEvent: Thrush.ConvEvent, oldPartyID: Thrush.PartyID, newPartyID: Thrush.PartyID ]; LarkReportAction: PROC[ interface: ThSmartsRpcControl.InterfaceRecord, shh: SHHH, report: Thrush.ActionReport ]; <> GetSmartsInfo: PROC[smartsID: Thrush.SmartsID] RETURNS [info: SmartsInfo]; GetSIC: PROC[info: SmartsInfo] RETURNS [ state: Thrush.StateInConv ]; ChangeState: PROC[ cDesc: ConvDesc, state: Thrush.StateInConv _ $idle, reason: Thrush.Reason _ NIL, -- $wontSay comment: Thrush.ROPE_NIL, bilateral: BOOL_FALSE -- See Thparty.Advance[...bilateral] ] RETURNS [nb: Thrush.NB]; -- advisory only, by this point ForgetConv: PROC[cDesc: ConvDesc]; GetConvDesc: PROC[info: SmartsInfo] RETURNS [ cDesc: ConvDesc_NIL ]; GetConv: PROC[info: SmartsInfo, convID: Thrush.ConversationID, createOK: BOOL_FALSE] RETURNS [ cDesc: ConvDesc ]; DBInfo: PROC[partyID: Thrush.PartyID, attribute: ATOM_NIL, prevDbAtom: ATOM_NIL] RETURNS [ dbRname: Rope.ROPE, dbAtom: ATOM, value: Rope.ROPE ]; <> <> <> <<>> RegisterServiceProvider: PROC[ serviceProvider: PROC[credentials: Thrush.Credentials, smartsInfo: SmartsInfo]]; <<>> <> <> EnterLarkState: PROC [ info: LarkInfo, newState: LarkState, data: LIST OF REF ANY_NIL ]; <> <> <> <> <> <> <> <<$audioSource: [$lineA, $lineB, NIL ($telset)]>> <<$transmitOnly: [$TRUE, $FALSE]>> <<$phoneNumber: "number to dial">> <<$textToSpeech: [$TRUE, $FALSE]>> <> <<Making everything a dotted pair would be less efficient but more uniform.>> <> EnterLarkSt: PROC [ info: LarkInfo, newState: LarkState, data: LIST OF REF ANY_NIL ]; Fail: PROC[info: LarkInfo, reason: Rope.ROPE, informLark: BOOL_FALSE]; <> FailInt: PROC[info: LarkInfo, reason: Rope.ROPE, informLark: BOOL_FALSE]; -- Internal version QueueFeeps: PROC [ sInfo: SmartsInfo, feeps: Rope.ROPE ]; SetupTimeouts: PROC[info: LarkInfo, debugging: BOOL ]; <> Deb: PROC[info: LarkInfo, r: Rope.ROPE, p1, p2, p3, p4: IO.Value_[null[]]]; <> <<>> CheckHookState: PROC [ info: LarkInfo] RETURNS [ onHook: BOOL_TRUE ]; <> <> <> <> TonesDone: PROC[ info: LarkInfo, commandEvent: Lark.StatusEvent ]; <> <> QueueLarkAction: PROC[ info: LarkInfo, ref: REF ]; <> <<>> }. <> <> <> <> <> <> <> <> <> <> <> <> <> <> < ID>> <> <> < LarkOps>> <> <> <> <> <<>>