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