FinchSmarts.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last Edited by: Swinehart, May 19, 1986 9:26:29 am PDT
Polle Zellweger (PTZ) December 13, 1985 3:04:16 pm PST
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 = {
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: RefQ.Queue -- of ConvDescs --,
currentConvID: ConversationHandle ← nullConvHandle,
thProcess: PROCESSNIL,
thAction: CONDITION,
apprise: BOOLFALSE,
myName: ThSmartsRpcControl.InterfaceName ← [],
myRName: ROPENIL,
myPassword: RPC.EncryptionKey ← NULL,
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,
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: BOOLFALSE,
descValid: BOOLFALSE,
Client Data
clientData: REFNIL,
ReportConversationState implementation can store client-dependent pointers here;
but this field is cleared once the ConvDesc leaves the FinchInfo.conversations Queue.
otherPartyID: PartyHandle ← nullHandle,
otherPartyDesc: ROPENIL,
startTime: BasicTime.GMTNULL,
originator: Orig ← unknown,
ultimateState: Thrush.StateInConv ← idle, -- last state reached (except for idle)
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
weOriginated: BOOLFALSE, -- This Finch originated the call
bluejayConnection: BOOLFALSE,
proseConnection: BOOLFALSE,
conference: BOOLFALSE,
failed: BOOLFALSE
];
Initialization
InitFinchSmarts: PROC [
thrushInstance: Thrush.ROPENIL,
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: Thrush.ROPENIL]; 
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.
RecordTuneProc: TYPE = PROC[
convID: Thrush.ConversationHandle ← Thrush.nullConvHandle, --vestigial until I figger it out
useTune: Thrush.Tune←Thrush.newTune,
useInterval: Thrush.VoiceInterval←[],
queueIt: BOOLFALSE
]
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
RecordTune: RecordTuneProc;
StopTuneProc: TYPE = 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.
StopTune: StopTuneProc;
PlaybackTuneProc: TYPE = PROC [
convID: Thrush.ConversationHandle ← Thrush.nullConvHandle, --vestigial until I figger it out
tune: Thrush.Tune,
interval: Thrush.VoiceInterval←[],
key: Thrush.EncryptionKey,
queueIt: BOOLTRUE,
failOK: BOOLFALSE, -- 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: BOOLFALSE ];
PlaybackTune: PlaybackTuneProc;
Text-to-speech server
TextToSpeechProc: TYPE = PROC [text: Rope.ROPE, queueIt: BOOLTRUE, proseTranslateProc: ProseTranslateProc←NIL] RETURNS [reason: RecordReason←ok];
ProseTranslateProc: TYPE = PROC [inText: Rope.ROPE] RETURNS [outText: Rope.ROPE];
A translate proc is used to modify the text rope to make it more intelligible. Examples: 1) words that the Prose doesn't pronounce correctly could be respelled or given as phonemes, and 2) Prose commands to alter speech speed or pitch could be added.
TextToSpeech: TextToSpeechProc;
Send rope to text-to—speech server. Called with rope = the current selection by FinchTool's SpeakText button. Input rope will be modified by the translate proc if (a) one is specified with this call or (b) one has previously been specified via RegisterTranslateProc[proc] below.
RegisterTranslateProcType: TYPE = PROC [translate: ProseTranslateProc←NIL];
RegisterTranslateProc: RegisterTranslateProcType;
Register default translate procedure to be used by TextToSpeech to make the text rope more intelligible. Most useful as a way to modify the action of the FinchTool's SpeakText button.
StopSpeechProc: TYPE = PROC [reason: RecordReason←ok];
StopSpeech: StopSpeechProc;
Flushes text-to-speech server queues, halts current speech.
ResetProse: StopSpeechProc;
Flushes text-to-speech server queues, initiates Prose self-test, and resets all speech parameters. Intended as an escape hatch.
Conversation Access
GetConvDesc: PROC[convID: ConversationHandle] RETURNS [cDesc: ConvDesc];
GetCurrentConvID: PROC RETURNS [convID: ConversationHandle];
DequeueInterval: PROC[cDesc: ConvDesc] RETURNS [ int: Thrush.IntervalSpec←NIL ];
<<Total Hack. Yuk. >>
Feep: PROC[feepString: ROPE];
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.
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];
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
GetProcs: PROC RETURNS [Procs];
Get the current registered set, or NIL
CurrentFinchState: PROC RETURNS [finchState: FinchState];
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
Polle Zellweger (PTZ) December 13, 1985 2:50:51 pm PST
New function for FinchToolImpl to use for managing selections in conversation log.
changes to: GetCurrentConvID