TTEthernet Model for INET Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TTETestApp.cc
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU Lesser General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 #include "TTETestApp.h"
17 #include "CTFrame.h"
18 
19 namespace TTEthernetModel {
20 
21 Define_Module( TTETestApp);
22 
24 {
25  scheduleAt(simTime(), new cMessage("ACTIVATOR!"));
26 }
27 
28 void TTETestApp::handleMessage(cMessage *msg)
29 {
30  if (!msg->arrivedOn("TTin") && *new std::string(getParentModule()->getName()) != "videoclient")
31  {
32  CTFrame *frame = new CTFrame("CT-ID=100");
33  MACAddress srcAddr;
34  srcAddr.setAddress("03 04 05 06 00 64");
35  frame->setDest(srcAddr);
36  frame->setCtID(100);
37  //ENDE TEST
38 
39  if (getParentModule()->getSubmodule("VL_TT_100_CTC"))
40  sendDirect(frame, getParentModule()->getSubmodule("VL_TT_100_CTC")->gate("in"));
41  }
42 
43  if (!msg->arrivedOn("TTin") && *new std::string(getParentModule()->getName()) != "videoclient")
44  {
45  CTFrame *frame = new CTFrame("CT-ID=101");
46  MACAddress srcAddr;
47  srcAddr.setAddress("03 04 05 06 00 65");
48  frame->setDest(srcAddr);
49  frame->setCtID(100);
50  frame->setByteLength(1500);
51  //ENDE TEST
52 
53  if (getParentModule()->getSubmodule("VL_TT_101_CTC"))
54  sendDirect(frame, getParentModule()->getSubmodule("VL_TT_101_CTC")->gate("in"));
55  }
56 
57  delete msg;
58  // TODO - Generated method body
59 }
60 
61 } //namespace