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