{--------------------------------------------------} { Simple telephone connection phase - TMDL Example } { January 31, 1995 } {--------------------------------------------------} Map Map5 is {--------------------------------------------------} INTERNAL { Hidden global activities } GiveTone, GotDial, AskAnswer, GotAnswer, EndDial, EndRing, EndConnect, Disconnected, AllowHangUp {--------------------------------------------------} INTERACTIONS &Grouping1, &Grouping2 on GiveTone, GotDial, EndDial, AskAnswer, GotAnswer, EndRing; Where Group &Grouping1 is ConnectionPhase, Disconnecting on EndConnect, AllowHangUp; EndGroup Group &Grouping2 is Answering, Dialing on Nothing; EndGroup {--------------------------------------------------} DESCRIPTIONS Timethread ConnectionPhase is { This is the main timethread. } AbortedOn (EndConnect) { Can be aborted (HangUp) } Internal RegInit, { Register the initiator in the database } CheckDB { Check a abstract (and virtual!) database } Trigger (OffHook) Action (RegInit) Sync (AllowHangUp) { Starts the Disconnecting TT } Sync (GiveTone) { Starts the Dialing TT } Wait Time (GotDial) OrFork Guard (TimeGotDial eq OK) { Dial is finished in time } Continue OR Guard (TimeGotDial eq TOut) { TimeOut: Took too much time to dial } Path Abort (EndDial) { Abort Dialing TT } Result (ErrorDial) { ... and ask user to hangup } EndPath EndOrFork Action (CheckDB) { The following choice is made by the simulation's user. } { Tags and guards could be used, but they are unnecessary since } { we do not really simulate the database. } OrFork Continue { Not busy and valid number } OR Path Result (WrongNumber) EndPath OR Path Result (BusyTone) EndPath EndOrFork Sync (AskAnswer) { Starts the Answering TT } Wait Time (GotAnswer) OrFork Guard (TimeGotAnswer eq OK) { Answered in allowed time } Continue OR Guard (TimeGotAnswer eq TOut) { TimeOut: Not answered in allowed time } Path Abort (EndRing) { Abort the answering TT } Result (NoAnswer) { ... and ask user to hangup } EndPath EndOrFork Result (Connected) { Connection done. } EndTT { ConnectionPhase } {--------------------------------------------------} Timethread Disconnecting is EndRec { LOTOS end recursion } Trigger (AllowHangUp) Wait (HangUp) { Caller hangups. Abort everything and disconnect. } Par Abort(EndConnect) And Abort(EndDial) And Abort(EndRing) EndPar Result (Disconnected) EndTT { Disconnecting } {--------------------------------------------------} Timethread Dialing is AbortedOn (EndDial) Trigger (GiveTone) Action (Tone) Wait (Dial) Result (GotDial) EndTT { Dialing } {--------------------------------------------------} Timethread Answering is AbortedOn (EndRing) Trigger (AskAnswer) Action (Ring) Wait (Answer) Result (GotAnswer) EndTT { Answering } EndMap { Map5 }