VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
textIf.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include <vlutil/vlUtil.h>
10 
11 //This class provides a text interface for controlling VR-Forces over the network.
12 //This interface currently supports the following actions:
13 //
14 //1. load <filename>
15 // load a scenario file
16 
17 //2. save <filename>
18 // save the current scenario
19 
20 //3. new <db filename>
21 // create a new scenario
22 
23 //4. close
24 // close the current scenario
25 
26 //5. rewind
27 // rewind the current scenario to its start state
28 
29 //6. run
30 // sends a message interface request to run the current scenario
31 
32 //6a. simrun
33 // sends a sim mgmt start PDU to run the current scenario
34 
35 //7. simpause
36 // sends a sim mgmt stop PDU to pause the current scenario
37 
38 //7a. pause
39 // sends a sim mgmt pause request to pause the current scenario
40 
41 //8. list
42 // list all the backends that are currently running
43 
44 //9. create [ waypoint | route | tank | aggregate]
45 // create a VR-Forces waypoint, route, tank, or tank aggregate
46 
47 //10. delete [ <object_name> | <object_id> ]
48 // delete a VR-Forces object by name or by object ID
49 
50 //11. set [ plan | label | location | fuel | target | restore ]
51 // set a VR-Forces object attribute
52 
53 //12. task [ patrolRoute | moveToPoint | follow | wait ]
54 // task a VR-Forces entity
55 
56 //13. aggregate "name1" "name2" "name3"
57 // aggregate 3 VR-Forces entities together
58 
59 //14. timemultiplier
60 // sets the time multiplier on the exercise clock
61 
62 //15. quit
63 // quit the application
64 
66 {
67 public:
68 
69  //constructor
71 
72  //destructor
73  virtual ~DtTextInterface();
74 
75  //Process entered text
76  void readStdin();
77 
78  //Set/Get time to quit
79  virtual void setTimeToQuit(bool yesNo);
80  virtual bool timeToQuit() const;
81 
82  //Get remote vrf controller pointer
83  virtual DtVrfRemoteController* controller() const;
84 
85 public:
86 
87  //Functions for parsing command strings and calling
88  //the corresponding methods on DtVrfRemoteController.
89 
90  virtual void createWaypoint(char* str);
91  virtual void createRoute(char* str);
92  virtual void createTank(char* str);
93  virtual void printEnv(char* str);
94  virtual void createAggregate(char* str);
95  virtual void setPlan(char* str);
96  virtual void setLabel(char* str);
97  virtual void setSystemEnabled(char* str);
98  virtual void setLocation(char* str);
99  virtual void setFuel(char* str);
100  virtual void setTarget(char* str);
101  virtual void setRestore(char* str);
102  virtual void patrolRoute(char* str);
103  virtual void moveToPoint(char* str);
104  virtual void follow(char* str);
105  virtual void wait(char* str);
106  virtual void bigRoute(int iPoints);
107  virtual void listSnapshots();
109 
110 public:
111 
112  //-------------------------------------------------------
113  //Text callback functions
114  //-------------------------------------------------------
115 
116  //Called in response to "list"
117  static void listCmd(char* s, DtTextInterface* a);
118 
119  //Called in response to "load"
120  static void loadCmd(char* s, DtTextInterface* a);
121  //Called by DtVrfRemoteController::loadScenario when back-ends are missing
122  static bool missingBackends(DtBackendMap* map, const std::set<DtSimulationAddress>& currentBackends, void* usr);
123 
124  //Called in response to "new"
125  static void newCmd(char* s, DtTextInterface* a);
126 
127  //Called in response to "save"
128  static void saveCmd(char* s, DtTextInterface* a);
129 
130  //Called in response to "create"
131  static void createCmd(char* s, DtTextInterface* a);
132 
133  //Called in response to "print"
134  static void printCmd(char* s, DtTextInterface* a);
135 
136  //Called in response to "set"
137  static void setCmd(char* s, DtTextInterface* a);
138 
139  //Called in response to "setspeed"
140  static void setSpeedCmd(char* s, DtTextInterface* a);
141 
142  //Called in response to "setsensor"
143  static void setSensorCmd(char* s, DtTextInterface* a);
144 
145  //Called in response to "task"
146  static void taskCmd(char* s, DtTextInterface* a);
147 
148  //Called in response to "aggregate"
149  static void aggregateCmd(char* s, DtTextInterface* a);
150 
151  //Called in response to "delete"
152  static void deleteCmd(char* s, DtTextInterface* a);
153 
154  //Called in response to "close"
155  static void closeCmd(char* s, DtTextInterface* a);
156 
157  //Called in response to "monitor"
158  static void monitorResourcesCmd(char* s, DtTextInterface* a);
159 
160  //Called in response to "unmonitor"
161  static void removeMonitorResourcesCmd(char* s, DtTextInterface* a);
162 
163  //Called in response to "rewind"
164  static void rewindCmd(char* s, DtTextInterface* a);
165 
166  //Called in response to "run"
167  static void runCmd(char* s, DtTextInterface* a);
168 
169  //Called in response to "pause"
170  static void pauseCmd(char* s, DtTextInterface* a);
171 
172  //Called in response to "simrun"
173  static void simrunCmd(char* s, DtTextInterface* a);
174 
175  //Called in response to "simpause"
176  static void simpauseCmd(char* s, DtTextInterface* a);
177 
178  //Called in response to "timemultipler"
179  static void timemultiplierCmd(char* s, DtTextInterface* a);
180 
181  //Called in response to "quit" or "q"
182  static void quitCmd(char* s, DtTextInterface* a);
183 
184  //Called in response to "help" or "?" or "h"
185  static void helpCmd(char* s, DtTextInterface* a);
186 
187  //Called in response to "help" or "?" or "h"
188  static void bigRouteCmd(char* s, DtTextInterface* a);
189 
190  //Called in response to "listsnapshots"
191  static void listSnapshotsCmd(char* s, DtTextInterface* a);
192 
193  //Called in response to "takesnapshot"
194  static void takeSnapshotCmd(char* s, DtTextInterface* a);
195 
196  //Called in response to "turnonsnapshots"
197  static void turnOnSnapshotsCmd(char* s, DtTextInterface* a);
198 
199  //Called in response to "turnoffsnapshots"
200  static void turnOffSnapshotsCmd(char* s, DtTextInterface* a);
201 
202  //Called in response to "rollback"
203  static void rollbackToSnapshotCmd(char* s, DtTextInterface* a);
204 
205  //Called in response to "simulationStatus"
206  static void simulationStatusCmd(char* s, DtTextInterface* a);
207 
208  //-------------------------------------------------------
209  //DtVrfRemoteController callback functions
210  //-------------------------------------------------------
211 
212  //Backend arrival/departure callbacks
213  static void backendAddedCb(const DtSimulationAddress& addr, void* usr);
214  static void backendRemovedCb(const DtSimulationAddress& addr, void* usr);
215 
216  //Simulation status changed callback
217  static void simulationStatusChanged(DtSimulationStatus, void* usr);
218 
219  //Backend loaded/saved callbacks
220  static void backendLoadedCb(const DtSimulationAddress& addr, void* usr);
221  static void backendSavedCb(const DtSimulationAddress& addr,
222  DtSaveResult result, void* usr);
223 
224  //Scenario loaded/saved callbacks
225  static void ScenarioLoadedCb(void* usr);
226  static void ScenarioSavedCb(void* usr);
227 
228  //VR-Forces object created callback
229  static void vrfObjectCreatedCb(
230  const DtString& name, const DtEntityIdentifier& id, const DtUUID& uuid, void* usr);
231 
232  //Plan callbacks
233  static void printStatement(const DtSimStatement* stmt, int indent = 1);
234  static void printBlock(const DtSimBlock* stmt, int indent = 1);
235  static void planCb(const DtUUID& name,
236  const std::vector<DtSimStatement*>& statements, bool append, void* usr);
237  static void planStmtCb(const DtUUID& id, DtPlanStatus status, void* usr);
238  static void planCompleteCb(const DtUUID& id, void* usr);
239 
240  //Callback used to process monitor resource responses
241  static void resourcesProcessedCb(DtSimMessage* msg, void* usr);
242 
243  //Callback for list of current snapshots
244  static void scenarioSnapshotResponseCb(DtSimMessage* msg, void* usr);
245 
246  //Callback used to receive object console messages from the remote control
247  //API.
248  static void objectConsoleMessageCb(const DtEntityIdentifier& id,
249  int notifyLevel, const DtString& message, void* usr);
250 
252 
253 protected:
254 
255  //Present commmand line interface.
256  void prompt();
257 
258  //Parse user input, call corresponding function
259  void processCmd(char *buff);
260 
261 protected:
262 
265  DtSelectParam sparam;
266  static unsigned int theNextAggregateId;
267  static unsigned int theNextSubordinateId;
269 
270 private:
272 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:222
static void pauseCmd(char *s, DtTextInterface *a)
virtual void setRestore(char *str)
static void backendSavedCb(const DtSimulationAddress &addr, DtSaveResult result, void *usr)
static void listCmd(char *s, DtTextInterface *a)
static void backendRemovedCb(const DtSimulationAddress &addr, void *usr)
DtSimulationStatus
Definition: backend.h:26
static void ScenarioSavedCb(void *usr)
static void rollbackToSnapshotCmd(char *s, DtTextInterface *a)
static void simpauseCmd(char *s, DtTextInterface *a)
static void scenarioSnapshotResponseCb(DtSimMessage *msg, void *usr)
virtual void setTarget(char *str)
static void removeMonitorResourcesCmd(char *s, DtTextInterface *a)
Definition: textIf.h:65
virtual void setFuel(char *str)
static void planCompleteCb(const DtUUID &id, void *usr)
virtual void wait(char *str)
static void turnOffSnapshotsCmd(char *s, DtTextInterface *a)
virtual void createWaypoint(char *str)
static bool missingBackends(DtBackendMap *map, const std::set< DtSimulationAddress > &currentBackends, void *usr)
void processCmd(char *buff)
virtual void createAggregate(char *str)
virtual void setLabel(char *str)
static void planStmtCb(const DtUUID &id, DtPlanStatus status, void *usr)
int kbInterest
Definition: textIf.h:271
static void setSensorCmd(char *s, DtTextInterface *a)
void setRemoveListCallback(bool b)
Definition: textIf.h:251
virtual void follow(char *str)
static void loadCmd(char *s, DtTextInterface *a)
static void printBlock(const DtSimBlock *stmt, int indent=1)
static void timemultiplierCmd(char *s, DtTextInterface *a)
static void rewindCmd(char *s, DtTextInterface *a)
class DtBackendMap:
Definition: backendMap.h:19
virtual void listSnapshots()
bool myTimeToQuit
Definition: textIf.h:263
static void simrunCmd(char *s, DtTextInterface *a)
static void planCb(const DtUUID &name, const std::vector< DtSimStatement * > &statements, bool append, void *usr)
DtVrfRemoteController * myController
Definition: textIf.h:264
static void printStatement(const DtSimStatement *stmt, int indent=1)
static void resourcesProcessedCb(DtSimMessage *msg, void *usr)
static void bigRouteCmd(char *s, DtTextInterface *a)
class DtSimBlock:
Definition: simBlock.h:27
virtual void printSimulationStatus(DtSimulationStatus)
The main class for the remote control interface to VR-Forces.
Definition: vrfRemoteController.h:204
static void deleteCmd(char *s, DtTextInterface *a)
DtSaveResult
Definition: ifSaveComplete.h:18
DtSelectParam sparam
Definition: textIf.h:265
virtual void setLocation(char *str)
static void closeCmd(char *s, DtTextInterface *a)
static void quitCmd(char *s, DtTextInterface *a)
File: simMsg.h.
Definition: simMessage.h:35
virtual void patrolRoute(char *str)
static void backendLoadedCb(const DtSimulationAddress &addr, void *usr)
static void createCmd(char *s, DtTextInterface *a)
virtual void createTank(char *str)
static void takeSnapshotCmd(char *s, DtTextInterface *a)
static void backendAddedCb(const DtSimulationAddress &addr, void *usr)
DtTextInterface(DtVrfRemoteController *controller)
virtual void bigRoute(int iPoints)
static void saveCmd(char *s, DtTextInterface *a)
static unsigned int theNextSubordinateId
Definition: textIf.h:267
static void turnOnSnapshotsCmd(char *s, DtTextInterface *a)
static void objectConsoleMessageCb(const DtEntityIdentifier &id, int notifyLevel, const DtString &message, void *usr)
Small container class that holds the status of a running DtPlan.
Definition: plan.h:45
static void newCmd(char *s, DtTextInterface *a)
virtual DtVrfRemoteController * controller() const
static void runCmd(char *s, DtTextInterface *a)
static void aggregateCmd(char *s, DtTextInterface *a)
virtual void setSystemEnabled(char *str)
class DtSimStatement:
Definition: simStatement.h:35
virtual void moveToPoint(char *str)
virtual ~DtTextInterface()
virtual void setPlan(char *str)
static void listSnapshotsCmd(char *s, DtTextInterface *a)
static void vrfObjectCreatedCb(const DtString &name, const DtEntityIdentifier &id, const DtUUID &uuid, void *usr)
static void setSpeedCmd(char *s, DtTextInterface *a)
static unsigned int theNextAggregateId
Definition: textIf.h:266
static void printCmd(char *s, DtTextInterface *a)
static void monitorResourcesCmd(char *s, DtTextInterface *a)
virtual bool timeToQuit() const
static void ScenarioLoadedCb(void *usr)
virtual void createRoute(char *str)
static void setCmd(char *s, DtTextInterface *a)
static void taskCmd(char *s, DtTextInterface *a)
virtual void printEnv(char *str)
bool myRemoveListCallback
Definition: textIf.h:268
static void helpCmd(char *s, DtTextInterface *a)
static void simulationStatusCmd(char *s, DtTextInterface *a)
static void simulationStatusChanged(DtSimulationStatus, void *usr)
virtual void setTimeToQuit(bool yesNo)

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)