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