Inheritance diagram for Tic7:

Public Member Functions | |
| Module_Class_Members (Tic7, cSimpleModule, 0) | |
| virtual void | initialize () |
| virtual void | handleMessage (cMessage *msg) |
Protected Attributes | |
| double | timeout |
| cMessage * | timeoutEvent |
|
|
Reimplemented from cSimpleModule. 00051 {
00052 if (msg==timeoutEvent)
00053 {
00054 // If we receive the timeout event, that means the packet hasn't
00055 // arrived in time and we have to re-send it.
00056 ev << "Timeout expired, resending message and restarting timer\n";
00057 cMessage *msg = new cMessage("tictocMsg");
00058 send(msg, "out");
00059 scheduleAt(simTime()+timeout, timeoutEvent);
00060 }
00061 else // message arrived
00062 {
00063 // Acknowledgement received -- delete the stored message and cancel
00064 // the timeout event.
00065 ev << "Timer cancelled.\n";
00066 cancelEvent(timeoutEvent);
00067
00068 // Ready to send another one.
00069 cMessage *msg = new cMessage("tictocMsg");
00070 send(msg, "out");
00071 scheduleAt(simTime()+timeout, timeoutEvent);
00072 }
00073 }
|
|
|
Reimplemented from cModule. 00038 {
00039 // Initialize variables.
00040 timeout = 1.0;
00041 timeoutEvent = new cMessage("timeoutEvent");
00042
00043 // Generate and send initial message.
00044 ev << "Sending initial message\n";
00045 cMessage *msg = new cMessage("tictocMsg");
00046 send(msg, "out");
00047 scheduleAt(simTime()+timeout, timeoutEvent);
00048 }
|
|
||||||||||||||||
|
|
|
|
|
|
|
|
1.3.9.1