# Txc6 Class Reference

Inheritance diagram for Txc6:

List of all members.

## Detailed Description

In this step we'll introduce random numbers. We change the delay from 1s to a random value which can be set from the NED file or from omnetpp.ini. In addition, we'll "lose" (delete) the packet with a small probability.

## Public Member Functions

| Txc6 ()
virtual | ~Txc6 ()

## Protected Member Functions

virtual void | initialize ()
virtual void | handleMessage (cMessage *msg)

## Private Attributes

cMessage * | event
cMessage * | tictocMsg

## Constructor & Destructor Documentation

Txc6::Txc6 | ( |  | ) |

    00038 {
    00039     event = tictocMsg = NULL;
    00040 }

Txc6::~Txc6 | ( |  | ) | `[virtual]`

    00043 {
    00044     cancelAndDelete(event);
    00045     delete tictocMsg;
    00046 }

## Member Function Documentation

void Txc6::handleMessage | ( | cMessage * | msg | ) | `[protected, virtual]`

Reimplemented from cSimpleModule.

    00062 {
    00063     if (msg==event)
    00064     {
    00065         ev << "Wait period is over, sending back message\n";
    00066         send(tictocMsg, "out");
    00067         tictocMsg = NULL;
    00068     }
    00069     else
    00070     {
    00071         // "Lose" the message with 0.1 probability:
    00072         if (uniform(0,1) < 0.1)
    00073         {
    00074             ev << "\"Losing\" message\n";
    00075             delete msg;
    00076         }
    00077         else
    00078         {
    00079             // The "delayTime" module parameter can be set to values like
    00080             // "exponential(5)" (tictoc6.ned, omnetpp.ini), and then here
    00081             // we'll get a different delay every time.
    00082             double delay = par("delayTime");
    00083
    00084             ev << "Message arrived, starting to wait " << delay << " secs...\n";
    00085             tictocMsg = msg;
    00086             scheduleAt(simTime()+delay, event);
    00087         }
    00088     }
    00089 }

void Txc6::initialize | ( |  | ) | `[protected, virtual]`

Reimplemented from cModule.

    00049 {
    00050     event = new cMessage("event");
    00051     tictocMsg = NULL;
    00052
    00053     if (strcmp("tic", name()) == 0)
    00054     {
    00055         ev << "Scheduling first send to t=5.0s\n";
    00056         scheduleAt(5.0, event);
    00057         tictocMsg = new cMessage("tictocMsg");
    00058     }
    00059 }

## Member Data Documentation

cMessage* Txc6::event `[private]`

cMessage* Txc6::tictocMsg `[private]`

The documentation for this class was generated from the following file:

- txc6.cc