<> <> <> <> DIRECTORY BasicTime USING [ GMT ], RefQ USING [ Queue ], Rope USING [ ROPE ], RPC USING [ EncryptionKey ], Thrush USING [ CallUrgency, ConversationHandle, ConvEventBody, EncryptionKey, EventSequence, IntervalSpec, IntervalSpecs, NB, newTune, nullConvHandle, nullHandle, PartyHandle, ProseSpec, ProseSpecs, Reason, ROPE, SHHH, SmartsHandle, StateInConv, ThHandle, Tune, VoiceInterval ], ThSmartsRpcControl ; FinchSmarts: CEDAR DEFINITIONS = { <> <<>> ConversationHandle: TYPE = Thrush.ConversationHandle; nullConvHandle: Thrush.ConversationHandle = Thrush.nullConvHandle; NB: TYPE = Thrush.NB; nullHandle: Thrush.ThHandle = Thrush.nullHandle; Orig: TYPE = { unknown, us, them }; PartyHandle: TYPE = Thrush.PartyHandle; Reason: TYPE = Thrush.Reason; ROPE: TYPE = Thrush.ROPE; SHHH: TYPE = Thrush.SHHH; FinchInfo: TYPE = REF FinchInfoBody; FinchInfoBody: TYPE = MONITORED RECORD [ smartsID: Thrush.SmartsHandle_Thrush.nullHandle, partyID: Thrush.PartyHandle _ Thrush.nullHandle, shh: SHHH_NIL, conversations: RefQ.Queue -- of ConvDescs --, currentConvID: ConversationHandle _ nullConvHandle, thProcess: PROCESS_NIL, thAction: CONDITION, apprise: BOOL_FALSE, myName: ThSmartsRpcControl.InterfaceName _ [], myRName: ROPE _ NIL, myPassword: RPC.EncryptionKey _ NULL, serverInstance: ROPE_NIL, <> ReportSystemState: PROC[ on: BOOL ], ReportConversationState: PROC[ nb: NB, cDesc: ConvDesc, remark: ROPE_NIL ] ]; 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, requestedIntervals: Thrush.IntervalSpecs_NIL, pendingIntervals: Thrush.IntervalSpecs_NIL, -- a tail of requestedIntervals, to be started requestedProses: Thrush.ProseSpecs_NIL, pendingProses: Thrush.ProseSpecs_NIL, -- a tail of requestedProses, to be started newEvent, newSpec, newKeys, newAddress: BOOL _FALSE, descValid: BOOL_FALSE, <> clientData: REF _ NIL, <> << but this field is cleared once the ConvDesc leaves the FinchInfo.conversations Queue.>> otherPartyID: PartyHandle _ nullHandle, otherPartyDesc: ROPE_ NIL, startTime: BasicTime.GMT_NULL, originator: Orig _ unknown, ultimateState: Thrush.StateInConv _ idle, -- last state reached (except for idle) <> <> <> <> weOriginated: BOOL_FALSE, -- This Finch originated the call bluejayConnection: BOOL_FALSE, proseConnection: BOOL_FALSE, conference: BOOL_FALSE, failed: 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]; <> PlaceCall: PROC [ convID: Thrush.ConversationHandle _ Thrush.nullConvHandle, rName: ROPE_NIL, number: ROPE_NIL, urgency: Thrush.CallUrgency_normal, useNumber: BOOL_FALSE]; <> <> <> <> <> <> <> AnswerCall: PROC[convID: Thrush.ConversationHandle]; DisconnectCall: PROC[ convID: Thrush.ConversationHandle, reason: Thrush.Reason_terminating, comment: ROPE_NIL ]; GetHistory: PROC[ convID: Thrush.ConversationHandle, toState: INT_0 -- i.e., all-- ] RETURNS [ s: Thrush.EventSequence ]; GetRname: PROC[partyID: Thrush.PartyHandle] RETURNS [ rName: ROPE]; <> RecordReason: TYPE = { ok, abandoned, failed, hopeless }; <> <> <> <> RecordTuneProc: TYPE = PROC[ <> useTune: Thrush.Tune_Thrush.newTune, useInterval: Thrush.VoiceInterval_[], queueIt: BOOL_FALSE ] RETURNS[ reason: RecordReason, -- << wouldn't need if only "ok" and "failed/hopeless" are supported.>> tune: Thrush.Tune, interval: Thrush.VoiceInterval_NULL, key: Thrush.EncryptionKey_NULL ]; <> <> RecordTune: RecordTuneProc; StopTuneProc: TYPE = PROC[ <> reason: RecordReason_ok -- other valid value: abandon (recording only: supported?) ]; <> StopTune: StopTuneProc; PlaybackTuneProc: TYPE = PROC [ <> tune: Thrush.Tune, interval: Thrush.VoiceInterval_[], key: Thrush.EncryptionKey, queueIt: BOOL_TRUE, 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_FALSE ]; PlaybackTune: PlaybackTuneProc; <> TextToSpeechProc: TYPE = PROC [text: Rope.ROPE, queueIt: BOOL_TRUE, proseTranslateProc: ProseTranslateProc_NIL] RETURNS [reason: RecordReason_ok]; ProseTranslateProc: TYPE = PROC [inText: Rope.ROPE] RETURNS [outText: Rope.ROPE]; <> TextToSpeech: TextToSpeechProc; <> RegisterTranslateProcType: TYPE = PROC [translate: ProseTranslateProc_NIL]; RegisterTranslateProc: RegisterTranslateProcType; <> StopSpeechProc: TYPE = PROC [reason: RecordReason_ok]; StopSpeech: StopSpeechProc; <> ResetProse: StopSpeechProc; <> <> GetConvDesc: PROC[convID: ConversationHandle] RETURNS [cDesc: ConvDesc]; GetCurrentConvID: PROC RETURNS [convID: ConversationHandle]; DequeueInterval: PROC[cDesc: ConvDesc] RETURNS [ int: Thrush.IntervalSpec_NIL ]; <<<>>> Feep: PROC[feepString: ROPE]; <> <<>> <> <> <> <<>> FinchState: TYPE = { unknown, running, stopped }; Procs: TYPE = REF ProcsRecord; ProcsRecord: TYPE = RECORD [ playbackTune: PlaybackTuneProc, recordTune: RecordTuneProc, stopTune: StopTuneProc, textToSpeech: TextToSpeechProc, registerTranslateProc: RegisterTranslateProcType, stopSpeech: StopSpeechProc, resetProse: StopSpeechProc, finchIsRunning: PROC RETURNS [isRunning: BOOL] ]; Register: PROC [finchSmartsProcs: Procs]; <> <<>> GetProcs: PROC RETURNS [Procs]; <> <<>> CurrentFinchState: PROC RETURNS [finchState: FinchState]; <> <<>> }. <<>> <> <> <> <> <> <> <> <> <> <> <<>> <> <> <> <> <> <<>> <> <> <> <> <> <> <<>>