DI-Guy C++ SDK Reference  13.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyExerciseInterface.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2014 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 /*****************************************************************************/
48  /*l
49  *b Description:
50  **
51  ** This function sends an xc_set_tin_tod PDU. This PDU
52  ** tells a remote DI-Guy application the simulated time of day
53  ** at which its scenario is supposed to begin. Doing this
54  ** provides a conceptual link between scenario time, which
55  ** nominally starts at zero, and wall-clock time. This makes
56  ** it possible for a scenario to be run under different
57  ** simulated lighting conditions.
58  **
59  ** The remote DI-Guy application essentially does a
60  ** diguyScenario::set_tin_time_of_day() call.
61  **
62  *b Arguments:
63  **
64  *a site - destination host id (65535 for all sites)
65  *a host - destination host id (65535 for all hosts)
66  *a ttod - tin time of day (seconds after midnight)
67  **
68  *b Callable From:
69  **
70  *- - C++
71  *- - Script
72  */
73  void send_pdu_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  *b Callable From:
95  **
96  *- - C++
97  *- - Script
98  */
99  void send_pdu_xc_load_scenario(unsigned short site,
100  unsigned short host,
101  const char* filename,
102  const char* refname);
103 
104  /*l
105  *b Description:
106  **
107  ** This function sends an xc_save_scenario PDU. This PDU
108  ** tells a remote DI-Guy application to save a particular
109  ** scenario file.
110  **
111  ** The remote DI-Guy application essentially does a
112  ** diguyScenario::save_as() call.
113  **
114  *b Arguments:
115  **
116  *a site - destination host id (65535 for all sites)
117  *a host - destination host id (65535 for all hosts)
118  *a filename - scenario to load
119  *a use_user_name - user name to uniquely identify the file
120  **
121  *b Callable From:
122  **
123  *- - C++
124  *- - Script
125  */
126  void send_pdu_xc_save_scenario(unsigned short site,
127  unsigned short host,
128  const char* filename,
129  const int use_user_name);
130 
131  /*l
132  *b Description:
133  **
134  ** This function sends an xc_reset_scenario PDU. This PDU
135  ** tells a remote DI-Guy application to reset the current
136  ** scenario file.
137  **
138  ** The remote DI-Guy application essentially does a
139  ** diguyScenario::reset() call.
140  **
141  *b Arguments:
142  **
143  *a site - destination host id (65535 for all sites)
144  *a host - destination host id (65535 for all hosts)
145  **
146  *b Callable From:
147  **
148  *- - C++
149  *- - Script
150  */
151  void send_pdu_xc_reset_scenario(unsigned short site,
152  unsigned short host);
153 
154  /*l
155  *b Description:
156  **
157  ** This function sends an xc_merge_scenario PDU. This PDU
158  ** tells a remote DI-Guy application to merge a particular
159  ** scenario file.
160  **
161  ** The remote DI-Guy application essentially does a
162  ** diguyScenario::merge() call.
163  **
164  *b Arguments:
165  **
166  *a site - destination host id (65535 for all sites)
167  *a host - destination host id (65535 for all hosts)
168  *a ttod - tin time of day for the merged scenario
169  *a (seconds after midnight)
170  *a refx, refy, refz - transformation reference point in merged
171  *a scenario (point around which translation
172  *a and rotation will occur)
173  *a tx, ty, tz - translation of reference point in merged
174  *a scenario
175  *a rz, rx, ry - rotation of reference point in merged scenario
176  *a filename - filename of scenario to merge
177  *a collision_suffix - suffix to be used in event of name
178  *a conflicts
179  **
180  *b Callable From:
181  **
182  *- - C++
183  *- - Script
184  */
185  void send_pdu_xc_merge_scenario(unsigned short site,
186  unsigned short host,
187  float ttod,
188  float refx, float refy, float refz,
189  float tx, float ty, float tz,
190  float rz, float rx, float ry,
191  const char* filename,
192  const char* suffix);
193 
194  /*l
195  *b Description:
196  **
197  ** This function sends an xc_trigger_script PDU. This PDU
198  ** tells a remote DI-Guy application to trigger the named
199  ** script.
200  **
201  ** The remote DI-Guy application essentially does a
202  ** diguyScenario::trigger_script() call.
203  **
204  *b Arguments:
205  **
206  *a site - destination host id (65535 for all sites)
207  *a host - destination host id (65535 for all hosts)
208  *a script_name - name of the script to be triggered
209  **
210  *b Callable From:
211  **
212  *- - C++
213  *- - Script
214  */
215  void send_pdu_xc_trigger_script(unsigned short site,
216  unsigned short host,
217  const char* script_name);
218 
219  /*l
220  *b Description:
221  **
222  ** This function sends an xc_control PDU. This PDU tells a
223  ** remote DI-Guy application to PLAY, STOP, RESET, etc.
224  **
225  *b Arguments:
226  **
227  *a site - destination host id (65535 for all sites)
228  *a host - destination host id (65535 for all hosts)
229  *a command - command string. Valid values are "RESET",
230  *a "RUN", "STOP", "FF", "REWIND"
231  **
232  *b Callable From:
233  **
234  *- - C++
235  *- - Script
236  */
237  void send_pdu_xc_control(unsigned short site,
238  unsigned short host,
239  const char* command);
240 
241  /*l
242  *b Description:
243  **
244  ** This function sends an xc_time_now PDU. This PDU tells all
245  ** remote DI-Guy applications what the simulated time of day is
246  ** right now. There is no way to target this message at
247  ** particular DI-Guy hosts. It is received and processed by all
248  ** DI-Guy applications in the DIS exercise.
249  **
250  *b Arguments:
251  **
252  *a tod - time of day: number of seconds since midnight,
253  *a where 0.0 <= tod < 86400.0
254  *a smooth_period - how many real seconds should be taken to get
255  *a into sync
256  **
257  ** Scenarios can proceed from one day to the next, up to a length of
258  ** 24 hours. When midnight comes, tod should be specified AS ZERO,
259  ** and should increase from there. Values less than zero or greater
260  ** than or equal to 86400.0 will NOT be sent over the network. In
261  ** the case nothing will be sent.
262  **
263  *b Callable From:
264  **
265  *- - C++
266  *- - Script
267  */
268  void send_pdu_xc_time_now(float tod, float smooth_period);
269 
270  /*l
271  *b Description:
272  **
273  ** This function sends an xc_eval_script PDU. This PDU tells a
274  ** remote DI-Guy application to evaluate a literal piece of
275  ** script text.
276  **
277  *b Arguments:
278  **
279  *a site - destination host id (65535 for all sites)
280  *a host - destination host id (65535 for all hosts)
281  *a text - text of the script to be executed
282  **
283  *b Callable From:
284  **
285  *- - C++
286  *- - Script
287  */
288  void send_pdu_xc_eval_script(unsigned short site,
289  unsigned short host,
290  const char* text);
291 
292  /*l
293  *b Description:
294  **
295  ** This function sends an xc_enter_slave PDU. This PDU tells a remote
296  ** DI-Guy application to start slaving it's camera to incoming
297  ** camera/time packets.
298  **
299  *b Arguments:
300  **
301  *a site - destination host id (65535 for all sites)
302  *a host - destination host id (65535 for all hosts)
303  **
304  *b Callable From:
305  **
306  *- - C++
307  *- - Script
308  */
309  void send_pdu_xc_enter_slave_mode(unsigned short site, unsigned short host);
310 
311  /*l
312  *b Description:
313  **
314  ** This function sends an xc_exit_slave PDU. This PDU tells a remote
315  ** DI-Guy application to stop slaving it's camera to incoming
316  ** camera/time packets.
317  **
318  *b Arguments:
319  **
320  *a site - destination host id (65535 for all sites)
321  *a host - destination host id (65535 for all hosts)
322  **
323  *b Callable From:
324  **
325  *- - C++
326  *- - Script
327  */
328  void send_pdu_xc_exit_slave_mode(unsigned short site, unsigned short host);
329 
330 
335  /*l
336  *b Description:
337  **
338  ** This function sends a custom AI message PDU. This PDU is mapped
339  ** into a diguyCharacter::agent_accept_message() function call on
340  ** the receiving side.
341  **
342  *b Arguments:
343  **
344  *a character - pointer to the remote diguyCharacter
345  *a sender_name - who is sending the message
346  *a message_type - type of message is being sent
347  *a message - message string
348  *a message_params - optional parameter string
349  **
350  ** Use diguyExerciseInterface::get_net_id() to get the name of the
351  ** character that the remote machine will see the sender as.
352  **
353  *b Callable From:
354  **
355  *- - C++
356  *- - Script
357  */
358  int send_message_to_character(diguyCharacter* character,
359  const char* sender_name,
360  const char* message_type,
361  const char* message,
362  const char* message_params = NULL);
363 
364  /*l
365  *b Description:
366  **
367  ** This function sends a custom AI message PDU. This PDU is mapped
368  ** into a diguyCharacterGroup::send_message_to_all_members() on all
369  ** clients.
370  **
371  *b Arguments:
372  **
373  *a group_name - name of the diguyCharacterGroup to target
374  *a sender_name - who is sending the message
375  *a message_type - what type of message is being sent
376  *a message - the message string
377  *a message_params - optional parameter string
378  **
379  ** Use diguyExerciseInterface::get_net_id() to get the name of the
380  ** character that the remote machine will see the sender as.
381  **
382  *b Callable From:
383  **
384  *- - C++
385  *- - Script
386  */
387  int send_message_to_group(const char* group_name,
388  const char* sender_name,
389  const char* message_type,
390  const char* message,
391  const char* message_params = NULL);
392 
393  /*l
394  *b Description:
395  **
396  ** This function sends a custom AI message PDU. This PDU is mapped
397  ** into a diguyCharacter::agent_broadcast_message() on all clients.
398  **
399  *b Arguments:
400  **
401  *a sender - pointer to the diguyCharacter that is broadcasting
402  *a the message
403  *a radius - how far to broadcast the message
404  *a message_type - what type of message is being sent
405  *a message - the message string
406  *a message_params - optional parameter string
407  **
408  *b Callable From:
409  **
410  *- - C++
411  *- - Script
412  */
413  int broadcast_message(diguyCharacter* sender,
414  float radius,
415  const char* message_type,
416  const char* message,
417  const char* message_params = NULL);
418 
419  /*l
420  *b Description:
421  **
422  ** This function sends a custom AI message PDU. This PDU is mapped
423  ** into a diguyCharacter::agent_broadcast_message_to_group() on all
424  ** clients.
425  **
426  *b Arguments:
427  **
428  *a sender - pointer to the diguyCharacter that is broadcasting
429  *a the message
430  *a group_name - the group that receive the message
431  *a radius - how far to broadcast the message
432  *a message_type - what type of message is being sent
433  *a message - the message string
434  *a message_params - optional parameter string
435  **
436  *b Callable From:
437  **
438  *- - C++
439  *- - Script
440  */
441  int broadcast_message_to_group(diguyCharacter* sender,
442  const char* group_name,
443  float radius,
444  const char* message_type,
445  const char* message,
446  const char* message_params = NULL);
447 
448  /*l
449  *b Returns:
450  **
451  ** "sitenum_hostnum_idnum" as a string
452  **
453  ** Useful for knowing the name that this entity will have on remote
454  ** machines. This string should be copied.
455  */
456  const char* get_net_id(diguyCharacter* character);
457 
458 
459 /****************************************************************************/
460 /****************************************************************************/
465 /****************************************************************************/
467  // Documentation Pending
468  int convert_mgrs_to_local(const char* MGRS_str, float* x, float* y, float* z);
469 
470  const char* convert_local_to_mgrs(float x, float y, float z);
471 
472  // returns straightforward latitude and longitude coordinates
473  float convert_local_to_lat(float x, float y, float z);
474  float convert_local_to_long(float x, float y, float z);
475 
476  // returns latitude and longitude in degrees, minutes, seconds
477  const char* convert_local_to_lat_long_string(float x, float y, float z);
478 
479  int convert_lat_long_to_local(float lat, float lon, float* x, float* y, float* z);
481 
486 #ifdef CPLUSPLUS_ONLY
487 
488  bdiExerciseInterface* get_scripted_object() {return m_bdiExerciseInterface;}
489 
490 private:
491 
492  friend class bdiExerciseInterface;
493 
494  /*l
495  ** A private constructor.
496  */
497  diguyExerciseInterface(bdiExerciseInterface* ei);
498 
499  /*l
500  ** A pointer to internal data.
501  */
502  bdiExerciseInterface* m_bdiExerciseInterface;
503 
504 #endif /* CPLUSPLUS_ONLY */
505 
506 };
507 
508 
509 #endif /* __diguyExerciseInterface_H */
510