64 | | uint32_t socketfd = ConnectToShell(); |
65 | | SendMessage(socketfd, "get_number_observables"); |
66 | | |
67 | | memset(buffer, 0, 256); |
68 | | ReadMessage(socketfd, buffer); |
69 | | uint32_t numObservables = atoi(buffer); |
70 | | |
71 | | return numObservables; |
72 | | } |
73 | | |
74 | | uint32_t |
75 | | GetNumUtilities() |
76 | | { |
77 | | char buffer[256]; |
78 | | |
79 | | uint32_t socketfd = ConnectToShell(); |
80 | | SendMessage(socketfd, "get_number_utilities"); |
81 | | |
82 | | memset(buffer, 0, 256); |
83 | | ReadMessage(socketfd, buffer); |
84 | | uint32_t numUtilities = atoi(buffer); |
85 | | |
86 | | return numUtilities; |
87 | | } |
88 | | |
89 | | uint32_t |
90 | | SetActiveMission(char * activeMission) |
91 | | { |
92 | | char buffer[256]; |
93 | | |
94 | | uint32_t socketfd = ConnectToShell(); |
95 | | SendMessage(socketfd, "set_active_mission"); |
96 | | |
97 | | SendMessage(socketfd, activeMission); |
98 | | |
99 | | //memset(buffer, 0, 256); |
100 | | //ReadMessage(socketfd, buffer); |
101 | | |
102 | | return 1; |
103 | | } |
104 | | |
105 | | uint32_t |
106 | | GetNumParameters() |
107 | | { |
108 | | char buffer[256]; |
109 | | |
110 | | uint32_t socketfd = ConnectToShell(); |
111 | | SendMessage(socketfd, "get_number_parameters"); |
112 | | |
113 | | memset(buffer, 0, 256); |
114 | | ReadMessage(socketfd, buffer); |
115 | | uint32_t numParameters = atoi(buffer); |
116 | | |
117 | | return numParameters; |
118 | | } |
119 | | // end previous TODO |
120 | | |
121 | | /* Given a certain set of observables, ask the radio to find the optimum radio |
122 | | * parameters and return them. |
123 | | * |
124 | | * TODO I'm a little confused about this function... why would anyone need to |
125 | | * use this? Shouldn't this be internal to the radio operation? |
126 | | * |
127 | | * TODO this function is returning a pointer to allocated memory, which is fine, |
128 | | * but we need to document this and make sure the caller is deallocating the |
129 | | * memory when it is done using it. |
130 | | */ |
| 93 | /* Send Utilities */ |
| 94 | memset(counter, 0, 55); |
| 95 | sprintf(counter, "%i", numUtilities); |
| 96 | SendMessage(socketFD, counter); |
| 97 | for(size_t i = 0; i < numUtilities; i++) { |
| 98 | SendMessage(socketFD,radioUtilities[i].name.c_str()); |
| 99 | sprintf(var,"%f",radioUtilities[i].value); |
| 100 | SendMessage(socketFD,var); |
| 101 | } |
| 102 | |
| 103 | |
| 153 | |
| 154 | // Send Utilities |
| 155 | memset(counter, 0, 55); |
| 156 | sprintf(counter, "%i", numUtilities); |
| 157 | SendMessage(socketFD, counter); |
| 158 | for(size_t i = 0; i < numUtilities; i++) { |
| 159 | SendMessage(socketFD, u[i].name.c_str()); |
| 160 | sprintf(var, "%f", u[i].value); |
| 161 | SendMessage(socketFD, var); |
| 162 | } |
| 163 | |
216 | | bool ActivateComponent(uint32_t id) { |
217 | | return 1; |
218 | | } |
219 | | bool DeactivateComponent(uint32_t id) { |
220 | | return 1; |
221 | | } |
222 | | bool DisconnectComponent(uint32_t id) { |
223 | | return 1; |
224 | | } |
| 166 | uint32_t GetNum(string type) |
| 167 | { |
| 168 | |
| 169 | char buffer[256]; |
| 170 | uint32_t socketfd = ConnectToShell(); |
| 171 | |
| 172 | if (type == "parameters") |
| 173 | SendMessage(socketfd, "get_number_parameters"); |
| 174 | else if (type == "utilities") |
| 175 | SendMessage(socketfd, "get_number_utilities"); |
| 176 | else if (type == "observables") |
| 177 | SendMessage(socketfd, "get_number_observables"); |
| 178 | else |
| 179 | LOG("Type not included, either 'parameters' or 'utilities' or 'observables'"); |
| 180 | |
| 181 | memset(buffer, 0, 256); |
| 182 | ReadMessage(socketfd, buffer); |
| 183 | uint32_t number = atoi(buffer); |
| 184 | return number; |
234 | | uint32_t* GetConnectedPolicyEngines(){ |
235 | | } |
236 | | uint32_t* GetConnectedManagementServiceLayers(){ |
237 | | } |
238 | | uint32_t* GetConnectedComponents(){ |
239 | | } |
240 | | |
241 | | |
242 | | /* View data from the current status of the radio. |
243 | | * |
244 | | * This function allows client code to capture radio properties at any certain |
245 | | * instant. Note, however, that these properties could be changing at very |
246 | | * rapid rates. There is no guarantee that the return results from these |
247 | | * functions will still be valid by the time the client code receives them. |
248 | | */ |
249 | | Observable* GetRadioObservables() { |
250 | | } |
251 | | Parameter* GetRadioParameters(){ |
252 | | } |
253 | | Utility* GetRadioUtilities(){ |
254 | | } |
255 | | |
256 | | |
257 | | /* Parses VTCROSS XML configuration file and uses it to configure the radio. |
258 | | * |
259 | | * This function *must* be called when the radio first starts up, and may be |
260 | | * called at any point after that to reconfigure the radio. |
261 | | */ |
262 | | bool ParseRadioConfiguration(){ |
263 | | } |
264 | | |
265 | | |
266 | | /* Lists current radio configuration options loaded from the configuration XML |
267 | | * file. |
268 | | * |
269 | | * TODO How are we listing these? Are we simply returning them to stdout? |
270 | | * Logging them? Returning strings? Need to figure this out... |
271 | | */ |
272 | | void ListCurrentRadioConfiguration(){ |
273 | | } |
274 | | |
275 | | /* Shut down the radio. |
276 | | * |
277 | | * This function will deactivate and disconnect all radio components before |
278 | | * finally shutting down the shell and stopping radio operations. |
279 | | */ |
280 | | bool Shutdown(){ |
281 | | } |
282 | | |