VR-Forces 4.6 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 createAggregate(char* str);
94  virtual void setPlan(char* str);
95  virtual void setLabel(char* str);
96  virtual void setLocation(char* str);
97  virtual void setFuel(char* str);
98  virtual void setTarget(char* str);
99  virtual void setRestore(char* str);
100  virtual void patrolRoute(char* str);
101  virtual void moveToPoint(char* str);
102  virtual void follow(char* str);
103  virtual void wait(char* str);
104  virtual void bigRoute(int iPoints);
105  virtual void listSnapshots();
106 
107 public:
108 
109  //-------------------------------------------------------
110  //Text callback functions
111  //-------------------------------------------------------
112 
113  //Called in response to "list"
114  static void listCmd(char* s, DtTextInterface* a);
115 
116  //Called in response to "load"
117  static void loadCmd(char* s, DtTextInterface* a);
118  //Called by DtVrfRemoteController::loadScenario when back-ends are missing
119  static bool missingBackends(DtBackendMap* map, void* usr);
120 
121  //Called in response to "new"
122  static void newCmd(char* s, DtTextInterface* a);
123 
124  //Called in response to "save"
125  static void saveCmd(char* s, DtTextInterface* a);
126 
127  //Called in response to "create"
128  static void createCmd(char* s, DtTextInterface* a);
129 
130  //Called in response to "set"
131  static void setCmd(char* s, DtTextInterface* a);
132 
133  //Called in response to "setspeed"
134  static void setSpeedCmd(char* s, DtTextInterface* a);
135 
136  //Called in response to "setsensor"
137  static void setSensorCmd(char* s, DtTextInterface* a);
138 
139  //Called in response to "task"
140  static void taskCmd(char* s, DtTextInterface* a);
141 
142  //Called in response to "aggregate"
143  static void aggregateCmd(char* s, DtTextInterface* a);
144 
145  //Called in response to "delete"
146  static void deleteCmd(char* s, DtTextInterface* a);
147 
148  //Called in response to "close"
149  static void closeCmd(char* s, DtTextInterface* a);
150 
151  //Called in response to "monitor"
152  static void monitorResourcesCmd(char* s, DtTextInterface* a);
153 
154  //Called in response to "unmonitor"
155  static void removeMonitorResourcesCmd(char* s, DtTextInterface* a);
156 
157  //Called in response to "rewind"
158  static void rewindCmd(char* s, DtTextInterface* a);
159 
160  //Called in response to "run"
161  static void runCmd(char* s, DtTextInterface* a);
162 
163  //Called in response to "pause"
164  static void pauseCmd(char* s, DtTextInterface* a);
165 
166  //Called in response to "simrun"
167  static void simrunCmd(char* s, DtTextInterface* a);
168 
169  //Called in response to "simpause"
170  static void simpauseCmd(char* s, DtTextInterface* a);
171 
172  //Called in response to "timemultipler"
173  static void timemultiplierCmd(char* s, DtTextInterface* a);
174 
175  //Called in response to "quit" or "q"
176  static void quitCmd(char* s, DtTextInterface* a);
177 
178  //Called in response to "help" or "?" or "h"
179  static void helpCmd(char* s, DtTextInterface* a);
180 
181  //Called in response to "help" or "?" or "h"
182  static void bigRouteCmd(char* s, DtTextInterface* a);
183 
184  //Called in response to "listsnapshots"
185  static void listSnapshotsCmd(char* s, DtTextInterface* a);
186 
187  //Called in response to "takesnapshot"
188  static void takeSnapshotCmd(char* s, DtTextInterface* a);
189 
190  //Called in response to "turnonsnapshots"
191  static void turnOnSnapshotsCmd(char* s, DtTextInterface* a);
192 
193  //Called in response to "turnoffsnapshots"
194  static void turnOffSnapshotsCmd(char* s, DtTextInterface* a);
195 
196  //Called in response to "rollback"
197  static void rollbackToSnapshotCmd(char* s, DtTextInterface* a);
198 
199  //-------------------------------------------------------
200  //DtVrfRemoteController callback functions
201  //-------------------------------------------------------
202 
203  //Backend arrival/departure callbacks
204  static void backendAddedCb(const DtSimulationAddress& addr, void* usr);
205  static void backendRemovedCb(const DtSimulationAddress& addr, void* usr);
206 
207  //Backend loaded/saved callbacks
208  static void backendLoadedCb(const DtSimulationAddress& addr, void* usr);
209  static void backendSavedCb(const DtSimulationAddress& addr,
210  DtSaveResult result, void* usr);
211 
212  //Scenario loaded/saved callbacks
213  static void ScenarioLoadedCb(void* usr);
214  static void ScenarioSavedCb(void* usr);
215 
216  //VR-Forces object created callback
217  static void vrfObjectCreatedCb(
218  const DtString& name, const DtEntityIdentifier& id, const DtUUID& uuid, void* usr);
219 
220  //Plan callbacks
221  static void printStatement(const DtSimStatement* stmt, int indent = 1);
222  static void printBlock(const DtSimBlock* stmt, int indent = 1);
223  static void planCb(const DtUUID& name,
224  const std::vector<DtSimStatement*>& statements, bool append, void* usr);
225  static void planStmtCb(const DtUUID& id, DtPlanStatus status, void* usr);
226  static void planCompleteCb(const DtUUID& id, void* usr);
227 
228  //Callback used to process monitor resource responses
229  static void resourcesProcessedCb(DtSimMessage* msg, void* usr);
230 
231  //Callback for list of current snapshots
232  static void scenarioSnapshotResponseCb(DtSimMessage* msg, void* usr);
233 
234  //Callback used to receive object console messages from the remote control
235  //API.
236  static void objectConsoleMessageCb(const DtEntityIdentifier& id,
237  int notifyLevel, const DtString& message, void* usr);
238 
240 
241 protected:
242 
243  //Present commmand line interface.
244  void prompt();
245 
246  //Parse user input, call corresponding function
247  void processCmd(char *buff);
248 
249 protected:
250 
253  DtSelectParam sparam;
254  static unsigned int theNextAggregateId;
255  static unsigned int theNextSubordinateId;
257 
258 private:
260 };

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)