OverSim
SimpleGameClient.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
25 #ifndef __SIMPLEGAMECLIENT_H_
26 #define __SIMPLEGAMECLIENT_H_
27 
28 #include <map>
29 #include <string>
30 
31 #include <tunoutscheduler.h>
32 #include <realtimescheduler.h>
33 
34 #include <Vector2D.h>
35 #include <BaseApp.h>
36 
37 #include <GlobalCoordinator.h>
38 #include <GlobalStatisticsAccess.h>
39 #include <MovementGenerator.h>
40 #include <randomRoaming.h>
41 #include <groupRoaming.h>
42 #include <hotspotRoaming.h>
43 #include <traverseRoaming.h>
44 #include <greatGathering.h>
45 #include <realWorldRoaming.h>
46 #include "SCPacket.h"
47 #include "SimpleGameClient_m.h"
48 
49 
51 
55 class SimpleGameClient : public BaseApp
56 {
57  public:
58  // OMNeT++
59  virtual ~SimpleGameClient();
60  virtual void initializeApp(int stage);
61  virtual void handleTimerEvent(cMessage* msg);
62  virtual void handleLowerMessage(cMessage* msg);
63  virtual void handleReadyMessage(CompReadyMessage* msg);
64  virtual void finishApp();
65 
67  double getAOI() {return AOIWidth;};
68  bool isOverlayReady() {return overlayReady;};
70 
72 
73  protected:
76 
77  void updateNeighbors(GameAPIListMessage* sgcMsg);
78  void updatePosition();
79 
80  // parameters
81  simtime_t movementDelay;
83  bool useScenery;
87  bool logAOI;
88 
89  NeighborMap::iterator itNeighbors;
90  std::string GeneratorType;
91 
92  // timers
93  cMessage* move_timer;
94 
95  // realworld
96  void handleRealworldPacket(char *buf, uint32_t len);
97  cMessage* packetNotification; // used by TunOutScheduler to notify about new packets
98  PacketBuffer packetBuffer; // received packets are stored here
100  unsigned int mtu;
101  SOCKET appFd;
103  bool frozen;
104 
105  // AOI measuring / hotspots
106  double startAOI;
110  simtime_t lastAOImeasure;
111  double avgAOI;
112  simtime_t nonHotspotTime;
115  simtime_t hotspotTime;
117 };
118 
119 #endif