FinchSmarts.mesa
Last Edited by: Swinehart, November 11, 1983 1:19 pm
DIRECTORY
BasicTime USING [ GMT ],
RPC USING [ EncryptionKey ],
Thrush USING
[ CallUrgency, ConversationHandle, ConvEventBody, EncryptionKey, EventSequence, IntervalSpec, NB, newTune, nullConvHandle, nullHandle, PartyHandle, Reason, ROPE, SHHH, SmartsHandle, StateInConv, ThHandle, Tune, VoiceInterval ],
ThSmartsRpcControl
;
FinchSmarts: CEDAR DEFINITIONS = {
Types
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: SHHHNIL,
conversations: ConvDesc←NIL,
currentConvID: ConversationHandle ← nullConvHandle,
thProcess: PROCESSNIL,
thAction: CONDITION,
apprise: BOOLFALSE,
bluejayConnection: BOOLFALSE,
myName: ThSmartsRpcControl.InterfaceName ← [],
myRName: ROPENIL,
myPassword: RPC.EncryptionKey ← NULL,
serverInstanceName: ROPENIL,
serverInstance: ROPENIL,
Call backs
ReportSystemState: PROC[ on: BOOL ],
ReportConversationState: PROC[ nb: NB, cDesc: ConvDesc, remark: ROPENIL ]
];
ConvDesc: TYPE = REF ConvDescBody;
ConvDescBody: TYPE = RECORD [
Switching data
cState: Thrush.ConvEventBody,  -- amalgam of useful info from reported events
desiredState: Thrush.StateInConv𡤊ny, -- what we're aiming for
desiredPartyID: PartyHandle←NULL,
desiredReason: Reason←wontSay,
desiredComment: ROPENIL,
desiredInterval: Thrush.IntervalSpec←NIL,
desiredKey: Thrush.EncryptionKey←NULL,
currentRecordIntervalSpec: Thrush.IntervalSpec ← NIL,
newIntervals: LIST OF Thrush.IntervalSpec ← NIL,
iTail: LIST OF Thrush.IntervalSpec ← NIL,
newEvent, newSpec, newKeys, newAddress: BOOLFALSE,
signallingStarted: BOOLFALSE,
descValid: BOOLFALSE,
desireKey: BOOLFALSE,
Client Data
clientData: REFNIL, -- only known use: FinchTool uses to store Viewer pointer
next, prev: ConvDesc←NIL,
otherPartyID: PartyHandle ← nullHandle,
otherPartyDesc: ROPENIL,
startTime: BasicTime.GMTNULL,
originator: Orig ← unknown,
conference: BOOLFALSE,
completed: BOOLFALSE,
failed: BOOLFALSE
];
Initialization
InitFinchSmarts: PROC [
ReportSystemState: PROC[ on: BOOL ],
Whenever a toggle occurs, so does this procedure.
ReportConversationState: PROC[ nb: NB, cDesc: ConvDesc, remark: ROPENIL ]
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.
FinchIsRunning: PROC RETURNS [finchIsRunning: BOOL];
UninitFinchSmarts: PROC[problem: BOOLFALSE]; 
Call Management
PlaceCall: PROC [
convID: Thrush.ConversationHandle ← Thrush.nullConvHandle,
rName: ROPENIL,
number: ROPE←NIL,
urgency: Thrush.CallUrgency←normal,
useNumber: BOOLFALSE];
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.
AnswerCall: PROC[convID: Thrush.ConversationHandle];
DisconnectCall: PROC[
convID: Thrush.ConversationHandle,
reason: Thrush.Reason←terminating,
comment: ROPENIL
];
GetHistory: PROC[ convID: Thrush.ConversationHandle, toState: INT𡤀 -- i.e., all-- ]
RETURNS [ s: Thrush.EventSequence ];
GetRname: PROC[partyID: Thrush.PartyHandle] RETURNS [ rName: ROPE];
Recording and Playback
RecordReason: TYPE = { ok, abandoned, failed, hopeless };
ok: something was recorded
abandoned: user or client program asked to abandon the recording (supported?)
failed: something went wrong, but may not next time.
hopeless: will continue to fail until somebody does something creative.
RecordTune: PROC[
convID: Thrush.ConversationHandle ← Thrush.nullConvHandle, --vestigial until I figger it out
useTune: Thrush.Tune←Thrush.newTune,
useInterval: Thrush.VoiceInterval←[]
]
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
];
This procedure waits until the recording is complete. While it is running, calls to the registered procedures may occur to inform the user of what's happening. Client is responsible for arranging process structures so that there is a process available to call StopTune while a call to RecordTune is still pending.
convID should be defaulted
StopTune: PROC[
convID: Thrush.ConversationHandle ← Thrush.nullConvHandle, --vestigial until I figger it out
reason: RecordReason←ok -- other valid value: abandon (recording only: supported?)
];
Terminates recording or playback of tune, if any. Causes any pending RecordTune to terminate and return.
PlaybackTune: PROC [
convID: Thrush.ConversationHandle ← Thrush.nullConvHandle, --vestigial until I figger it out
tune: Thrush.Tune,
interval: Thrush.VoiceInterval←[],
key: Thrush.EncryptionKey,
queueIt: BOOLFALSE
];
Conversation Access
GetConvDesc: PROC[convID: ConversationHandle] RETURNS [cDesc: ConvDesc];
DequeueInterval: PROC[cDesc: ConvDesc] RETURNS [ int: Thrush.IntervalSpec←NIL ];
}.