VR-Forces Developer's Guide
 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) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include <vlutil/vlUtil.h>
9 #include <vlpi/simulationAddress.h>
10 
11 //This class provides a text interface for controlling VR-Forces's aerodrome stuff over the network.
12 //This interface currently supports the following actions:
13 //
14 //1. set [ lights | arrestorGear | runwayCondition ]
15 // set a VR-Forces object attribute
16 
17 //2. get [ lights | allLights | arrestorGear | allArrestorGear | runwayCondition ]
18 // get the corresponding value of a VR-Forces entity
19 
20 //3. list [aerodromes | runways]
21 // print the list of all aerodromes/runways in the simulation
22 
23 //4. print [object]
24 // print all relevant aerodrome information about a runway/aerodrome
25 
26 //5. printAll
27 // print all relevant aerodrome informations in the simulation
28 
29 //6. quit
30 // quit the application
31 
32 namespace makVrf
33 {
34  class DtVrlinkVrfRemoteController;
35 }
36 
38 class DtSimMessage;
40 
41 class DtTextInterface
42 {
43 public:
44 
45  //constructor
46  DtTextInterface(DtVrfRemoteController* controller/*, DtReflectedAerodromeObjectsManager* manager*/);
47 
48  //destructor
49  virtual ~DtTextInterface();
50 
51  //Process entered text
52  void readStdin();
53 
54  //Set/Get time to quit
55  virtual void setTimeToQuit(bool yesNo);
56  virtual bool timeToQuit() const;
57 
58  //Get remote vrf controller pointer
60 
61  static void scenarioStatusCallback(DtSimMessage* msg, void* usr);
62 
63 public:
64 
65  //Functions for parsing command strings
66  virtual void setLights(char* str);
67  virtual void setAllLights(char* str);
68  virtual void setArrestorGear(char* str);
69  virtual void setRunwayCondition(char* str);
70 
71  virtual void getLights(char* str);
72  virtual void getAllLights(char* str);
73  virtual void getArrestorGear(char* str);
74  virtual void getAllArrestorGear(char* str);
75  virtual void getRunwayCondition(char* str);
76 
77  virtual void listAerodromes();
78  virtual void listRunways(char* str);
79 
80  virtual void printSpeciticObjectDatas(char* str);
81  virtual void printAllDatas();
82 
83 public:
84 
85  //-------------------------------------------------------
86  //Text callback functions
87  //-------------------------------------------------------
88 
89  //Called in response to "set"
90  static void setCmd(char* s, DtTextInterface* a);
91 
92  //Called in response to "get"
93  static void getCmd(char* s, DtTextInterface* a);
94 
95  //Called in response to "quit" or "q"
96  static void quitCmd(char* s, DtTextInterface* a);
97 
98  //Called in response to "help" or "?" or "h"
99  static void helpCmd(char* s, DtTextInterface* a);
100 
101  //Called in response to "list"
102  static void listCmd(char* s, DtTextInterface* a);
103 
104  //Called in response to "print"
105  static void printCmd(char* s, DtTextInterface* a);
106 
107  //Called in response to "printAll"
108  static void printAllCmd(char* s, DtTextInterface* a);
109 
110 public:
111 
112  //callback on the creation of control objects
113  static void controlObjectAddedCallback(DtReflectedControlObject*, void* usr);
115 
116 protected:
117 
118  //Present commmand line interface.
119  void prompt();
120 
121  //Parse user input, call corresponding function
122  void processCmd(char *buff);
123 
124 protected :
125 
126  //method useful to look for a control object from its name
127  //such methods already exists in the uuidNetworkManager(), but,in case if the entity has been renamed, it looks on all control objects in the simulation
128  virtual DtReflectedControlObject* lookupVrfControlObjectByName(const std::string& markingText);
129 
130 protected:
131 
132  bool myTimeToQuit;
134 
135 private:
136  int kbInterest;
137 };
static void listCmd(char *s, DtTextInterface *a)
DtTextInterface(makVrf::DtVrlinkVrfRemoteController *controller)
virtual void listAerodromes()
virtual void getLights(char *str)
virtual void printSpeciticObjectDatas(char *str)
static void getCmd(char *s, DtTextInterface *a)
Definition: textIf.h:65
virtual void listRunways(char *str)
virtual DtReflectedControlObject * lookupVrfControlObjectByName(const std::string &markingText)
virtual void printAllDatas()
void processCmd(char *buff)
virtual void setLights(char *str)
int kbInterest
Definition: textIf.h:280
bool myTimeToQuit
Definition: textIf.h:271
virtual void setRunwayCondition(char *str)
The main class for the remote control interface to VR-Forces. Instantiating this class allows the sen...
Definition: vrfRemoteController.h:201
virtual void setArrestorGear(char *str)
static void quitCmd(char *s, DtTextInterface *a)
File: simMsg.h.
Definition: simMessage.h:35
DtVrfRemoteController * myController
Definition: textIf.h:133
virtual void getAllArrestorGear(char *str)
static void scenarioStatusCallback(DtSimMessage *msg, void *usr)
virtual void processControlObjectAdded(DtReflectedControlObject *)
virtual void setAllLights(char *str)
virtual ~DtTextInterface()
virtual void getAllLights(char *str)
static void printCmd(char *s, DtTextInterface *a)
virtual makVrf::DtVrlinkVrfRemoteController * controller() const
virtual bool timeToQuit() const
static void setCmd(char *s, DtTextInterface *a)
static void controlObjectAddedCallback(DtReflectedControlObject *, void *usr)
static void printAllCmd(char *s, DtTextInterface *a)
virtual void getRunwayCondition(char *str)
static void helpCmd(char *s, DtTextInterface *a)
Definition: reflectedControlObject.h:26
virtual void getArrestorGear(char *str)
virtual void setTimeToQuit(bool yesNo)

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)