DIRECTORY BasicTime USING [ GMT ], LarkFeepRpcControl USING [ InterfaceRecord ], MBQueue USING [ Queue ], RefID USING [ ID ], RefQ USING [ Queue ], Rope USING [ ROPE ], RPC USING [ EncryptionKey ], ThParty USING [ PartyInfo ], Thrush USING [ ConversationID, ConvEventBody, InterfaceSpec, NB, nullConvID, nullID, PartyID, Reason, ROPE, SHHH, SmartsID, StateInConv ], ThSmartsRpcControl ; FinchSmarts: CEDAR DEFINITIONS = { ConversationID: TYPE = Thrush.ConversationID; nullConvID: ConversationID = Thrush.nullConvID; NB: TYPE = Thrush.NB; nullID: RefID.ID = Thrush.nullID; WhoOriginated: TYPE = { unknown, us, them }; PartyID: TYPE = Thrush.PartyID; Reason: TYPE = Thrush.Reason; ROPE: TYPE = Thrush.ROPE; SHHH: TYPE = Thrush.SHHH; FinchInfo: TYPE = REF FinchInfoBody; FinchInfoBody: TYPE = MONITORED RECORD [ smartsID: Thrush.SmartsID_nullID, partyID: PartyID _ nullID, shh: SHHH_NIL, conversations: RefQ.Queue -- of ConvDescs --, requests: MBQueue.Queue, stateChange: CONDITION, myName: ThSmartsRpcControl.InterfaceName _ [], myRName: ROPE _ NIL, myPassword: RPC.EncryptionKey _ NULL, ReportSystemState: PROC[ on: BOOL ], ReportConversationState: PROC[ nb: NB, cDesc: ConvDesc, remark: ROPE_NIL ] ]; ConvDesc: TYPE = REF ConvDescBody; ConvDescBody: TYPE = RECORD [ situation: Thrush.ConvEventBody, -- amalgam of useful info from last-reported event whoOriginated: WhoOriginated _ unknown, ultimateState: Thrush.StateInConv _ idle, -- last state reached (except for idle) startTime: BasicTime.GMT_NULL, subject: ROPE_NIL, numParties: NAT_0, numActive: NAT_0, numIdle: NAT_0, partyInfo: ThParty.PartyInfo_NIL, -- Complete description as of some recent time feepInterfaceSpec: Thrush.InterfaceSpec, feepInterface: LarkFeepRpcControl.InterfaceRecord, clientData: REF _ NIL, originatorRecorded: BOOL_FALSE, reportComplete: BOOL_FALSE ]; InitFinchSmarts: PROC [ thrushInstance: Thrush.ROPE_NIL, ReportSystemState: PROC[ on: BOOL ], ReportConversationState: PROC[ nb: NB, cDesc: ConvDesc, remark: ROPE_NIL ] ]; FinchIsRunning: PROC RETURNS [finchIsRunning: BOOL]; UninitFinchSmarts: PROC[problem: Thrush.ROPE_NIL, nb: Thrush.NB_NIL]; PlaceCall: PROC [ convID: Thrush.ConversationID _ nullConvID, rName: ROPE_NIL, number: ROPE_NIL, useNumber: BOOL_FALSE]; AnswerCall: PROC[convID: ConversationID]; DisconnectCall: PROC[ convID: ConversationID, reason: Thrush.Reason_$terminating, comment: ROPE_NIL ]; Feep: PROC[convID: ConversationID, feepString: ROPE]; PlayNoiseProc: TYPE = PROC [ noiseName: ATOM, queueIt: BOOL_FALSE, -- Should be FALSE if timeout stuff is used! serverInstance: ROPE_NIL, -- defaults to UserProfile.ThrushClientServerInstance; this is where the noise is stored. failOK: BOOL_FALSE, -- playing is optional; leave connection open if tune doesn't exist. wait: BOOL _ FALSE -- wait until things appear to be started properly, or have failed ] RETURNS [ started: BOOL ]; -- TRUE: things appear to be started properly PlayNoise: PlayNoiseProc; FinchState: TYPE = { unknown, running, stopped }; Procs: TYPE = REF ProcsRecord; ProcsRecord: TYPE = RECORD [ finchIsRunning: PROC RETURNS [isRunning: BOOL] ]; Register: PROC [finchSmartsProcs: Procs]; GetProcs: PROC RETURNS [Procs]; CurrentFinchState: PROC RETURNS [finchState: FinchState]; }. >FinchSmarts.mesa Copyright c 1985, 1986 by Xerox Corporation. All rights reserved. Last Edited by: Swinehart, June 1, 1986 6:34:11 pm PDT Polle Zellweger (PTZ) October 24, 1985 4:56:34 pm PDT Types Call backs Switching data Data of use to clients, maintained by FinchSmarts Maintained by SmartsImpl: For calls that were completed, this will be active For attempted outgoing calls, this is perhaps maybe For incoming calls that were not answered, this is perhaps ringing Client-maintained data ReportConversationState implementation can store client-dependent pointers here; but this field is cleared once the ConvDesc leaves the FinchInfo.conversations Queue. Initialization Whenever a toggle occurs, so does this procedure. Client-relevant changes in conversation state are reported in gory detail; FinchSmarts is allowed to invent parts of it (e.g., reason and remark fields) Expect ReportSystemState, followed by some number of ReportConversationStates, soon. No more than one client should call this procedure, at present. Call Management Uses specified conversation, creates a new one or uses one that's in a sufficiently idle state. Interpretation of rName and number -- evaluate until action can be taken: rName exists in switching system (has an Etherphone, usually) and ~use#: call that party. number#NIL: rName is simply a description; call by number rName=NIL or use#: invalid parameters rName exists in obsolete directory and ~use#: use the resulting number all tests fail: no such party. If the other party is willing to do it (trunk parties only, at present), generate touchtones corresponding to the characters in feepString. For talking to feep-controlled services. Alphabetic characters in feepString are translated to their corresponding digits, based ont he mapping found on most telephone touchpads and dials. Management of services Some tunes are stored in the Grapevine registry under global "noise names". Play one of them. convID: Thrush.ConversationHandle _ Thrush.nullConvHandle, --vestigial until I figger it out Registration This is like the WalnutRegistry. Finch registers its procedures here, and clients of Finch obtain and use them. FinchRegistryImpl implements these procedures. Finch runs FinchRegistryImpl if it's not already running, and so do its applications. Multiple instances of FinchRegistryImpl produce multiple registrations, though, so be careful with configs. Unlike WalnutRegistry, this one is presently set up to deal with only one set of registered procs at a time. Created for use by WalnutVoice, which wants to be able to run with or without Finch running. Register a set of procedures to be invoked when the appropriate database changes occur. Return a registration that can be used to name the set Get the current registered set, or NIL a quick and safe way to find out if Finch has been loaded and if it is active or not Swinehart, July 18, 1985 3:31:34 pm PDT Created FinchSmarts.Register and friends -- easier for WalnutVoice to deal with Finch. changes to: InitFinchSmarts, RecordTuneProc, RecordTune, StopTuneProc, StopTune, PlaybackTuneProc, PlaybackTune, PlayNoiseProc, PlayNoise, Feep, FinchState, Procs, CurrentFinchState, Procs, Register, FinchIsRunning, UninitFinchSmarts, GetProcs Polle Zellweger (PTZ) July 13, 1985 5:20:26 pm PDT adding Text-to-Speech server Changes to: DIRECTORY, FinchInfoBody, ConvDescBody Added: TextToSpeech, StopSpeech Swinehart, August 6, 1985 4:19:33 pm PDT Merge PTZ Prose changes changes to: DIRECTORY, FinchInfoBody, ConvDescBody, PlayNoise, TextToSpeech, StopSpeechProc, StopSpeech, ProcsRecord Polle Zellweger (PTZ) August 29, 1985 5:06:29 pm PDT changes to: TextToSpeechProc, ProseTranslateProc, TextToSpeech, StopSpeechProc, StopSpeech, ResetProse, ProcsRecord Polle Zellweger (PTZ) September 3, 1985 6:17:21 pm PDT Allow registration of proseTranslateProc. changes to: ProseTranslateProc, TextToSpeech, RegisterTranslateProcType, RegisterTranslateProc, ProcsRecord Polle Zellweger (PTZ) October 24, 1985 4:56:25 pm PDT Move bluejayConnection and proseConnection from FinchInfo to ConvDesc. changes to: FinchInfoBody, ConvDescBody Κδ˜šœ™Icodešœ Οmœ7™BJšœ6™6Kšœ5™5—J˜šΟk ˜ J˜Jšœžœ˜-J˜Jšœžœžœ˜Jšœžœ ˜Jšœžœžœ˜Jšžœžœ˜J˜šœž˜ JšœYžœ ˜}—J˜J˜J˜—šœ žœ˜"J˜—™J™˜-J˜/—Jšžœžœ žœ˜Jšœžœ˜!Jšœžœ˜,Jšœ˜J˜Jšžœžœ˜Jšžœžœ žœ˜J˜Jšœ žœžœ˜$šœžœž œžœ˜(Jšœ!˜!Jšœ˜Jšœžœžœ˜J˜JšœΟcœ˜-Jšœ˜Jšœ ž œ˜J˜Jšœ.˜.Jšœ žœžœ˜Jšœ žœžœ˜%J™ JšΟnœžœžœ˜$Jš  œžœžœžœžœ˜JJ˜J˜—Jšœ žœžœ˜"šœžœžœ˜J™Jšœ!Ÿ2˜SJ˜J™1J˜'šœ*Ÿ'˜QJšœ™Jšœ2™2Jšœ3™3JšœB™B—Jšœžœžœ˜Jšœ žœžœ˜Jšœ žœ˜Jšœ žœ˜Jšœ žœ˜JšœžœŸ/˜QJ˜(J˜2J˜J™šœ žœžœ˜JšœP™PJšœV™V—Jšœžœžœ˜Jšœžœž˜J˜—J™—™J˜š œžœ˜Jšœžœžœ˜ š œžœžœ˜$J™1—š  œžœžœžœžœ˜JJšœ˜™˜—Jšœ˜JšœT™TJ™?—J˜Jš œžœžœžœ˜4J˜Jš  œžœžœžœ žœžœ˜FJ˜—™J˜š  œžœ˜Jšœ+˜+Jšœžœžœ˜Jšœžœ˜Jšœ žœžœ˜J™_™IJ™YJ™9J™%J™FJ™—J˜—š  œžœ˜)J˜—š œžœ˜Jšœ˜J˜#Jšœ žœž˜Jšœ˜J˜—™΅J™“—Jš œžœ%žœ˜5J˜—™J™J™^š  œž œ˜Jšœ\™\Jšœ žœ˜Jšœ žœžœŸ,˜AJšœžœžœŸY˜sJšœžœžœŸD˜XJšœž ŸB˜UJšœžœ žœŸ-˜J—Jš  œ˜J™—™ J™J™δJ™lJ™\J™J˜1J˜Jšœžœžœ ˜šœ žœžœ˜Jšœžœžœ žœ˜.J˜J˜—š œžœ˜)Jšœ™J™—š œžœžœ ˜Jšœ#ž™&J™—š œžœžœ˜9J™T—J™—J˜J™™'K™VKšœ Οrη™σ—™2K™Kšœ ‘&™2Kšœ‘™—™(K™Kšœ ‘h™t—K™™4Kšœ ‘g™s—™6Kšœ‘œ™)Kšœ ‘_™k—K™šœ5™5KšœF™FKšœ ‘™'—K™—…— Θ"κ