DI-Guy SDK Documentation  13.2
diguyExerciseInterface.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2016 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t diguyExerciseInterface
10  **
11  *b Link against: libdiguy
12  */
13 
14 #ifndef __diguyExerciseInterface_H
15 #define __diguyExerciseInterface_H
16 
17 #ifdef SWIG
19 #else
20 #define CPLUSPLUS_ONLY
21 #endif
22 
23 #include <diguyExerciseInterface.h>
24 
25 #ifdef CPLUSPLUS_ONLY
26 
27 class bdiExerciseInterface;
28 class diguyCharacter;
29 
30 #include <stdio.h> // for NULL
31 #include <diguy_constants.h>
32 
33 #endif /* CPLUSPLUS_ONLY */
34 
35 
36 #include <declspec_diguy.h>
37 
38 /****************************************************************************/
39 class BDI_DECLSPEC_diguy diguyExerciseInterface
40 {
41 
42 public:
43 
44 /*****************************************************************************/
53  /*l
54  *b Description:
55  **
56  ** This function sends an xc_set_tin_tod PDU. This PDU
57  ** tells a remote DI-Guy application the simulated time of day
58  ** at which its scenario is supposed to begin. Doing this
59  ** provides a conceptual link between scenario time, which
60  ** nominally starts at zero, and wall-clock time. This makes
61  ** it possible for a scenario to be run under different
62  ** simulated lighting conditions.
63  **
64  ** The remote DI-Guy application essentially does a
65  ** diguyScenario::set_tin_time_of_day() call.
66  **
67  *b Arguments:
68  **
69  *a site - destination host id (65535 for all sites)
70  *a host - destination host id (65535 for all hosts)
71  *a ttod - tin time of day (seconds after midnight)
72  */
73  void send_xc_set_tin_tod(unsigned short site,
74  unsigned short host,
75  float ttod);
76 
77  /*l
78  *b Description:
79  **
80  ** This function sends an xc_load_scenario PDU. This PDU
81  ** tells a remote DI-Guy application to load a particular
82  ** scenario file.
83  **
84  ** The remote DI-Guy application essentially does a
85  ** diguyScenario::load() call.
86  **
87  *b Arguments:
88  **
89  *a site - destination host id (65535 for all sites)
90  *a host - destination host id (65535 for all hosts)
91  *a filename - scenario to load
92  *a refname - scenario reference name
93  */
94  void send_xc_load_scenario(unsigned short site,
95  unsigned short host,
96  const char* filename,
97  const char* refname);
98 
99  /*l
100  *b Description:
101  **
102  ** This function sends an xc_save_scenario PDU. This PDU
103  ** tells a remote DI-Guy application to save a particular
104  ** scenario file.
105  **
106  ** The remote DI-Guy application essentially does a
107  ** diguyScenario::save_as() call.
108  **
109  *b Arguments:
110  **
111  *a site - destination host id (65535 for all sites)
112  *a host - destination host id (65535 for all hosts)
113  *a filename - scenario to load
114  *a use_user_name - user name to uniquely identify the file
115  */
116  void send_xc_save_scenario(unsigned short site,
117  unsigned short host,
118  const char* filename,
119  const int use_user_name);
120 
121  /*l
122  *b Description:
123  **
124  ** This function sends an xc_reset_scenario PDU. This PDU
125  ** tells a remote DI-Guy application to reset the current
126  ** scenario file.
127  **
128  ** The remote DI-Guy application essentially does a
129  ** diguyScenario::reset() call.
130  **
131  *b Arguments:
132  **
133  *a site - destination host id (65535 for all sites)
134  *a host - destination host id (65535 for all hosts)
135  */
136  void send_xc_reset_scenario(unsigned short site,
137  unsigned short host);
138 
139  /*l
140  *b Description:
141  **
142  ** This function sends an xc_merge_scenario PDU. This PDU
143  ** tells a remote DI-Guy application to merge a particular
144  ** scenario file.
145  **
146  ** The remote DI-Guy application essentially does a
147  ** diguyScenario::merge() call.
148  **
149  *b Arguments:
150  **
151  *a site - destination host id (65535 for all sites)
152  *a host - destination host id (65535 for all hosts)
153  *a ttod - tin time of day for the merged scenario
154  *a (seconds after midnight)
155  *a refx, refy, refz - transformation reference point in merged
156  *a scenario (point around which translation
157  *a and rotation will occur)
158  *a tx, ty, tz - translation of reference point in merged
159  *a scenario
160  *a rz, rx, ry - rotation of reference point in merged scenario
161  *a filename - filename of scenario to merge
162  *a collision_suffix - suffix to be used in event of name
163  *a conflicts
164  */
165  void send_xc_merge_scenario(unsigned short site,
166  unsigned short host,
167  float ttod,
168  float refx, float refy, float refz,
169  float tx, float ty, float tz,
170  float rz, float rx, float ry,
171  const char* filename,
172  const char* suffix);
173 
174  /*l
175  *b Description:
176  **
177  ** This function sends an xc_trigger_script PDU. This PDU
178  ** tells a remote DI-Guy application to trigger the named
179  ** script.
180  **
181  ** The remote DI-Guy application essentially does a
182  ** diguyScenario::trigger_script() call.
183  **
184  *b Arguments:
185  **
186  *a site - destination host id (65535 for all sites)
187  *a host - destination host id (65535 for all hosts)
188  *a script_name - name of the script to be triggered
189  */
190  void send_xc_trigger_script(unsigned short site,
191  unsigned short host,
192  const char* script_name);
193 
194  /*l
195  *b Description:
196  **
197  ** This function sends an xc_control PDU. This PDU tells a
198  ** remote DI-Guy application to PLAY, STOP, RESET, etc.
199  **
200  *b Arguments:
201  **
202  *a site - destination host id (65535 for all sites)
203  *a host - destination host id (65535 for all hosts)
204  *a command - command string. Valid values are "RESET",
205  *a "RUN", "STOP", "FF", "REWIND"
206  */
207  void send_xc_control(unsigned short site,
208  unsigned short host,
209  const char* command);
210 
211  /*l
212  *b Description:
213  **
214  ** This function sends an xc_time_now PDU. This PDU tells all
215  ** remote DI-Guy applications what the simulated time of day is
216  ** right now. There is no way to target this message at
217  ** particular DI-Guy hosts. It is received and processed by all
218  ** DI-Guy applications in the DIS exercise.
219  **
220  *b Arguments:
221  **
222  *a tod - time of day: number of seconds since midnight,
223  *a where 0.0 <= tod < 86400.0
224  *a smooth_period - how many real seconds should be taken to get
225  *a into sync
226  **
227  ** Scenarios can proceed from one day to the next, up to a length of
228  ** 24 hours. When midnight comes, tod should be specified AS ZERO,
229  ** and should increase from there. Values less than zero or greater
230  ** than or equal to 86400.0 will NOT be sent over the network. In
231  ** the case nothing will be sent.
232  */
233  void send_xc_time_now(float tod, float smooth_period);
234 
235  /*l
236  *b Description:
237  **
238  ** This function sends an xc_eval_script PDU. This PDU tells a
239  ** remote DI-Guy application to evaluate a literal piece of
240  ** script text.
241  **
242  *b Arguments:
243  **
244  *a site - destination host id (65535 for all sites)
245  *a host - destination host id (65535 for all hosts)
246  *a text - text of the script to be executed
247  */
248  void send_xc_eval_script(unsigned short site,
249  unsigned short host,
250  const char* text);
251 
252  /*l
253  *b Description:
254  **
255  ** This function sends an xc_enter_slave PDU. This PDU tells a remote
256  ** DI-Guy application to start slaving it's camera to incoming
257  ** camera/time packets.
258  **
259  *b Arguments:
260  **
261  *a site - destination host id (65535 for all sites)
262  *a host - destination host id (65535 for all hosts)
263  */
264  void send_xc_enter_slave_mode(unsigned short site, unsigned short host);
265 
266  /*l
267  *b Description:
268  **
269  ** This function sends an xc_exit_slave PDU. This PDU tells a remote
270  ** DI-Guy application to stop slaving it's camera to incoming
271  ** camera/time packets.
272  **
273  *b Arguments:
274  **
275  *a site - destination host id (65535 for all sites)
276  *a host - destination host id (65535 for all hosts)
277  */
278  void send_xc_exit_slave_mode(unsigned short site, unsigned short host);
279 
280 
285  /*l
286  *b Description:
287  **
288  ** This function sends a custom AI message PDU. This PDU is mapped
289  ** into a diguyCharacter::agent_accept_message() function call on
290  ** the receiving side.
291  **
292  *b Arguments:
293  **
294  *a character - pointer to the remote diguyCharacter
295  *a sender - pointer to local diguyCharacter
296  *a message_type - type of message is being sent
297  *a message - message string
298  *a message_params - optional parameter string
299  **
300  ** Use diguyExerciseInterface::get_net_id() to get the name of the
301  ** character that the remote machine will see the sender as.
302  */
303  int send_message_to_character(diguyCharacter* character,
304  diguyCharacter* sender,
305  const char* message_type,
306  const char* message,
307  const char* message_params = NULL);
308 
309  /*l
310  *b Description:
311  **
312  ** This function sends a custom AI message PDU. This PDU is mapped
313  ** into a diguyCharacterGroup::send_message_to_all_members() on all
314  ** clients.
315  **
316  *b Arguments:
317  **
318  *a group_name - name of the diguyCharacterGroup to target
319  *a sender - pointer to local diguyCharacter
320  *a message_type - what type of message is being sent
321  *a message - the message string
322  *a message_params - optional parameter string
323  **
324  ** Use diguyExerciseInterface::get_net_id() to get the name of the
325  ** character that the remote machine will see the sender as.
326  */
327  int send_message_to_group(const char* group_name,
328  diguyCharacter* sender,
329  const char* message_type,
330  const char* message,
331  const char* message_params = NULL);
332 
333  /*l
334  *b Description:
335  **
336  ** This function sends a custom AI message PDU. This PDU is mapped
337  ** into a diguyCharacter::agent_broadcast_message() on all clients.
338  **
339  *b Arguments:
340  **
341  *a sender - pointer to the diguyCharacter that is broadcasting
342  *a the message
343  *a radius - how far to broadcast the message
344  *a message_type - what type of message is being sent
345  *a message - the message string
346  *a message_params - optional parameter string
347  */
348  int broadcast_message(diguyCharacter* sender,
349  float radius,
350  const char* message_type,
351  const char* message,
352  const char* message_params = NULL);
353 
354  /*l
355  *b Description:
356  **
357  ** This function sends a custom AI message PDU. This PDU is mapped
358  ** into a diguyCharacter::agent_broadcast_message_to_group() on all
359  ** clients.
360  **
361  *b Arguments:
362  **
363  *a sender - pointer to the diguyCharacter that is broadcasting
364  *a the message
365  *a group_name - the group that receive the message
366  *a radius - how far to broadcast the message
367  *a message_type - what type of message is being sent
368  *a message - the message string
369  *a message_params - optional parameter string
370  */
371  int broadcast_message_to_group(diguyCharacter* sender,
372  const char* group_name,
373  float radius,
374  const char* message_type,
375  const char* message,
376  const char* message_params = NULL);
377 
378  /*l
379  *b Returns:
380  **
381  ** "sitenum_hostnum_idnum" as a string
382  **
383  ** Useful for knowing the name that this entity will have on remote
384  ** machines. This string should be copied.
385  */
386  const char* get_net_id(diguyCharacter* character);
387 
388  /*l
389  *b Returns:
390  **
391  ** HLA federate type string, or "NA" if using DIS
392  **
393  */
394  const char* get_federate_type();
395 
397 
398 /****************************************************************************/
399 /****************************************************************************/
404 /****************************************************************************/
405 
410  int convert_mgrs_to_local(const char* MGRS_str, float* x, float* y, float* z);
412  const char* convert_local_to_mgrs(float x, float y, float z);
413 
414  // returns straightforward latitude and longitude coordinates
415  float convert_local_to_lat(float x, float y, float z);
416  double convert_local_to_lat_double(double x, double y, double z );
417  float convert_local_to_long(float x, float y, float z);
418  double convert_local_to_long_double(double x, double y, double z );
419 
420  // returns latitude and longitude in degrees, minutes, seconds
421  const char* convert_local_to_lat_long_string(float x, float y, float z);
422 
423  int convert_lat_long_to_local(float lat, float lon, float* x, float* y, float* z);
424  int convert_lat_long_to_local_double(double lat, double lon, float* x, float* y, float* z);
425 
426 
431 #ifdef CPLUSPLUS_ONLY
432 
433  bdiExerciseInterface* get_scripted_object() {return m_bdiExerciseInterface;}
434 
435 private:
436 
437  friend class bdiExerciseInterface;
438 
439  /*l
440  ** A private constructor.
441  */
442  diguyExerciseInterface(bdiExerciseInterface* ei);
443 
444  /*l
445  ** A pointer to internal data.
446  */
447  bdiExerciseInterface* m_bdiExerciseInterface;
448 
449 #endif /* CPLUSPLUS_ONLY */
450 
451 };
452 
453 
454 #endif /* __diguyExerciseInterface_H */
455 
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:81
Definition: diguyExerciseInterface.h:37