<<>> <> <> <> <> <> <<>> <> <<>> <> <<>> DIRECTORY RefID USING [ID], Rope USING [ROPE], SRPCCalls USING [ Error, GetSHandle, NewRPCConversation, SHandle, TimeoutEnable ], SunRPC USING [Handle], Thrush, ThrushSunRPC, ThrushSunRPCConvert, ThSmarts, ThSmartsRpcControl USING [InterfaceRecord, InterfaceRecordObject], ThSmartsSunImport, ThSmartsSunRPC, ThSmartsSunRPCClient ; ThSmartsToThSmartsSunRPC: CEDAR PROGRAM IMPORTS SRPCCalls, ThSmartsSunRPCClient, ThrushSunRPCConvert EXPORTS ThSmartsSunImport ~ { OPEN ThrushSunRPCConvert; <> InterfaceRecord: TYPE ~ ThSmartsRpcControl.InterfaceRecord; SHHH: TYPE ~ Thrush.SHHH; sunSHHH: CARD32 = 0; Error: PUBLIC ERROR[errCode: ATOM, explanation: Rope.ROPE] ~ CODE; Progress: PROC[ interface: InterfaceRecord, shh: Thrush.SHHH, convEvent: Thrush.ConvEvent ] = { ENABLE SRPCCalls.Error => Error[errCode, explanation]; ThSmartsSunRPCClient.Progress[h: GetHandle[shh], shh: sunSHHH, convEvent: ConvEventToSr[convEvent]]; }; ReportAction: PROC[ interface: InterfaceRecord, shh: Thrush.SHHH, report: Thrush.ActionReport ] = { ENABLE SRPCCalls.Error => Error[errCode, explanation]; ThSmartsSunRPCClient.ReportAction[h: GetHandle[shh], shh: sunSHHH, report: ActionReportToSr[report]]; }; <<>> Substitution: PROC[ interface: InterfaceRecord, shh: Thrush.SHHH, convEvent: Thrush.ConvEvent, oldPartyID: Thrush.PartyID, newPartyID: Thrush.PartyID ] = { ENABLE SRPCCalls.Error => Error[errCode, explanation]; ThSmartsSunRPCClient.Substitution[h: GetHandle[shh], shh: sunSHHH, convEvent: ConvEventToSr[convEvent], oldPartyID: oldPartyID, newPartyID: newPartyID]; }; CheckIn: PROC[ interface: InterfaceRecord, shh: Thrush.SHHH, credentials: Thrush.Credentials, voicePath: BOOL _ TRUE, reason: Thrush.Reason, remark: Thrush.ROPE_NIL, nextScheduledCheck: INT ] = { ENABLE SRPCCalls.Error => Error[errCode, explanation]; ThSmartsSunRPCClient.CheckIn[h: GetHandle[shh], shh: sunSHHH, credentials: CredentialsToSr[credentials], voicePath: voicePath, reason: ATOMToSr[reason], remark: ROPEToSr[remark], nextScheduledCheck: nextScheduledCheck]; }; <> GetHandle: PROC [shhh: Thrush.SHHH] RETURNS [h: SunRPC.Handle_NIL] = { sHandle: SRPCCalls.SHandle _ SRPCCalls.GetSHandle[shhh]; IF sHandle#NIL THEN h _ sHandle.handle; }; <> sunPgm: CARD _ 390910; -- decimal program number for ThSmarts sunPgmVersion: CARD _ 1; sunCallTimeout: INT _ 3000; sunCallRetries: INT _ 3; sunCallTimeoutEnable: SRPCCalls.TimeoutEnable _ always; <> <<>> ImportInterface: PUBLIC PROC [instance: Rope.ROPE, reportProblem: ThSmartsSunImport.ReportProblem_NIL, reportData: REF_NIL] <<Report stuff not implemented yet, if ever.>> RETURNS [interface: InterfaceRecord, shhh: SHHH] ~ { shhh _ SRPCCalls.NewRPCConversation[serverName: instance, rpcProgram: sunPgm, rpcVersion: sunPgmVersion, timeoutEnable: sunCallTimeoutEnable, timeoutInMs: sunCallTimeout, retries: sunCallRetries]; SRPCCalls.GetSHandle[shhh].enabled _ TRUE; interface _ NEW[ThSmartsRpcControl.InterfaceRecordObject]; interface^ _ [clientStubProgress: Progress, clientStubReportAction: ReportAction, clientStubSubstitution: Substitution, clientStubCheckIn: CheckIn]; }; <<>> }. <> <> <> <> <> <> <> <> <> <> <> <> <<>>