DI-Guy C++ SDK Reference  13.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguy_module_net.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  **
10  *t DI-Guy API, VR-Link
11  **
12  *b Link against: libdiguy_module_dis or libdiguy_module_hla
13  **
14  */
15 
16 #ifndef __diguy_module_net_H
17 #define __diguy_module_net_H
18 
19 #include <declspec_diguy.h>
20 
21 class diguyCharacter;
22 class diguyScenario;
23 class diguyNetInterface;
24 struct diguyNetInterfaceData;
25 class bdiDataTracker;
26 
27 
28 /****************************************************************************/
29 typedef enum
30 {
35 
37 
38 
39 extern "C"
40 {
41 
42 /*l
43  *b Description:
44  **
45  ** This function allows VR-Link to install some callbacks so that DSS file
46  ** load and save will include VR-Link-specific info.
47  **
48  ** It should be called BEFORE the scenario object is constructed.
49  **
50  *b Returns:
51  **
52  ** 0 on success, -1 on failure
53  **
54  *b Example:
55  **
56  *e diguy_module_net_initialize();
57  */
58 BDI_DECLSPEC_diguy int diguy_module_net_initialize();
59 
60 /*l
61  *b Description:
62  **
63  ** This function allows DI-Guy networking to clean up.
64  **
65  ** It should be called once, on application shutdown, after the scenario
66  ** object has been destroyed.
67  **
68  *b Returns:
69  **
70  ** 0 on success, -1 on failure
71  **
72  *b Example:
73  **
74  *e diguy_module_net_deinitialize();
75  */
76 BDI_DECLSPEC_diguy int diguy_module_net_deinitialize();
77 
78 /*l
79  *b Description:
80  **
81  ** This function returns a diguyNetInterface which can be used to change
82  ** settings on the networking module. This will be an appropriate
83  ** version of the net interface, i.e. a DIS or a HLA interface, depending
84  ** on which library was linked in.
85  **
86  *b Returns:
87  **
88  ** pointer to a diguyNetInterface
89  */
90 BDI_DECLSPEC_diguy diguyNetInterface* get_net_interface();
91 
92 }
93 
94 
95 /****************************************************************************/
96 /*l
97  *b Description:
98  **
99  ** This class provides accessors to the interface parameters, as well as
100  ** functions for going online and offline.
101  **
102  */
103 class BDI_DECLSPEC_diguy diguyNetInterface
104 {
105 
106 public:
107 
108  /*l
109  *b Description:
110  **
111  ** This function tells DI-Guy that it should start talking over
112  ** VR-Link.
113  **
114  ** It should be called when DI-Guy should join an exercise.
115  **
116  *b Arguments:
117  **
118  *a scenario - pointer to the diguyScenario which will be connected to
119  *a the network
120  *a exconn - optional pointer to a VR-Link exercise connection to use
121  **
122  *b Returns:
123  **
124  ** 0 on success, -1 on failure
125  */
126  virtual int go_online(diguyScenario* scenario, void* exconn = NULL) = 0;
127 
128  /*l
129  *b Description:
130  **
131  ** This function tells DI-Guy that it should stop talking over
132  ** VR-Link.
133  **
134  *b Returns:
135  **
136  ** 0 on success, -1 on failure
137  */
138  virtual int go_offline() = 0;
139 
140  /*l
141  *b Description:
142  **
143  ** This function asks if DI-Guy is connected to the network.
144  **
145  *b Returns:
146  **
147  ** 1 if yes, 0 if no
148  */
149  virtual int get_online() = 0;
150 
151  /*l
152  *b Description:
153  **
154  ** This function sets the filename of the VR-Link configuration file
155  ** that will be read by the DI-Guy software. The default is
156  ** "network.cfg". This function must be called before the network
157  ** module is initialized.
158  **
159  *i C++ only
160  **
161  *b Arguments:
162  **
163  *a cfg_file - filename of desired configuration file
164  **
165  *b Returns:
166  **
167  ** 0 on success, -1 on failure
168  */
169  virtual int set_cfg_file(const char* cfg_filename) = 0;
170 
171  /*l
172  *b Description:
173  **
174  ** This function tells DI-Guy that it should read PDUs from the
175  ** network and process them. Call this function periodically.
176  **
177  *b Returns:
178  **
179  ** 0 on success, -1 on failure
180  */
181  virtual int update() = 0;
182 
183  /*l
184  *b Description:
185  **
186  ** Sets the exercise id to be used by DI-Guy networking.
187  **
188  ** The function will fail if DI-Guy is on-line (is participating in
189  ** an exercise).
190  **
191  *b Arguments:
192  **
193  *a exercise - the exercise id to use
194  **
195  *b Returns:
196  **
197  ** 0 on success, -1 on failure
198  */
199  virtual int set_exercise(int exercise) = 0;
200 
201  /*l
202  *b Description:
203  **
204  ** Gets the exercise id being used by DI-Guy networking.
205  **
206  *b Returns:
207  **
208  ** the exercise id
209  */
210  virtual int get_exercise() = 0;
211 
212  /*l
213  *b Description:
214  **
215  ** Sets the host id to be used by DI-Guy networking.
216  **
217  ** The function will fail if DI-Guy is on-line (is participating in
218  ** an exercise).
219  **
220  *b Arguments:
221  **
222  *a host - the host id to use; the host id identifies the local
223  *a machine
224  **
225  *b Returns:
226  **
227  ** 0 on success, -1 on failure
228  */
229  virtual int set_host(int host) = 0;
230 
231  /*l
232  *b Description:
233  **
234  ** Gets the host id being used by DI-Guy networking.
235  **
236  *b Returns:
237  **
238  ** the host id
239  */
240  virtual int get_host() = 0;
241 
242  /*l
243  *b Description:
244  **
245  ** Sets the site id to be used by DI-Guy networking.
246  **
247  ** The function will fail if DI-Guy is on-line (is participating in
248  ** an exercise).
249  **
250  *b Arguments:
251  **
252  *a site - the site id to use; the site id identifies where the local
253  *a machine is located
254  **
255  *b Returns:
256  **
257  ** 0 on success, -1 on failure
258  */
259  virtual int set_site(int site) = 0;
260 
261  /*l
262  *b Description:
263  **
264  ** Gets the site id being used by DI-Guy networking.
265  **
266  *b Returns:
267  **
268  ** the site id
269  */
270  virtual int get_site() = 0;
271 
272  /*l
273  *b Description:
274  **
275  ** Sets the network port number to be used by DI-Guy networking.
276  **
277  ** The function will fail if DI-Guy is on-line (is participating in
278  ** an exercise).
279  **
280  *b Arguments:
281  **
282  *a port - the port number to use
283  **
284  *b Returns:
285  **
286  ** 0 on success, -1 on failure
287  */
288  virtual int set_port(int port) = 0;
289 
290  /*l
291  *b Description:
292  **
293  ** Gets the port number of the port being used for DI-Guy networking.
294  **
295  *b Returns:
296  **
297  ** the port address
298  */
299  virtual int get_port() = 0;
300 
301  /*l
302  *b Description:
303  **
304  ** Sets the IP address to be used by DI-Guy networking. This address
305  ** is the address to which messages are sent. Normally, it is a
306  ** broadcast or multicast address.
307  **
308  ** The function will fail if DI-Guy is on-line (is participating in
309  ** an exercise).
310  **
311  *b Arguments:
312  **
313  *a ipaddr - the IP address
314  **
315  ** ipaddr is a string containing 4 integers separated by periods, or
316  ** the null string, which means "let DI-Guy choose the address". An
317  ** address of "0" or "0.0.0.0" means broadcast.
318  **
319  *b Returns:
320  **
321  ** 0 on success, -1 on failure
322  */
323  virtual int set_ipaddr(const char* ipaddr) = 0;
324 
325  /*l
326  *b Description:
327  **
328  ** Gets the IP address currently being used by DI-Guy networking.
329  ** This address is the address to which messages are sent. Normally
330  ** this is a broadcast or multicast address.
331  **
332  *b Arguments:
333  **
334  *a ipaddr - IP address, returned; see below
335  **
336  *b Returns:
337  **
338  ** 0 on success, -1 on failure
339  **
340  ** ipaddr is a char**, into which a char* will be placed. This char*
341  ** points to static data owned by DI-Guy. Do not store this pointer,
342  ** and do not modify what it points to. Copy the strings you need
343  ** out of the static buffer. (Assignment of a char* to a Microsoft
344  ** CString will work very nicely, for example.)
345  **
346  ** ipaddr is a string containing 4 integers separated by periods.
347  */
348  virtual int get_ipaddr(char** ipaddr) = 0;
349 
350  /*l
351  *b Description:
352  **
353  ** Sets whether DI-Guy networking will display remote characters.
354  **
355  ** The function will fail if DI-Guy is on-line (is participating in
356  ** an exercise).
357  **
358  *b Arguments:
359  **
360  *a display - pass 1 if DI-Guy networking should display remote
361  *a characters, 0 if not
362  **
363  *b Returns:
364  **
365  ** 0 on success, -1 on failure
366  */
367  virtual int set_display_remote_chars(int display) = 0;
368 
369  /*l
370  *b Description:
371  **
372  ** Returns whether DI-Guy networking will display remote characters
373  ** when online.
374  **
375  *b Returns:
376  **
377  ** 1 if enabled, 0 if not
378  */
379  virtual int get_display_remote_chars() = 0;
380 
381  /*l
382  *b Description:
383  **
384  ** This function sets whether DI-Guy is sending custom pdus.
385  **
386  *b Arguments:
387  **
388  ** 0 if custom pdus should not be sent,
389  ** 1 if custom pdus should be sent
390  */
391  virtual void set_send_custom_pdus(int) = 0;
392 
393  /*l
394  *b Description:
395  **
396  ** This function returns whether DI-Guy is sending custom pdus.
397  **
398  *b Returns:
399  **
400  ** 0 if custom pdus are not being sent,
401  ** 1 if custom pdus are being sent
402  */
403  virtual int get_send_custom_pdus() = 0;
404 
405  /*l
406  *b Description:
407  **
408  ** This function returns whether DI-Guy sends custom pdus that concatenate
409  ** hand item with the body appearance name. DI-Guy 13.0 and up separate these.
410  */
411  virtual int get_send_diguy_125_appearance_packets() = 0;
412  /*l
413  *b Description:
414  **
415  ** This function set whether whether DI-Guy sends custom pdus that concatenate
416  ** hand item with the body appearance name. DI-Guy 13.0 and up separate these.
417  */
418  virtual void set_send_diguy_125_appearance_packets(int) = 0;
419 
420 
421  /*l
422  *b Description:
423  **
424  ** Turns the 'never create character' bit on.
425  */
426  virtual void enter_vpnet_mode() = 0;
427 
428  /*l
429  *b Description:
430  **
431  ** returns the diguyCharacter associated with the entity id specified.
432  **
433  *b Arguments:
434  **
435  *a id - Under HLA, two formats are permitted: the H L A object name,
436  *a or the DIS entity identifier ("site:application:entity", where
437  *a each is an integer)
438  **
439  ** Under DIS, only the DIS Entity Identifier is permitted.
440  */
441  virtual diguyCharacter* get_character_from_id(char const* id) = 0;
442 
443  /*l
444  *b Description:
445  **
446  ** Returns the name corresponding to the entity. The caller must
447  ** delete the returned string.
448  **
449  *b Arguments:
450  **
451  *a reflected_entity - entity to be named
452  **
453  *b Returns:
454  **
455  ** name of reflected entity
456  */
457  virtual char* get_name_from_entity(void* reflected_entity) = 0;
458 
459  /*l
460  *b Description:
461  **
462  ** Sets whether DI-Guy networking will publish local characters to the
463  ** network.
464  **
465  ** This function WILL succeed even if DI-Guy is on-line (is
466  ** participating in an exercise).
467  **
468  *b Arguments:
469  **
470  *a publish - pass 1 if DI-Guy networking should publish local characters
471  *a to the network, 0 if not
472  **
473  *b Returns:
474  **
475  ** 0 on success, -1 on failure
476  */
477  virtual int set_publish_local_chars(int publish) = 0;
478 
479  /*l
480  *b Description:
481  **
482  ** Returns whether DI-Guy networking will publish local characters
483  ** when online.
484  **
485  *b Returns:
486  **
487  ** 1 if enabled, 0 if not
488  */
489  virtual int get_publish_local_chars() = 0;
490 
491  /*l
492  *b Description:
493  **
494  ** This function sets the position offset which is currently added to
495  ** each character when it is published, and subtracted from each
496  ** character when it is reflected. This is useful to compensate for
497  ** inter-application location error.
498  **
499  *b Arguments:
500  **
501  *a z - z offset in meters
502  *a yaw - orientation offset in degrees
503  *a roll - orientation offset in degrees
504  *a pitch - orientation offset in degrees
505  **
506  *b Returns:
507  **
508  ** 0 on success, -1 on failure
509  */
510  virtual int set_position_offset(float z, float yaw, float roll, float pitch) = 0;
511 
512  /*l
513  *b Description:
514  **
515  ** This function gets the position offset which is currently added to
516  ** each character when it is published, and subtracted from each
517  ** character when it is reflected. The offset is useful to
518  ** compensate for inter-application database location and orientation
519  ** error.
520  **
521  *b Arguments:
522  **
523  *a z - z offset in meters
524  *a yaw - orientation offset in degrees
525  *a roll - orientation offset in degrees
526  *a pitch - orientation offset in degrees
527  **
528  *b Returns:
529  **
530  ** 0 on success, -1 on failure
531  */
532  virtual int get_position_offset(float* z,
533  float* yaw,
534  float* roll,
535  float* pitch) = 0;
536 
537  /*l
538  *b Description:
539  **
540  ** This function allows iteration through the list of names remote
541  ** VR-Link hosts that DI-Guy knows about.
542  **
543  *b Arguments:
544  **
545  *a buf - destination buffer for host name (64 bytes is plenty)
546  *a handle - return value from last call to the function; pass NULL
547  *a to get the first host name; pass previous return value
548  *a to get the next host name
549  **
550  *b Returns:
551  **
552  ** void* to be passed as handle argument on the next call; NULL when
553  ** end of list is reached
554  */
555  virtual void* get_next_participant_name(char* buf, void* handle) = 0;
556 
557  /*l
558  *b Description:
559  **
560  ** Fetches what character type and what appearance should be used for
561  ** a given DIS entity type septet.
562  **
563  *b Arguments:
564  **
565  *a chartype - address of char*, for returning a string which
566  *a names the DI-Guy character type
567  *a appearance - address of char*, for returning a string which
568  *a names the DI-Guy character appearance
569  *a septet - array of seven integers specifying the kind,
570  *a domain, country, category, subCategory, specific,
571  *a and extra of the entity in question
572  **
573  *b Returns:
574  **
575  ** 0 on success, -1 on failure
576  */
577  virtual int get_model_from_septet(const char** chartype,
578  const char** appearance,
579  const char** hand_item,
580  const int septet[7]) = 0;
581 
582  /*l
583  *b Description:
584  **
585  ** Fetches what DIS entity type septet should be used for a given
586  ** character type and appearance.
587  **
588  *b Arguments:
589  **
590  *a chartype - a string which names the DI-Guy character type
591  *a appearance - a string which names the DI-Guy character appearance
592  *a septet - array of seven integers, returned, indicating the kind,
593  *a domain, country, category, subCategory, specific, and
594  *a extra of the entity in question
595  **
596  *b Returns:
597  **
598  ** 0 on success, -1 on failure
599  */
600  virtual int get_septet_from_model(int septet[7],
601  const char* chartype,
602  const char* appearance,
603  const char* hand_item) = 0;
604 
605  /*l
606  *b Description:
607  **
608  ** This functions sets the amount of time that can elapse since the
609  ** last update before an entity is timed out. The default is 12
610  ** seconds.
611  **
612  *b Arguments:
613  **
614  *a interval - number of seconds until timeout
615  */
616  virtual void set_timeout_interval(float interval) = 0;
617 
618  /*l
619  *b Returns:
620  **
621  ** timeout value in seconds; see set_timeout_interval()
622  */
623  virtual float get_timeout_interval() = 0;
624 
625  /*l
626  *b Description:
627  **
628  ** This function sets the number of hops a packet can take before
629  ** being killed. Setting this value to -1 means that the system
630  ** default will be used.
631  **
632  ** This value must be set before the connection goes online.
633  **
634  *b Arguments:
635  **
636  *a time_to_live - number of hops until packed is killed
637  */
638  virtual void set_time_to_live(int time_to_live) = 0;
639 
640  /*l
641  *b Returns:
642  **
643  ** number of hops until packed is killed; see set_time_to_live()
644  */
645  virtual int get_time_to_live() = 0;
646 
647 
648 /*****************************************************************************/
652 /****************************************************************************/
653 
654  /*l
655  *b Description:
656  **
657  ** Sets the latitude and longitude to be used by DI-Guy networking.
658  ** The latitude and longitude are taken as the location, on Earth, of
659  ** the origin of the database.
660  **
661  ** The function will fail if DI-Guy is on-line (is participating in
662  ** an exercise).
663  **
664  *b Arguments:
665  **
666  *a lat - the latitude in radians, positive north
667  *a lon - the longitude in radians, positive east
668  **
669  *b Returns:
670  **
671  ** 0 on success, -1 on failure
672  */
673  virtual int set_lat_lon(double lat, double lon) = 0;
674 
675  /*l
676  *b Description:
677  **
678  ** Gets the latitude and longitude currently being used by DI-Guy
679  ** networking for the placement of the database origin.
680  **
681  *b Arguments:
682  **
683  *a lat - latitude of origin, returned; see below
684  *a lon - longitude of origin, returned; see below
685  **
686  *b Returns:
687  **
688  ** 0 on success, -1 on failure
689  **
690  ** lat and lon are char**'s, into which char*'s will be placed.
691  ** These char*'s point to static data owned by DI-Guy. Do not
692  ** store these pointers, and do not modify what they point to. Copy
693  ** the strings needed out of the static buffers. (Assignment of a
694  ** char* to a Microsoft CString will work very nicely, for example.)
695  **
696  ** lat and lon are expressed as strings of the form:
697  **
698  *- - [-]d [N|W|S|E] or
699  *- - [-]d m [N|W|S|E] or
700  *- - [-]d m s [N|W|S|E]
701  **
702  ** N and E are taken as positive. S and W will negate the value
703  ** otherwise computed. d, m, and s are positive, floating point
704  ** values, taken as degrees, minutes, and seconds, respectively.
705  ** A leading minus sign will negate the entire value otherwise
706  ** computed (so, e.g., a '-' and a 'S' will result in a double-
707  ** negation).
708  */
709  virtual int get_lat_lon(double* lat, double* lon) = 0;
710 
711  /*l
712  *b Description:
713  **
714  ** returns a string of the form
715  **
716  *- - d [N|W|S|E] or
717  *- - d m s [N|W|S|E]
718  **
719  ** N and E are used for positive angles. S and W are used for
720  ** negative angles. In the d m s format, d and m are integers
721  ** (degrees and minutes) and s (seconds) is a floating point value.
722  ** In the d format, d (degrees) is a floating point value.
723  **
724  *b Arguments:
725  **
726  *a outbuf - a buffer into which to copy the resulting string
727  *a value - the lat or lon value to be converted into a string
728  *a is_lat - boolean indicating latitude (North/South) rather than
729  *a longitude(East/West)
730  *a is_decimal - boolean indicating that decimal degrees are
731  *a desired, rather than degrees, minutes, and seconds
732  *a value_is_degrees - boolean indicating whether the input value is
733  *a in degrees (as opposed to radians)
734  */
735  virtual void format_lat_or_lon(char* outbuf,
736  double value,
737  bool is_lat,
738  bool is_decimal,
739  bool value_is_degrees) = 0;
740 
741  /*l
742  *b Description:
743  **
744  ** Sets the UTM zone of the location currently being used by DI-Guy
745  ** networking for the placement of the database origin. The easting
746  ** and northing are assumed not to change.
747  **
748  *b Arguments:
749  **
750  *a zone - the utm zone
751  *a southzone - pass 1 if the origin is in the southern hemisphere
752  **
753  *b Returns:
754  **
755  ** 0 on success, -1 on failure
756  */
757  virtual int set_utm_zone(int zone, int southzone) = 0;
758 
759  /*l
760  *b Description:
761  **
762  ** Sets, in UTM coordinates, the location currently being used by
763  ** DI-Guy networking for the placement of the database origin.
764  **
765  *b Arguments:
766  **
767  *a zone - the utm zone
768  *a southzone - pass 1 if the origin is in the southern hemisphere
769  *a easting - the normalized (positive only) easting of the database
770  *a origin within the zone
771  *a northing - the normalized (positive only) northing of the
772  *a database origin within the zone
773  **
774  *b Returns:
775  **
776  ** 0 on success, -1 on failure
777  */
778  virtual int set_utm(int zone,
779  int southzone,
780  double easting,
781  double northing) = 0;
782 
783  /*l
784  *b Description:
785  **
786  ** Gets, in UTM coordinates, the location currently being used by
787  ** DI-Guy networking for the placement of the database origin.
788  **
789  *b Arguments:
790  **
791  *a zone - the utm zone, returned
792  *a southzone - 1 if the origin is in the southern hemisphere,
793  *a returned
794  *a easting - the normalized (positive only) easting of the database
795  *a origin within the zone, returned
796  *a northing - the normalized (positive only) northing of the
797  *a database origin within the zone, returned
798  **
799  *b Returns:
800  **
801  ** 0 on success, -1 on failure
802  */
803  virtual int get_utm(int* zone,
804  int* southzone,
805  double* easting,
806  double* northing) = 0;
807 
808  /*l
809  *b Description:
810  **
811  ** This function sets whether user-defined latitude/longitude
812  ** coordinates should be used for the origin of the database, or the
813  ** coordinates that come from graphics files for scenario scene
814  ** objects.
815  **
816  *b Arguments:
817  **
818  *a use_user_defined - pass 1 if user-defined coordinates should be
819  *a used, 0 if coordinates from graphics file
820  *a should be used
821  **
822  *b Returns:
823  **
824  ** 0 on success, -1 on failure
825  */
826  virtual int set_use_user_defined_coords(int use_user_defined) = 0;
827 
828  /*l
829  *b Returns:
830  **
831  ** 0 if graphics file coordinates are used,
832  ** 1 if user-defined coordinates are used
833  */
834  virtual int get_use_user_defined_coords() = 0;
835 
836  /*l
837  *b Description:
838  **
839  ** Converts a 3d database-origin-relative location into a string
840  ** describing it in earth coordinates. This string could be in a
841  ** number of different formats including decimal lat/lon, dms
842  ** lat/lon, and UTM.
843  **
844  *b Arguments:
845  **
846  *a outbuf - buffer into which to put the output string
847  *a x, y, z - 3 floats specifying location
848  **
849  *b Returns:
850  **
851  ** 0 on success, -1 on failure. Fails if DI-Guy Scenario is not currently
852  ** on the network, meaning that a database-to-earth coordinate conversion
853  ** cannot be performed.
854  */
855  virtual int get_earth_coord(char* outbuf,
856  const float x,
857  const float y,
858  const float z) = 0;
859 
860  /*l
861  *b Description:
862  **
863  ** Changes the format of the output of get_earth_coord. Toggles
864  ** between UTM, dms lat/lon, decimal lat/lon, and "punting", meaning
865  ** that the caller of get_earth_coord() should fend for itself. This
866  ** generally means that the caller will use database-origin-relative
867  ** coordinates.
868  */
869  virtual void toggle_earth_coord_format() = 0;
870 
871  /*l
872  *b Description:
873  **
874  ** Sets whether networking should use database coordinates or not.
875  ** If database coordinates are used, the database origin is placed at
876  ** the center of the earth. This makes coordinate conversion to and
877  ** from UTM unnecessary. Using database coordinates renders
878  ** ineffective any UTM-related settings which would position the
879  ** database.
880  **
881  *b Arguments:
882  **
883  *a use_database_coords - 1 if database coordinates should be used,
884  *a 0 otherwise
885  **
886  *b Returns:
887  **
888  ** 0 if successful, -1 on failure.
889  */
890  virtual int set_use_database_coords(int use_dbc) = 0;
891 
892  /*l
893  *b Description:
894  **
895  ** This function returns the number of potential coordinate converters
896  ** that the networking module supports.
897  **
898  *b Returns:
899  **
900  ** number of converters
901  */
902  virtual int get_num_coordinate_systems();
903 
904  /*l
905  *b Description:
906  **
907  ** This function returns the name of the coordinate system at the
908  ** specified index. This is a string representation of a
909  ** diguyCoordinateSystemType enumeration.
910  **
911  *b Returns:
912  **
913  ** name of converter
914  */
915  virtual const char* get_coordinate_system_name(int index);
916 
917  /*l
918  *b Description:
919  **
920  ** Sets the coordinate system based on the name given. Currently
921  ** supports: "No Conversion", "UTM", "Flat Earth", "Geocentric".
922  **
923  *b Returns:
924  **
925  ** 0 on success, -1 on failure.
926  */
927  virtual int set_coordinate_system_type(const char* name);
928 
929  /*l
930  *b Description:
931  **
932  ** returns the coordinate system name. Current possible values are
933  ** "No Conversion", "UTM", "Flat Earth", "Geocentric".
934  **
935  *b Returns:
936  **
937  ** name of coordinate system type
938  */
939  virtual const char* get_coordinate_system_type_name();
940 
941  /*l
942  *b Description:
943  **
944  ** Sets the coordinate system based on the system type.
945  **
946  *b Returns:
947  **
948  ** 0 on success, -1 on failure.
949  */
950  virtual int set_coordinate_system_type(diguyCoordinateSystemType system_type);
951 
952  /*l
953  **
954  *b Description:
955  **
956  ** Gets the current coordinate system in use.
957  **
958  *b Returns:
959  **
960  ** diguyCoordinateSystemType enumeration
961  */
962  virtual diguyCoordinateSystemType get_coordinate_system_type();
963 
964  /*l
965  *b Description:
966  **
967  ** Documentation Pending
968  */
969  virtual void set_use_UTM_standard_offsets(int standard_offsets);
970 
971  /*l
972  *b Description:
973  **
974  ** Documentation Pending
975  */
976  virtual int get_use_UTM_standard_offsets();
977 
978  /*l
979  *b Description:
980  **
981  ** Parses a string of the form
982  **
983  *- - [-]d [N|W|S|E] or
984  *- - [-]d m [N|W|S|E] or
985  *- - [-]d m s [N|W|S|E]
986  **
987  ** N and E are taken as positive. S and W will negate the value
988  ** otherwise computed. d m and s are positive, floating point
989  ** values, taken as degrees, minutes, and seconds, respectively. A
990  ** leading minus sign will negate the entire value otherwise computed
991  ** (so, e.g., a '-' and a 'S' will result in a double-negation).
992  **
993  *b Arguments:
994  **
995  *a dms_string - a string of the format described above
996  **
997  *b Returns:
998  **
999  ** a double precision floating point value in radians.
1000  */
1001  virtual double parse_dms_to_radians(const char* dms_string) = 0;
1002 
1003  /*l
1004  *b Description:
1005  **
1006  ** Documentation Pending
1007  */
1008  virtual int convert_mgrs_to_local(const char* MGRS_str,
1009  float* x,
1010  float* y,
1011  float* z) = 0;
1012 
1013  /*l
1014  *b Description:
1015  **
1016  ** Documentation Pending
1017  */
1018  virtual const char* convert_local_to_mgrs(float x, float y, float z) = 0;
1019 
1020  /*l
1021  *b Description:
1022  **
1023  ** Documentation Pending
1024  */
1025  // returns straightforward latitude and longitude coordinates
1026  virtual float convert_local_to_lat(float x, float y, float z) = 0;
1027 
1028  /*l
1029  *b Description:
1030  **
1031  ** Documentation Pending
1032  */
1033  virtual float convert_local_to_long(float x, float y, float z) = 0;
1034 
1035  /*l
1036  *b Description:
1037  **
1038  ** Documentation Pending
1039  */
1040  // returns latitude and longitude in degrees, minutes, seconds
1041  virtual const char* convert_local_to_lat_long_string(float x, float y, float z) = 0;
1042 
1043  /*l
1044  *b Description:
1045  **
1046  ** Documentation Pending
1047  */
1048  virtual int convert_lat_long_to_local(float lat, float lon, float* x, float* y, float* z) = 0;
1049 
1050 
1051 /*****************************************************************************/
1056  /*l
1057  *b Description:
1058  **
1059  ** Sets whether land-based network entities will be ground clamped,
1060  ** changing their altitude to better correlate with the local
1061  ** terrain.
1062  **
1063  *b Arguments:
1064  **
1065  *a enabled - pass 1 to enable automatic ground clamping; 0 to disable
1066  **
1067  *b Returns:
1068  **
1069  ** 0 on success, -1 on failure
1070  */
1071  virtual int set_ground_clamp_reflected_land_entities_enabled(int enabled);
1072 
1073  /*l
1074  *b Returns:
1075  **
1076  ** 1 if land-based network entities will be ground clamped, 0 if not
1077  */
1078  virtual int get_ground_clamp_reflected_land_entities_enabled();
1079 
1080  /*l
1081  *b Description:
1082  **
1083  ** Similar to set_ground_clamp_reflected_land_entities_enabled(), but
1084  ** will clamp only entities from the specified host. If there is one
1085  ** host on the network that has particular trouble sending correlated
1086  ** altitudes this function can be used to clamp its entities without
1087  ** clamping all entities from all hosts.
1088  **
1089  ** This has been useful in some simulation exercises where
1090  ** participants from multiple vendors are in use. Entities from
1091  ** JCATS in particular have required this.
1092  **
1093  *b Arguments:
1094  **
1095  *a from_host - host whose land entities will be clamped
1096  **
1097  *b Returns:
1098  **
1099  ** 0 on success, -1 on failure
1100  */
1101  virtual int set_ground_clamp_reflected_land_entities_from_host(int from_host);
1102 
1103  /*l
1104  *b Returns:
1105  **
1106  ** host whose land entities will be clamped; see
1107  ** set_ground_clamp_reflected_land_entities_from_host()
1108  */
1109  virtual int get_ground_clamp_reflected_land_entities_from_host();
1110 
1111  /*l
1112  *b Description:
1113  **
1114  ** Sets the maximum upward change in altitude that ground clamping
1115  ** will have.
1116  **
1117  *b Arguments:
1118  **
1119  *a max_climb - maximum upward change in altitude, in meters
1120  **
1121  *b Returns:
1122  **
1123  ** 0 on success, -1 on failure
1124  */
1125  virtual int set_ground_clamp_max_climb(float max_climb);
1126 
1127  /*l
1128  *b Returns:
1129  **
1130  ** maximum upward change in altitude from ground clamping, in meters
1131  */
1132  virtual float get_ground_clamp_max_climb();
1133 
1134  /*l
1135  *b Description:
1136  **
1137  ** Similar to set_ground_clamp_max_climb(), but for downward change.
1138  */
1139  virtual int set_ground_clamp_max_drop(float max_drop);
1140 
1141  /*l
1142  *b Returns:
1143  **
1144  ** maximum downward change in altitude from ground clamping, in
1145  ** meters
1146  */
1147  virtual float get_ground_clamp_max_drop();
1148 
1149 
1150 /****************************************************************************/
1155  /*l
1156  *b Description:
1157  **
1158  ** Sets whether network datetime data will be broadcast, received, or
1159  ** ignored. See documentation for diguyDatetimeNetworkMode for more
1160  ** information.
1161  **
1162  *b Arguments:
1163  **
1164  *a network_datetime_mode - how to handle network datetime data
1165  */
1166  virtual void set_network_datetime_mode(diguyDatetimeNetworkMode network_datetime_mode);
1167 
1168  /*l
1169  *b Returns:
1170  **
1171  ** how handle network datetime data will be handled; see
1172  ** set_network_datetime_mode().
1173  */
1174  virtual diguyDatetimeNetworkMode get_network_datetime_mode();
1175 
1176  /*l
1177  *b Description:
1178  **
1179  ** Sets how often datetime data will be broadcast if this host is
1180  ** in mode DIGUY_DATETIME_NETWORK_MODE_BROADCAST.
1181  **
1182  ** Default is broadcast every 5 seconds.
1183  **
1184  *b Arguments:
1185  **
1186  *a broadcast_interval - how often to broadcast datetime data, in
1187  *a seconds
1188  */
1189  virtual void set_network_datetime_broadcast_interval(float broadcast_interval);
1190 
1191  /*l
1192  *b Returns:
1193  **
1194  ** how often datetime data will broadcast, in seconds
1195  */
1196  virtual float get_network_datetime_broadcast_interval();
1197 
1198 
1199 /****************************************************************************/
1206 /****************************************************************************/
1207 
1208  /*l
1209  *b Description:
1210  **
1211  ** Sets whether sync mode will be enabled when online.
1212  **
1213  ** The function will fail if DI-Guy is already online, participating
1214  ** in an exercise.
1215  **
1216  *b Arguments:
1217  **
1218  *a enabled - pass 1 if sync mode should be enabled when online,
1219  *a 0 if not
1220  **
1221  *b Returns:
1222  **
1223  ** 0 on success, -1 on failure
1224  */
1225  virtual int set_sync_mode_enabled(int enabled) = 0;
1226 
1227  /*l
1228  *b Description:
1229  **
1230  ** Gets whether sync mode is enabled when online.
1231  **
1232  *b Returns:
1233  **
1234  ** 1 if sync mode is enabled when online, 0 if not
1235  */
1236  virtual int get_sync_mode_enabled() = 0;
1237 
1238  /*l
1239  *b Description:
1240  **
1241  ** Sets whether this machine will serve as sync master when online
1242  ** and in sync mode.
1243  **
1244  *b Arguments:
1245  **
1246  *a master - pass 1 if this machine will serve as sync master when
1247  *a online and in sync mode, 0 if not
1248  **
1249  *b Returns:
1250  **
1251  ** 0 on success, -1 on failure
1252  */
1253  virtual int set_sync_mode_master(int master) = 0;
1254 
1255  /*l
1256  *b Description:
1257  **
1258  ** Gets whether this machine will serve as sync master when online
1259  ** and in sync mode.
1260  **
1261  *b Returns:
1262  **
1263  ** 1 if this machine will serve as sync master when online
1264  ** and in sync mode, 0 if not
1265  */
1266  virtual int get_sync_mode_master() = 0;
1267 
1268  /*l
1269  *b Description:
1270  **
1271  ** Sets whether this machine's camera will be slaved to a remote
1272  ** master when online and in sync mode and not sync master.
1273  **
1274  ** The function will fail if DI-Guy is already online, participating
1275  ** in an exercise.
1276  **
1277  *b Arguments:
1278  **
1279  ** sl_cam - pass 1 if this machine's camera will be slaved to a
1280  ** remote master when online and in sync mode and not sync
1281  ** master, 0 if not
1282  **
1283  *b Returns:
1284  **
1285  ** 0 on success, -1 on failure
1286  */
1287  virtual int set_sync_mode_slave_cam(int sl_cam) = 0;
1288 
1289  /*l
1290  *b Description:
1291  **
1292  ** Gets whether this machine's camera will be slaved to a remote
1293  ** master when online, in sync mode, and not sync master.
1294  **
1295  *b Returns:
1296  **
1297  ** 1 if this machine's camera will be slaved, 0 if not
1298  */
1299  virtual int get_sync_mode_slave_cam() = 0;
1300 
1301  /*l
1302  *b Description:
1303  **
1304  ** This function sets the camera orientation offset to be used in
1305  ** sync_mode (when VR-Link is online).
1306  **
1307  *b Arguments:
1308  **
1309  *a offset_r - orientation offset
1310  *a offset_y - orientation offset
1311  *a offset_p - orientation offset
1312  **
1313  ** yaw and pitch represent PERCENTAGES of the camera's
1314  ** horizontal and vertical field of view, respectively. The
1315  ** ROLL (which is in degrees) is applied first, then the yaw,
1316  ** then the pitch.
1317  **
1318  ** A typical two screen arrangement would use yaws of 50 and -50 for the
1319  ** left screen, and right screen, respectively. For three screens, the
1320  ** yaws would be -100, 0, and 100.
1321  **
1322  ** Using percentages this way makes the screens contiguous even if the
1323  ** camera's field of view changes.
1324  **
1325  ** THIS FUNCTION DOES NOTHING (and returns -1) if called while VR-Link is
1326  ** online
1327  **
1328  *b Returns:
1329  **
1330  ** 0 on success, -1 on failure (VR-Link is online).
1331  */
1332  virtual int set_sync_mode_camera_offset(float offset_r, float offset_y, float offset_p) = 0;
1333 
1334  /*l
1335  *b Description:
1336  **
1337  ** This function gets the camera orientation offset to be used in
1338  ** sync_mode (when VR-Link is online).
1339  **
1340  *b Arguments:
1341  **
1342  *a offset_r - orientation offset
1343  *a offset_y - orientation offset
1344  *a offset_p - orientation offset
1345  **
1346  ** yaw and pitch represent PERCENTAGES of the camera's
1347  ** horizontal and vertical field of view, respectively. The
1348  ** ROLL (which is in degrees) is applied first, then the yaw,
1349  ** then the pitch.
1350  **
1351  ** In the orientation offset the yaw and pitch
1352  ** represent PERCENTAGES of the camera's horizontal and vertical field
1353  ** of view, respectively. The ROLL (which is in degrees) is applied
1354  ** first, then the yaw, then the pitch.
1355  **
1356  ** A typical two screen arrangement would use yaws of 50 and -50 for the
1357  ** left screen, and right screen, respectively. For three screens, the
1358  ** yaws would be 100, 0, and -100 going from left to right.
1359  **
1360  ** Using percentages this way makes the screens contiguous even if the
1361  ** camera's field of view changes.
1362  **
1363  *b Returns:
1364  **
1365  ** 0 on success, -1 on failure
1366  */
1367  virtual int get_sync_mode_camera_offset(float* offset_r,
1368  float* offset_y,
1369  float* offset_p) = 0;
1370 
1371  /*l
1372  *b Description:
1373  **
1374  ** This function sets whether the camera will be slaved when VR-Link is
1375  ** online, in sync mode, and not sync master.
1376  **
1377  ** It can be set even when VR-Link is online.
1378  **
1379  *b Arguments:
1380  **
1381  *a slaved - whether the camera will be slaved when VR-Link is
1382  ** online, in sync mode, and not sync master.
1383  **
1384  *b Returns:
1385  **
1386  ** 0 on success, -1 on failure
1387  */
1388  virtual int set_sync_mode_camera_slaved(int slaved) = 0;
1389 
1390  /*l
1391  *b Description:
1392  **
1393  ** This function gets whether the camera is currently slaved. It does
1394  ** NOT simply return what was passed to set_sync_mode_camera_slaved().
1395  **
1396  *b Returns:
1397  **
1398  ** Whether the camera is currently slaved. This will be 1 only if
1399  ** VR-link is online, is in sync mode, and is not the sync master, and if
1400  ** sync_mode_camera_slaved has been set to 1.
1401  */
1402  virtual int get_sync_mode_camera_slaved() = 0;
1403 
1404  /*l
1405  *b Description:
1406  **
1407  ** Lets VR-Link know that the user has moved the camera, so that if
1408  ** it is in sync mode, and is the sync master, it can let other hosts
1409  ** know the new camera position so they can move their cameras.
1410  **
1411  *b Returns:
1412  **
1413  ** 0 on success, -1 on failure
1414  */
1415  virtual int set_camera_details_out_of_date() = 0;
1416 
1417 
1418  /*l
1419  *b Description:
1420  **
1421  ** Lets DI-Guy know that it should use an adaptive guide that attempts
1422  ** to fix reckoning errors by stepping. Defaults to on.
1423  **
1424  *b Returns:
1425  **
1426  ** 0 on success, -1 on failure
1427  */
1428  virtual int set_use_adaptive_guide(int use_adaptive_guide) = 0;
1429 
1430  /*l
1431  *b Returns:
1432  **
1433  ** 0 if adaptive guide is disabled 1 otherwise.
1434  */
1435  virtual int get_use_adaptive_guide() = 0;
1436 
1437 
1438 /****************************************************************************/
1439 /****************************************************************************/
1440 /*****************************************************************************/
1447 /****************************************************************************/
1448 /****************************************************************************/
1449 /****************************************************************************/
1450 
1451  virtual int set_federation_name(const char* federation_name);
1452  virtual const char* get_federation_name();
1453 
1454  virtual int set_fom_file_name(const char* file_name);
1455  virtual const char* get_fom_file_name();
1456 
1457  virtual int set_base_module_name(const char* file_name);
1458  virtual const char* get_base_module_name();
1459 
1460  virtual int set_culling_enabled(int culling);
1461  virtual int get_culling_enabled();
1462 
1463  /*l
1464  *b Description:
1465  **
1466  ** Sets whether network datetime data will be broadcast via custom
1467  ** PDUs.
1468  **
1469  ** *NOTE:* This is functionality that is under development and
1470  ** should currently not be used by non DI-Guy programmers.
1471  **
1472  *b Arguments:
1473  **
1474  *a enable_diguy_custom_pdus - pass 1 to broadcast network datetime
1475  *a data via custom PDUs, 0 to not
1476  */
1477  virtual void set_network_datetime_enable_diguy_custom_pdus(int enable_diguy_custom_pdus);
1478 
1479  /*l
1480  *b Returns:
1481  **
1482  ** 1 if network datetime data will be broadcast via custom PDUs, 0 if
1483  ** not
1484  */
1485  virtual int get_network_datetime_enable_diguy_custom_pdus();
1486 
1487  /*l
1488  *b Description:
1489  **
1490  ** Sets whether this host will send DIS standard start/resume PDUs.
1491  **
1492  ** *NOTE:* This is functionality that is under development and
1493  ** should currently not be used by non DI-Guy programmers.
1494  **
1495  *b Arguments:
1496  **
1497  *a enable_dis_start_resume_pdus - pass 1 to send DIS start/resume
1498  *a PDUs, 0 to not
1499  */
1500  virtual void set_network_datetime_enable_dis_start_resume_pdus(int enable_dis_start_resume_pdus);
1501 
1502  /*l
1503  *b Returns:
1504  **
1505  ** 1 if DIS start/resume should be send, 0 if not
1506  */
1507  virtual int get_network_datetime_enable_dis_start_resume_pdus();
1508 
1514  /*l
1515  ** internal functions
1516  */
1517  virtual int server_mode() = 0;
1518  virtual int client_mode() = 0;
1519  virtual void establish_new_offsets() = 0;
1520  virtual void draw() = 0;
1521  virtual bdiDataTracker* get_network_datetime_data_tracker() = 0;
1522 
1523 public:
1524 
1525  diguyNetInterfaceData* d;
1526 
1527 protected:
1528 
1529  virtual int update_coordinate_sytem() = 0;
1530 
1531  /*l
1532  ** A private constructor. Use the DI-Guy function
1533  ** diguy_module_net_initialize() to create a diguyNetInterface. Use
1534  ** get_net_interface() to obtain a pointer to it.
1535  */
1537 
1538  /*l
1539  ** A private destructor. Use the DI-Guy function
1540  ** diguy_module_net_deinitialize() to destroy the diguyNetInterface.
1541  */
1542  virtual ~diguyNetInterface();
1543 
1544  friend BDI_DECLSPEC_diguy int diguy_module_net_initialize();
1545 };
1546 
1547 
1548 #endif /* __diguy_module_net_H */
1549 
1550 /*********************************************************************
1551  ** Copyright (c) 1992-2014 VT MAK
1552  ** All rights reserved.
1553  *********************************************************************/
1554