PhSmarts.mesa
Copyright Ó 1990, 1992 by Xerox Corporation. All rights reserved.
Vin, October 8, 1990 4:22 pm PDT
Swinehar, October 23, 1992 8:37 am PDT
DIRECTORY
AudioLibrary,
IO,
RPC USING [ EncryptionKey ],
RefID,
Rope USING [ROPE],
ThParty,
ThSmartsRpcControl USING [ InterfaceName ],
Thrush USING [ ConvEventBody, ConversationID, Credentials, SmartsID, PartyID, NB, nullConvID, nullID, Reason, ROPE, SHHH, StateInConv],
TonePlay;
PhSmarts: CEDAR DEFINITIONS = {
Types
ConversationID: TYPE = Thrush.ConversationID;
nullConvID: ConversationID = Thrush.nullConvID;
NB: TYPE = Thrush.NB;
nullID: RefID.ID = Thrush.nullID;
PartyID: TYPE = Thrush.PartyID;
Reason: TYPE = Thrush.Reason;
ROPE: TYPE = Thrush.ROPE;
SHHH: TYPE = Thrush.SHHH;
lock: MONITORLOCK;
PD: TYPE = RECORD [
doPollingTimeouts: BOOL¬TRUE,
pollDefault: INT ¬ 300, -- 5 minutes minimum between probes when disconnected
timeoutInitiating: NAT ¬ 11
];
pd: REF PD; -- This is exported from the PhoenixSmartsImpl
OpenConversations: TYPE = LIST OF ConvDesc;
ConvDesc: TYPE = REF ConvDescBody;
ConvDescBody: TYPE = RECORD
[
PhSmarts level information.
info: PhoenixInfo,
situation: Thrush.ConvEventBody,
cInfo: ThParty.ConversationInfoRec,
partyInfo: ThParty.PartyInfo,
myPriority: Rope.ROPE,
Derived values
convMedia: ATOM¬NIL,
expectedMedia: ATOM¬NIL,
actualMedia: ATOM¬NIL,
isConference: BOOL ¬ FALSE,
doingAudio: BOOL ¬ FALSE,
doingVideo: BOOL ¬ FALSE,
For use by PhSwitch level implementation.
stateAye: Thrush.StateInConv ¬ $neverWas,
toneBuf: TonePlay.AudioBuf ¬ NIL,
xmitStream: NetStreamInfoBody,
Because Mesa won't let you finish a list with a comma.
tail: INT¬0
];
LinkState: TYPE ~ { neverWas, unlinked, linked };
NetStreamInfo: TYPE ~ REF NetStreamInfoBody;
NetStreamInfoBody: TYPE ~ MACHINE DEPENDENT RECORD [
fd: AudioLibrary.FD ¬ pseudostdin,
vtAddress: AudioLibrary.IPAddress, -- Of the transmitter
vtDummy: AudioLibrary.IPPort ¬ [0,0], -- (keep the debugger completely happy)
vtPort: AudioLibrary.IPPort, -- of this stream.
linkDummy: [0..03FFFFFFFH] ¬ 0, -- more debugger
linkState: LinkState ¬ neverWas
];
PhoenixInfo: TYPE = REF PhoenixInfoBody;
PhoenixInfoBody: TYPE = MONITORED RECORD [ -- Per Finch instance: one, for now
smartsID: Thrush.SmartsID¬nullID,
partyID: PartyID ¬ nullID,
shh: SHHH¬NIL,
conversations: OpenConversations ¬ NIL,
myName: ThSmartsRpcControl.InterfaceName ¬ [],
myRName: ROPE ¬ NIL,
myPassword: RPC.EncryptionKey ¬ NULL,
prevThrushInstance: ROPE ¬ NIL,
pollCondition: CONDITION,
nextScheduledCheck: INT¬0,
lastRemoteRemark: ROPE ¬ NIL, -- print each remote remark once only
These values are derived from lower-level values.
enabled: BOOL¬FALSE, -- all levels are willing for connection to be maintained.
connected: BOOL ¬ FALSE -- connection is established, and we're registered with Thrush
];
phoenixInfo: PhoenixInfo; -- global description of what's going on.
Procedures exported by PhoenixSmartsImpl
Problem: PROC [comment: ROPE, info: PhoenixInfo, v1: IO.Value ¬ [null[]]];
Report: PROC [comment: ROPE, info: PhoenixInfo, v1: IO.Value ¬ [null[]], where: ATOM ¬ $Smarts];
Procedures exported by PhoenixRegisterImpl
InitPhoenixSmarts: PROC [thrushInstance: Thrush.ROPE¬NIL];
Initialize, then register the specified procedures via RegisterForReports.
UnInitPhoenixSmarts: PROC[disable: BOOL¬TRUE];
PhoenixIsRunning: PROC RETURNS [phoenixIsEnabled: BOOL, phoenixIsRunning: BOOL];
RecordSystemStateFromSmartsReport: PROC[nb: NB ¬ NIL, remark: Rope.ROPE, connected: BOOL, enabled: BOOL, voicePath: BOOL, remoteRemark: Rope.ROPE ] RETURNS[echoNB: NB];
Poke: PROC;
If enabled but not connected, tries to get connected, best way.
Procedures exported by ThPhoenixPrivateImpl
ForgetConv: PROC [cDesc: ConvDesc];
Delete the conversation from the open conversations list. This procedure is called
when the conversation terminates and a transition to the idle state is made.
GetConv: PROC [info: PhoenixInfo, credentials: Thrush.Credentials,
createOK: BOOL ¬ FALSE] RETURNS [cDesc: ConvDesc];
Try to locate a description for outr involvement into the credentials.convID (maybe
NullConvID where the purpose is to create a new, unassigned cDesc).
DBInfo: PROC[partyID: Thrush.PartyID, attribute: ATOM ¬ NIL, prevRNAtom: ATOM ¬ NIL] RETURNS [rName: Thrush.ROPE¬NIL, rNAtom: ATOM¬NIL, value: Thrush.ROPE¬NIL];
}.
September 30, 1992 10:14:13 am PDT, DCS, renamed from PhoenixSmarts; massive revisions to accommodate switch to kernel-based audio functions.
Suggest decommissioning these, until we understand multiple stuff better, now that multiple audio conversations are not prohibited, and we're not really doing video. Finch should do all the thinking about this in the PhoenixPhone model (no Phoenix UI).
FindActiveConv: PROC [info: PhoenixInfo] RETURNS [cDesc: ConvDesc¬NIL];
Find the conversation in which Phoenix is in the "$active" state.
MoreThanOneConversation: PROC [info: PhoenixInfo] RETURNS [BOOL ¬ FALSE];
Returns TRUE if Phoenix is participating in (in any state) more than one conversation, otherwise, it returns FALSE.
MoreThanOneAudioConversation: PROC [info: PhoenixInfo] RETURNS [BOOL];
Returns TRUE if Phoenix is participating in a state > $notified in any of the conversations that require audio device. Otherwise, it returns FALSE.
VideoHardwareInUse: PROC [cDesc: ConvDesc] RETURNS [inUse: BOOL];