configuration.h
Go to the documentation of this file.
1 /**************************************************************************/ /**
2  * @brief Device configuration settings control messages.
3  * @file
4  ******************************************************************************/
5 
6 #pragma once
7 
11 
12 namespace point_one {
13 namespace fusion_engine {
14 namespace messages {
15 
16 // Enforce 4-byte alignment and packing of all data structures and values.
17 // Floating point values are aligned on platforms that require it. This is done
18 // with a combination of setting struct attributes, and manual alignment
19 // within the definitions. See the "Message Packing" section of the README.
20 #pragma pack(push, 1)
21 
22 /**************************************************************************/ /**
23  * @defgroup config_types Device Configuration Settings Control
24  * @brief Messages/types for configuring device parameters (lever arms,
25  * orientation, wheel speed settings, etc.).
26  * @ingroup config_and_ctrl_messages
27  *
28  * See also @ref import_export.
29  ******************************************************************************/
30 
31 /**
32  * @brief An identifier for the contents of a parameter configuration message.
33  * @ingroup config_types
34  *
35  * See also @ref SetConfigMessage.
36  */
37 enum class ConfigType : uint16_t {
38  INVALID = 0,
39 
40  /**
41  * The location of the device IMU with respect to the vehicle body frame,
42  * resolved in the vehicle body frame (in meters).
43  *
44  * Payload format: @ref Point3f
45  */
46  DEVICE_LEVER_ARM = 16,
47 
48  /**
49  * The orientation of the device IMU with respect to the vehicle body axes.
50  *
51  * Payload format: @ref CoarseOrientation
52  */
54 
55  /**
56  * The location of the primary GNSS antenna with respect to the vehicle body
57  * frame, resolved in the vehicle body frame (in meters).
58  *
59  * Payload format: @ref Point3f
60  */
61  GNSS_LEVER_ARM = 18,
62 
63  /**
64  * The offset of the desired output location with respect to the vehicle
65  * body frame, resolved in the vehicle body frame (in meters).
66  *
67  * Payload format: @ref Point3f
68  */
69  OUTPUT_LEVER_ARM = 19,
70 
71  /**
72  * Information about the vehicle including model and dimensions.
73  *
74  * Payload format: @ref VehicleDetails
75  */
76  VEHICLE_DETAILS = 20,
77 
78  /**
79  * Information pertaining to wheel speed/rotation measurements when wheel data
80  * is transmitted via software.
81  *
82  * @note
83  * For hardware wheel tick voltage capture, use @ref
84  * ConfigType::HARDWARE_TICK_CONFIG instead.
85  *
86  * Payload format: @ref WheelConfig
87  */
88  WHEEL_CONFIG = 21,
89 
90  /**
91  * Indicates the mode and direction used when capturing vehicle wheel tick
92  * data from a voltage pulse on an I/O pin.
93  *
94  * @note
95  * For software wheel tick capture (wheel ticks sent as FusionEngine messages
96  * or on a CAN bus), use @ref ConfigType::WHEEL_CONFIG instead.
97  *
98  * Payload format: @ref HardwareTickConfig
99  */
101 
102  /**
103  * Used to set horizontal (yaw) & vertical (pitch) biases (in degrees) on
104  * a dual-antenna heading platform configuration (deprecated).
105  *
106  * @deprecated
107  * Use @ref ConfigType::GNSS_AUX_LEVER_ARM instead.
108  */
110 
111  /**
112  * The location of the secondary GNSS antenna with respect to the vehicle body
113  * frame on a dual-antenna platform, resolved in the vehicle body frame (in
114  * meters).
115  *
116  * For dual-antenna systems, the secondary or auxiliary antenna is used to
117  * measure vehicle yaw and pitch.
118  *
119  * Payload format: @ref Point3f
120  */
121  GNSS_AUX_LEVER_ARM = 24,
122 
123  /**
124  * A bitmask indicating which GNSS constellations are enabled.
125  *
126  * Payload format: `uint32_t` (see @ref sat_type_masks)
127  */
129 
130  /**
131  * A bitmask indicating which GNSS frequency bands are enabled.
132  *
133  * Payload format: `uint32_t` (see @ref freq_band_masks)
134  */
136 
137  /**
138  * Specify a UTC leap second count override value to use for all UTC time
139  * conversions. Setting this value will disable all internal leap second
140  * sources, including data received from the GNSS almanac decoded from
141  * available signals.
142  *
143  * Set to -1 to disable leap second override and re-enable internal leap
144  * second handling.
145  *
146  * Payload format: `int32_t`
147  */
148  LEAP_SECOND = 52,
149 
150  /**
151  * Specify a GPS legacy week rollover count override to use when converting
152  * all legacy 10-bit GPS week numbers. Setting this value will disable all
153  * internal week rollover sources, including data received from modern GPS
154  * navigation messages (CNAV, CNAV2) or non-GPS constellations.
155  *
156  * Set to -1 to disable week rollover override and re-enable internal
157  * handling.
158  *
159  * Payload format: `int32_t`
160  */
161  GPS_WEEK_ROLLOVER = 53,
162 
163  /**
164  * Ionospheric delay model configuration.
165  *
166  * Payload format: @ref IonosphereConfig
167  */
168  IONOSPHERE_CONFIG = 54,
169 
170  /**
171  * Tropospheric delay model configuration.
172  *
173  * Payload format: @ref TroposphereConfig
174  */
175  TROPOSPHERE_CONFIG = 55,
176 
177  /**
178  * Change a configuration setting for a specified output interface.
179  *
180  * Payload format: `InterfaceConfigSubmessage`
181  */
182  INTERFACE_CONFIG = 200,
183 
184  /**
185  * Configure the UART1 serial baud rate (in bits/second).
186  *
187  * @deprecated
188  * The @ref ConfigType::INTERFACE_CONFIG type combined with @ref
189  * InterfaceConfigType::BAUD_RATE in the @ref InterfaceConfigSubmessage should
190  * be used to configure this value going forward.
191  *
192  * Payload format: `uint32_t`
193  */
194  UART1_BAUD = 256,
195 
196  /**
197  * Configure the UART2 serial baud rate (in bits/second).
198  *
199  * @deprecated
200  * The @ref ConfigType::INTERFACE_CONFIG type combined with @ref
201  * InterfaceConfigType::BAUD_RATE in the @ref InterfaceConfigSubmessage should
202  * be used to configure this value going forward.
203  *
204  * Payload format: `uint32_t`
205  */
206  UART2_BAUD = 257,
207 
208  /**
209  * Enable/disable output of diagnostic data on UART1.
210  *
211  * @deprecated
212  * The @ref ConfigType::INTERFACE_CONFIG type combined with @ref
213  * InterfaceConfigType::OUTPUT_DIAGNOSTICS_MESSAGES in the @ref
214  * InterfaceConfigSubmessage should be used to configure this value going
215  * forward.
216  *
217  * @note
218  * Enabling this setting will override the message rate/off settings for some
219  * FusionEngine messages.
220  *
221  * Payload format: `bool`
222  */
224 
225  /**
226  * Enable/disable output of diagnostic data on UART2.
227  *
228  * @deprecated
229  * The @ref ConfigType::INTERFACE_CONFIG type combined with @ref
230  * InterfaceConfigType::OUTPUT_DIAGNOSTICS_MESSAGES in the @ref
231  * InterfaceConfigSubmessage should be used to configure this value going
232  * forward.
233  *
234  * @note
235  * Enabling this setting will override the message rate/off settings for some
236  * FusionEngine messages.
237  *
238  * Payload format: `bool`
239  */
241 
242  /**
243  * Enable watchdog timer to restart device after fatal errors.
244  *
245  * Payload format: `bool`
246  */
247  ENABLE_WATCHDOG_TIMER = 300,
248 
249  /**
250  * A string for identifying a device.
251  *
252  * This is a string of ASCII characters padded to 32 bytes with `NULL`.
253  *
254  * Payload format: `char[32]`
255  */
256  USER_DEVICE_ID = 301,
257 
258  /**
259  * A bitmask indicating which profiling features are enabled.
260  *
261  * Payload format: `uint8_t` (`0` for disabled and `0xFF` for all features
262  * enabled. Individual bits are device specific.)
263  */
264  PROFILING_MASK = 310,
265 
266  /**
267  * Configuration of L-band Demodulator Parameters.
268  *
269  * @note
270  * This setting is only available on devices with an L-band receiver.
271  *
272  * Payload format: @ref LBandConfig
273  */
274  LBAND_PARAMETERS = 1024,
275 };
276 
277 /**
278  * @brief Get a human-friendly string name for the specified @ref ConfigType.
279  * @ingroup config_types
280  *
281  * @param type The desired configuration parameter type.
282  *
283  * @return The corresponding string name.
284  */
286  switch (type) {
287  case ConfigType::INVALID:
288  return "Invalid";
289 
291  return "Device Lever Arm";
292 
294  return "Device Coarse Orientation";
295 
297  return "GNSS Lever Arm";
298 
300  return "Output Lever Arm";
301 
303  return "Vehicle Details";
304 
306  return "Wheel Config";
307 
309  return "Hardware Tick Config";
310 
312  return "Heading Bias";
313 
315  return "GNSS Aux Lever Arm";
316 
318  return "Enabled GNSS Systems";
319 
321  return "Enabled GNSS Frequency Bands";
322 
324  return "Leap Second";
325 
327  return "GPS Week Rollover";
328 
330  return "Ionosphere Config";
331 
333  return "Troposphere Config";
334 
336  return "UART1 Baud Rate";
337 
339  return "UART2 Baud Rate";
340 
342  return "UART1 Diagnostic Messages Enabled";
343 
345  return "UART2 Diagnostic Messages Enabled";
346 
348  return "Watchdog Timer Enabled";
349 
351  return "User Device ID";
352 
354  return "Profiling Features Enabled";
355 
357  return "Interface Submessage";
358 
360  return "LBand Parameters";
361  }
362 
363  return "Unrecognized Configuration";
364 }
365 
366 /**
367  * @brief @ref ConfigType stream operator.
368  * @ingroup config_types
369  */
370 inline p1_ostream& operator<<(p1_ostream& stream, ConfigType type) {
371  stream << to_string(type) << " (" << (int)type << ")";
372  return stream;
373 }
374 
375 /**
376  * @brief The type of a device's configuration settings.
377  * @ingroup config_types
378  */
379 enum class ConfigurationSource : uint8_t {
380  ACTIVE = 0, ///< Active configuration currently in use by the device.
381  SAVED = 1, ///< Settings currently saved to persistent storage.
382  /**
383  * Read only device defaults. Attempting to write to this source will fail
384  * with a @ref Response::VALUE_ERROR.
385  */
386  DEFAULT = 2,
387 };
388 
389 /**
390  * @brief Get a human-friendly string name for the specified @ref
391  * ConfigurationSource.
392  * @ingroup config_types
393  *
394  * @param source The desired configuration source.
395  *
396  * @return The corresponding string name.
397  */
399  switch (source) {
401  return "Active";
402 
404  return "Saved";
405 
407  return "Default";
408 
409  default:
410  return "Unrecognized Source";
411  }
412 }
413 
414 /**
415  * @brief @ref ConfigurationSource stream operator.
416  * @ingroup config_types
417  */
419  stream << to_string(source) << " (" << (int)source << ")";
420  return stream;
421 }
422 
423 /**
424  * @brief The type configuration save operation to be performed.
425  * @ingroup config_types
426  */
427 enum class SaveAction : uint8_t {
428  /** Save all active parameters to persistent storage. */
429  SAVE = 0,
430  /** Revert the active configuration to previously saved values. */
431  REVERT_TO_SAVED = 1,
432  /** Reset the active _and_ saved configuration to default values. */
433  REVERT_TO_DEFAULT = 2,
434 };
435 
436 /**
437  * @brief Get a human-friendly string name for the specified @ref SaveAction.
438  * @ingroup config_types
439  *
440  * @param action The desired save operation.
441  *
442  * @return The corresponding string name.
443  */
445  switch (action) {
446  case SaveAction::SAVE:
447  return "Save";
448 
450  return "Revert To Saved";
451 
453  return "Revert To Default";
454 
455  default:
456  return "Unknown";
457  }
458 }
459 
460 /**
461  * @brief @ref SaveAction stream operator.
462  * @ingroup config_types
463  */
464 inline p1_ostream& operator<<(p1_ostream& stream, SaveAction action) {
465  stream << to_string(action) << " (" << (int)action << ")";
466  return stream;
467 }
468 
469 /**
470  * @brief Set a user configuration parameter (@ref MessageType::SET_CONFIG,
471  * version 1.0).
472  * @ingroup config_types
473  *
474  * This message must be followed by the parameter value to be used:
475  *
476  * ```
477  * {MessageHeader, SetConfigMessage, Parameter[data_length_bytes]}
478  * ```
479  *
480  * The format of the parameter value is defined by the the specified @ref
481  * config_type (@ref ConfigType). For example, an antenna lever arm definition
482  * may require three 32-bit `float` values, one for each axis, while a serial
483  * port baud rate may be specified as single 32-bit unsigned integer
484  * (`uint32_t`).
485  *
486  * Not all parameters defined in @ref ConfigType are supported on all devices.
487  *
488  * Parameter changes are applied to the device's active configuration
489  * immediately, but are not saved to persistent storage and will be restored to
490  * their previous values on reset. To save configuration settings to persistent
491  * storage, see @ref SaveConfigMessage.
492  *
493  * # Expected Response
494  * The device will respond with a @ref CommandResponseMessage indicating whether
495  * or not the request succeeded.
496  */
498  static constexpr MessageType MESSAGE_TYPE = MessageType::SET_CONFIG;
499  static constexpr uint8_t MESSAGE_VERSION = 0;
500 
501  /** Flag to immediately save the config after applying this setting. */
502  static constexpr uint8_t FLAG_APPLY_AND_SAVE = 0x01;
503  /**
504  * Flag to restore the config_type back to its default value.
505  *
506  * When set, the @ref config_length_bytes should be 0 and no data should be
507  * included unless the config_type is @ref ConfigType::INTERFACE_CONFIG. In
508  * that case the @ref config_length_bytes should be
509  * `sizeof(InterfaceConfigSubmessage)` with a an @ref
510  * InterfaceConfigSubmessage as the parameter value without any further
511  * payload.
512  */
513  static constexpr uint8_t FLAG_REVERT_TO_DEFAULT = 0x02;
514 
515  /** The type of parameter to be configured. */
517 
518  /** Bitmask of additional flags to modify the command. */
519  uint8_t flags = 0;
520 
521  uint8_t reserved[1] = {0};
522 
523  /** The size of the parameter value (in bytes). */
524  uint32_t config_length_bytes = 0;
525 };
526 
527 /**
528  * @brief Query the value of a user configuration parameter (@ref
529  * MessageType::GET_CONFIG, version 1.1).
530  * @ingroup config_types
531  *
532  * # Expected Response
533  * The device will respond with a @ref ConfigResponseMessage containing the
534  * requested parameter value or an error @ref Response value if the request did
535  * not succeed.
536  */
538  static constexpr MessageType MESSAGE_TYPE = MessageType::GET_CONFIG;
539  static constexpr uint8_t MESSAGE_VERSION = 1;
540 
541  /** The desired parameter. */
543 
544  /** The config source to request data from (active, saved, etc.). */
546 
547  uint8_t reserved[1] = {0};
548 
549  /**
550  * When @ref config_type is @ref ConfigType::INTERFACE_CONFIG, a @ref
551  * InterfaceConfigSubmessage must be added to the end of this message with
552  * empty @ref InterfaceConfigSubmessage::config_data.
553  */
554  //uint8_t optional_submessage_header[0];
555 };
556 
557 /**
558  * @brief Save or reload configuration settings (@ref MessageType::SAVE_CONFIG,
559  * version 1.0).
560  * @ingroup config_types
561  *
562  * # Expected Response
563  * The device will respond with a @ref CommandResponseMessage indicating whether
564  * or not the request succeeded.
565  */
567  static constexpr MessageType MESSAGE_TYPE = MessageType::SAVE_CONFIG;
568  static constexpr uint8_t MESSAGE_VERSION = 0;
569 
570  /** The action to performed. */
572 
573  uint8_t reserved[3] = {0};
574 };
575 
576 /**
577  * @brief Response to a @ref GetConfigMessage request (@ref
578  * MessageType::CONFIG_RESPONSE, version 1.0).
579  * @ingroup config_types
580  *
581  * This message is followed by `N` bytes, where `N` is equal to @ref
582  * config_length_bytes that make up the data associated with @ref config_type.
583  * For example if the @ref config_type is @ref ConfigType::UART1_BAUD, the
584  * payload will include a single 32-bit unsigned integer:
585  *
586  * ```
587  * {MessageHeader, ConfigResponseMessage, uint32_t}
588  * ```
589  *
590  * The @ref response field will indicate the status of the requested value. If
591  * the response is not @ref Response::OK, the parameter value may be omitted and
592  * @ref config_length_bytes will be set to 0.
593  *
594  * In response to a @ref GetConfigMessage with an invalid or unsupported @ref
595  * ConfigType, @ref config_type in the resulting @ref ConfigResponseMessage will
596  * be set to @ref ConfigType::INVALID, and @ref response will indicate the
597  * reason. Note that all @ref GetConfigMessage requests, including invalid and
598  * rejected requests, will receive a @ref ConfigResponseMessage, not a
599  * @ref CommandResponseMessage.
600  */
602  static constexpr MessageType MESSAGE_TYPE = MessageType::CONFIG_RESPONSE;
603  static constexpr uint8_t MESSAGE_VERSION = 0;
604 
605  /**
606  * Flag to indicate the active value for this configuration differs from the
607  * value saved to persistent memory.
608  */
609  static constexpr uint8_t FLAG_ACTIVE_DIFFERS_FROM_SAVED = 0x1;
610 
611  /** The source of the parameter value (active, saved, etc.). */
613 
614  /** Flags that describe the configuration parameter. */
615  uint8_t flags = 0;
616 
617  /** The type of configuration parameter contained in this message. */
619 
620  /** The response status (success, error, etc.). */
621  Response response = Response::OK;
622 
623  uint8_t reserved[3] = {0};
624 
625  /** The size of the parameter value (in bytes). */
626  uint32_t config_length_bytes = 0;
627 
628  /**
629  * A pointer to the beginning of the configuration parameter value.
630  *
631  * The size and format of the contents is specified by the @ref config_type.
632  * See @ref ConfigType.
633  */
634  //uint8_t config_change_data[0];
635 };
636 
637 /**
638  * @brief A 3-dimensional vector (used for lever arms, etc.).
639  * @ingroup config_types
640  */
641 struct P1_ALIGNAS(4) Point3f {
642  float x = NAN;
643  float y = NAN;
644  float z = NAN;
645 };
646 
647 /**
648  * @brief The orientation of a device with respect to the vehicle body axes.
649  * @ingroup config_types
650  *
651  * A device's orientation is defined by specifying how the +x and +z axes of its
652  * IMU are aligned with the vehicle body axes. For example, in a car:
653  * - `forward,up`: device +x = vehicle +x, device +z = vehicle +z (i.e.,
654  * IMU pointed towards the front of the vehicle).
655  * - `left,up`: device +x = vehicle +y, device +z = vehicle +z (i.e., IMU
656  * pointed towards the left side of the vehicle)
657  * - `up,backward`: device +x = vehicle +z, device +z = vehicle -x (i.e.,
658  * IMU pointed vertically upward, with the top of the IMU pointed towards the
659  * trunk)
660  */
662  enum class Direction : uint8_t {
663  FORWARD = 0, ///< Aligned with vehicle +x axis.
664  BACKWARD = 1, ///< Aligned with vehicle -x axis.
665  LEFT = 2, ///< Aligned with vehicle +y axis.
666  RIGHT = 3, ///< Aligned with vehicle -y axis.
667  UP = 4, ///< Aligned with vehicle +z axis.
668  DOWN = 5, ///< Aligned with vehicle -z axis.
669  INVALID = 255
670  };
671 
672  /** The direction of the device +x axis relative to the vehicle body axes. */
673  Direction x_direction = Direction::FORWARD;
674 
675  /** The direction of the device +z axis relative to the vehicle body axes. */
676  Direction z_direction = Direction::UP;
677 
678  uint8_t reserved[2] = {0};
679 };
680 
681 /**
682  * @brief The make and model of the vehicle.
683  * @ingroup config_types
684  */
685 enum class VehicleModel : uint16_t {
686  UNKNOWN_VEHICLE = 0,
687  DATASPEED_CD4 = 1,
688  // In general, all J1939 vehicles support a subset of the J1939 standard and
689  // may be set to vehicle model `J1939`. Their 29-bit CAN IDs may differ
690  // based on how the platform assigns message priorities and source
691  // addresses, but the underlying program group number (PGN) and message
692  // contents will be consistent.
693  //
694  // For most vehicles, it is not necessary to specify and particular make and
695  // model.
696  J1939 = 2,
697 
698  LEXUS_CT200H = 20,
699 
700  KIA_SORENTO = 40,
701  KIA_SPORTAGE = 41,
702 
703  AUDI_Q7 = 60,
704  AUDI_A8L = 61,
705 
706  TESLA_MODEL_X = 80,
707  TESLA_MODEL_3 = 81,
708 
709  HYUNDAI_ELANTRA = 100,
710 
711  PEUGEOT_206 = 120,
712 
713  MAN_TGX = 140,
714 
715  FACTION = 160,
716  FACTION_V2 = 161,
717 
718  LINCOLN_MKZ = 180,
719 
720  BMW_7 = 200,
721  BMW_MOTORRAD = 201,
722 
723  VW_4 = 220,
724 
725  RIVIAN = 240,
726 
728 };
729 
730 /**
731  * @brief Get a human-friendly string name for the specified @ref VehicleModel.
732  * @ingroup config_types
733  *
734  * @param vehicle_model The desired vehicle model.
735  *
736  * @return The corresponding string name.
737  */
738 P1_CONSTEXPR_FUNC const char* to_string(VehicleModel vehicle_model) {
739  switch (vehicle_model) {
741  return "UNKNOWN";
743  return "DATASPEED_CD4";
744  case VehicleModel::J1939:
745  return "J1939";
747  return "LEXUS_CT200H";
749  return "KIA_SORENTO";
751  return "KIA_SPORTAGE";
753  return "AUDI_Q7";
755  return "AUDI_A8L";
757  return "TESLA_MODEL_X";
759  return "TESLA_MODEL_3";
761  return "HYUNDAI_ELANTRA";
763  return "PEUGEOT_206";
765  return "MAN_TGX";
767  return "FACTION";
769  return "FACTION_V2";
771  return "LINCOLN_MKZ";
772  case VehicleModel::BMW_7:
773  return "BMW_7";
775  return "BMW_MOTORRAD";
776  case VehicleModel::VW_4:
777  return "VW_4";
779  return "RIVIAN";
781  return "FLEXRAY_DEVICE_AUDI_ETRON";
782  default:
783  return "UNRECOGNIZED";
784  }
785 }
786 
787 /**
788  * @brief @ref VehicleModel stream operator.
789  * @ingroup config_types
790  */
791 inline p1_ostream& operator<<(p1_ostream& stream, VehicleModel vehicle_model) {
792  stream << to_string(vehicle_model) << " (" << (int)vehicle_model << ")";
793  return stream;
794 }
795 
796 /**
797  * @brief Information about the vehicle including model and dimensions.
798  * @ingroup config_types
799  */
802  uint8_t reserved[10] = {0};
803 
804  /** The distance between the front axle and rear axle (in meters). */
805  float wheelbase_m = NAN;
806 
807  /** The distance between the two front wheels (in meters). */
808  float front_track_width_m = NAN;
809 
810  /** The distance between the two rear wheels (in meters). */
811  float rear_track_width_m = NAN;
812 };
813 
814 /**
815  * @brief The type of vehicle/wheel speed measurements produced by the vehicle.
816  * @ingroup config_types
817  */
818 enum class WheelSensorType : uint8_t {
819  /** Wheel/vehicle speed data not available. */
820  NONE = 0,
821  // RESERVED = 1,
822  /**
823  * Individual rotational angle measurements for multiple wheels, reported as
824  * accumulated encoder ticks. See @ref WheelTickInput.
825  * */
826  TICKS = 2,
827  /**
828  * Individual speed measurements for multiple wheels, reported in
829  * meters/second. See @ref WheelSpeedInput.
830  */
831  WHEEL_SPEED = 3,
832  /**
833  * A single value indicating the vehicle speed (in meters/second). See @ref
834  * VehicleSpeedInput.
835  */
836  VEHICLE_SPEED = 4,
837  /**
838  * A single wheel rotational angle, reported as accumulated encoder ticks. See
839  * @ref VehicleSpeedInput.
840  */
841  VEHICLE_TICKS = 5,
842 };
843 
844 /**
845  * @brief Get a human-friendly string name for the specified @ref
846  * WheelSensorType.
847  * @ingroup config_types
848  *
849  * @param wheel_sensor_type The desired wheel sensor type.
850  *
851  * @return The corresponding string name.
852  */
853 P1_CONSTEXPR_FUNC const char* to_string(WheelSensorType wheel_sensor_type) {
854  switch (wheel_sensor_type) {
855  case WheelSensorType::NONE: {
856  return "None";
857  }
858  case WheelSensorType::TICKS: {
859  return "Ticks";
860  }
862  return "Wheel Speed";
863  }
865  return "Vehicle Speed";
866  }
868  return "Vehicle Ticks";
869  }
870  default: {
871  return "None";
872  }
873  }
874 }
875 
876 /**
877  * @brief @ref WheelSensorType stream operator.
878  * @ingroup config_types
879  */
881  WheelSensorType wheel_sensor_type) {
882  stream << to_string(wheel_sensor_type) << " (" << (int)wheel_sensor_type
883  << ")";
884  return stream;
885 }
886 
887 /**
888  * @brief The type of vehicle/wheel speed measurements to be applied.
889  * @ingroup config_types
890  */
891 enum class AppliedSpeedType : uint8_t {
892  /** Speed data not applied to the system. */
893  NONE = 0,
894  /** Rear wheel speed data to be applied to the system (recommended). */
895  REAR_WHEELS = 1,
896  /** Front wheel speed data to be applied to the system. */
897  FRONT_WHEELS = 2,
898  /** Front and rear wheel speed data to be applied to the system. */
900  /** Individual vehicle speed to be applied to the system. */
901  VEHICLE_BODY = 4,
902 };
903 
904 /**
905  * @brief Get a human-friendly string name for the specified @ref
906  * AppliedSpeedType.
907  * @ingroup config_types
908  *
909  * @param applied_speed_type The desired applied speed type.
910  *
911  * @return The corresponding string name.
912  */
913 P1_CONSTEXPR_FUNC const char* to_string(AppliedSpeedType applied_speed_type) {
914  switch (applied_speed_type) {
915  case AppliedSpeedType::NONE: {
916  return "None";
917  }
919  return "Rear Wheels";
920  }
922  return "Front Wheels";
923  }
925  return "Front and Rear Wheels";
926  }
928  return "Vehicle Body";
929  }
930  default: {
931  return "Unrecognized";
932  }
933  }
934 }
935 
936 /**
937  * @brief @ref AppliedSpeedType stream operator.
938  * @ingroup config_types
939  */
941  AppliedSpeedType applied_speed_type) {
942  stream << to_string(applied_speed_type) << " (" << (int)applied_speed_type
943  << ")";
944  return stream;
945 }
946 
947 /**
948  * @brief Indication of which of the vehicle's wheels are steered.
949  * @ingroup config_types
950  */
951 enum class SteeringType : uint8_t {
952  /** Steered wheels unknown. */
953  UNKNOWN = 0,
954  /** Front wheels are steered. */
955  FRONT = 1,
956  /** Front and rear wheels are steered. */
957  FRONT_AND_REAR = 2,
958 };
959 
960 /**
961  * @brief Get a human-friendly string name for the specified @ref SteeringType.
962  * @ingroup config_types
963  *
964  * @param steering_type The desired steering type.
965  *
966  * @return The corresponding string name.
967  */
968 P1_CONSTEXPR_FUNC const char* to_string(SteeringType steering_type) {
969  switch (steering_type) {
970  case SteeringType::UNKNOWN: {
971  return "Unknown Steering";
972  }
973  case SteeringType::FRONT: {
974  return "Front Steering";
975  }
977  return "Front and Rear Steering";
978  }
979  default: {
980  return "Unrecognized";
981  }
982  }
983 }
984 
985 /**
986  * @brief @ref SteeringType stream operator.
987  * @ingroup config_types
988  */
989 inline p1_ostream& operator<<(p1_ostream& stream, SteeringType steering_type) {
990  stream << to_string(steering_type) << " (" << (int)steering_type << ")";
991  return stream;
992 }
993 
994 /**
995  * @brief Software vehicle/wheel speed measurement configuration settings.
996  * @ingroup config_types
997  *
998  * @warning
999  * The @ref WheelConfig payload is intended for use on vehicles where wheel
1000  * speed or angle (tick) data is received via software, either using
1001  * FusionEngine measurement messages, or from another software data source such
1002  * as a vehicle CAN bus. For vehicles using a hardware wheel tick voltage
1003  * signal, use @ref HardwareTickConfig instead.
1004  *
1005  * Wheel data may be differential (measurements from each individual wheel), or
1006  * scalar (a single speed measurement for the vehicle body).
1007  *
1008  * When using software wheel data, you must also specify @ref VehicleDetails,
1009  * which is used to describe the vehicle dimensions and make/model.
1010  *
1011  * See also:
1012  * - @ref WheelSpeedInput
1013  * - @ref VehicleSpeedInput
1014  * - @ref WheelTickInput
1015  * - @ref VehicleTickInput
1016  */
1018  /**
1019  * The type of vehicle/wheel speed measurements produced by the vehicle.
1020  */
1022 
1023  /**
1024  * The type of vehicle/wheel speed measurements to be applied to the
1025  * navigation solution.
1026  */
1028 
1029  /** Indication of which of the vehicle's wheels are steered. */
1031 
1032  uint8_t reserved1[1] = {0};
1033 
1034  /**
1035  * The rate at which wheel speed/tick measurements will be sent to the device
1036  * (in seconds).
1037  *
1038  * @note
1039  * This parameter is required when using software wheel measurements. It
1040  * may not be `NAN` if wheel measurements are enabled, and cannot be
1041  * determined automatically by the device.
1042  */
1043  float wheel_update_interval_sec = NAN;
1044 
1045  /**
1046  * Override the rate at which wheel tick measurements will be used by the
1047  * navigation engine (in seconds).
1048  *
1049  * If this parameter is `NAN` (default), the best rate will be selected
1050  * automatically by the device based on the input rate (@ref
1051  * wheel_update_interval_sec) and the wheel tick quantization (@ref
1052  * wheel_ticks_to_m).
1053  *
1054  * @warning
1055  * For most system configurations, we recommend setting this value to `NAN` to
1056  * let the device choose the appropriate setting. Use this setting with
1057  * caution.
1058  */
1059  float wheel_tick_output_interval_sec = NAN;
1060 
1061  /**
1062  * Ratio between angle of the steering wheel and the angle of the wheels on
1063  * the ground.
1064  *
1065  * Used when applying measurements from steered wheels only, ignored
1066  * otherwise.
1067  */
1068  float steering_ratio = NAN;
1069 
1070  /**
1071  * The scale factor to convert from wheel encoder ticks to distance (in
1072  * meters/tick).
1073  *
1074  * Used for @ref WheelSensorType::TICKS and @ref
1075  * WheelSensorType::VEHICLE_TICKS, ignored for wheel speed input.
1076  */
1077  float wheel_ticks_to_m = NAN;
1078 
1079  /**
1080  * The maximum value (inclusive) before the wheel tick measurement will roll
1081  * over.
1082  *
1083  * The rollover behavior depends on the value of @ref wheel_ticks_signed. For
1084  * example, a maximum value of 10 will work as follows:
1085  * - `wheel_ticks_signed == true`: [-11, 10]
1086  * - `wheel_ticks_signed == false`: [0, 10]
1087  *
1088  * Signed values are assumed to be asymmetric, consistent with a typical 2's
1089  * complement rollover.
1090  *
1091  * Used for @ref WheelSensorType::TICKS and @ref
1092  * WheelSensorType::VEHICLE_TICKS, ignored for wheel speed input.
1093  */
1094  uint32_t wheel_tick_max_value = 0;
1095 
1096  /**
1097  * `true` if the reported wheel tick measurements should be interpreted as
1098  * signed integers, or `false` if they should be interpreted as unsigned
1099  * integers.
1100  *
1101  * Used for @ref WheelSensorType::TICKS and @ref
1102  * WheelSensorType::VEHICLE_TICKS, ignored for wheel speed input. See
1103  * @ref wheel_tick_max_value for details.
1104  */
1105  bool wheel_ticks_signed = false;
1106 
1107  /**
1108  * `true` if the wheel tick measurements increase by a positive amount when
1109  * driving forward or backward. `false` if wheel tick measurements decrease
1110  * when driving backward.
1111  *
1112  * Used for @ref WheelSensorType::TICKS and @ref
1113  * WheelSensorType::VEHICLE_TICKS, ignored for wheel speed input.
1114  */
1115  bool wheel_ticks_always_increase = true;
1116 
1117  uint8_t reserved2[2] = {0};
1118 };
1119 
1120 /**
1121  * @brief The signal edge to use when capturing a wheel tick voltage signal.
1122  * @ingroup config_types
1123  */
1124 enum class TickMode : uint8_t {
1125  /** Wheel tick capture disabled. */
1126  OFF = 0,
1127  /** Capture a wheel tick on the rising edge of the incoming pulse. */
1128  RISING_EDGE = 1,
1129  /** Capture a wheel tick on the falling edge of the incoming pulse. */
1130  FALLING_EDGE = 2,
1131 };
1132 
1133 P1_CONSTEXPR_FUNC const char* to_string(TickMode tick_mode) {
1134  switch (tick_mode) {
1135  case TickMode::OFF:
1136  return "OFF";
1137  case TickMode::RISING_EDGE:
1138  return "RISING_EDGE";
1140  return "FALLING_EDGE";
1141  default:
1142  return "UNRECOGNIZED";
1143  }
1144 }
1145 
1146 /**
1147  * @brief @ref TickMode stream operator.
1148  * @ingroup config_types
1149  */
1150 inline p1_ostream& operator<<(p1_ostream& stream, TickMode tick_mode) {
1151  stream << to_string(tick_mode) << " (" << (int)tick_mode << ")";
1152  return stream;
1153 }
1154 
1155 /**
1156  * @brief The way to interpret an incoming voltage signal, used to indicate
1157  * direction of a hardware wheel tick pulse, if available.
1158  * @ingroup config_types
1159  */
1160 enum class TickDirection : uint8_t {
1161  /** Wheel tick direction not provided. */
1162  OFF = 0,
1163  /**
1164  * Assume vehicle is moving forward when direction signal voltage is high, and
1165  * backward when direction signal is low.
1166  */
1167  FORWARD_ACTIVE_HIGH = 1,
1168  /**
1169  * Assume vehicle is moving forward when direction signal voltage is low, and
1170  * backward when direction signal is high.
1171  */
1172  FORWARD_ACTIVE_LOW = 2,
1173 };
1174 
1175 P1_CONSTEXPR_FUNC const char* to_string(TickDirection tick_direction) {
1176  switch (tick_direction) {
1177  case TickDirection::OFF:
1178  return "OFF";
1180  return "FORWARD_ACTIVE_HIGH";
1182  return "FORWARD_ACTIVE_LOW";
1183  default:
1184  return "UNRECOGNIZED";
1185  }
1186 }
1187 
1188 /**
1189  * @brief @ref TickDirection stream operator.
1190  * @ingroup config_types
1191  */
1193  TickDirection tick_direction) {
1194  stream << to_string(tick_direction) << " (" << (int)tick_direction << ")";
1195  return stream;
1196 }
1197 
1198 /**
1199  * @brief Hardware wheel tick encoder configuration settings.
1200  * @ingroup config_types
1201  *
1202  * @warning
1203  * The @ref HardwareTickConfig payload is intended for use on vehicles with a
1204  * physical voltage signal, generated by a wheel encoder, that produces a series
1205  * of voltage pulses (encoder ticks) as the vehicle’s wheel rotates. These ticks
1206  * will be captured by the device on an input pin and used to indicate vehicle
1207  * speed. For vehicles using software wheel speed/tick information, including
1208  * data send using FusionEngine messages or a vehicle CAN bus, use @ref
1209  * WheelConfig instead.
1210  *
1211  * @note
1212  * In addition to the wheel tick signal, an optional voltage signal may be
1213  * provided to indicate vehicle direction. If this signal is not connected, the
1214  * @ref tick_direction setting MUST be set to `OFF` otherwise there will be
1215  * substantial errors in dead reckoning.
1216  *
1217  * See also @ref VehicleTickInput.
1218  */
1220  /**
1221  * If enabled -- tick mode is not @ref TickMode::OFF -- the device will
1222  * accumulate ticks received on the I/O pin, and use them as an indication of
1223  * vehicle speed. If enabled, you must also specify @ref wheel_ticks_to_m to
1224  * indicate the mapping of wheel tick encoder angle to tire circumference. All
1225  * other wheel tick-related parameters such as tick capture rate, rollover
1226  * value, etc. will be set internally.
1227  *
1228  * @warning
1229  * Do not enable this feature if a wheel tick voltage signal is not present.
1230  */
1232 
1233  /**
1234  * When direction is @ref TickDirection::OFF, the incoming ticks will be
1235  * treated as unsigned, meaning the tick count will continue to increase in
1236  * either direction of travel. If direction is not @ref TickDirection::OFF,
1237  * a second direction I/O pin will be used to indicate the direction of
1238  * travel and the accumulated tick count will increase/decrease accordingly.
1239  */
1241 
1242  uint8_t reserved1[2] = {0};
1243 
1244  /**
1245  * The scale factor to convert from wheel encoder ticks to distance (in
1246  * meters/tick). Used for @ref WheelSensorType::TICKS.
1247  */
1248  float wheel_ticks_to_m = NAN;
1249 };
1250 
1251 /**
1252  * @brief The ionospheric delay model to use.
1253  * @ingroup config_types
1254  */
1255 enum class IonoDelayModel : uint8_t {
1256  /** Select the best available ionospheric delay model. */
1257  AUTO = 0,
1258  /** Ionospheric delay model disabled. */
1259  OFF = 1,
1260  /** Use the Klobuchar ionospheric model. */
1261  KLOBUCHAR = 2,
1262  /** Use the SBAS ionospheric model. */
1263  SBAS = 3,
1264 };
1265 
1266 P1_CONSTEXPR_FUNC const char* to_string(IonoDelayModel iono_delay_model) {
1267  switch (iono_delay_model) {
1268  case IonoDelayModel::AUTO:
1269  return "AUTO";
1270  case IonoDelayModel::OFF:
1271  return "OFF";
1273  return "KLOBUCHAR";
1274  case IonoDelayModel::SBAS:
1275  return "SBAS";
1276  default:
1277  return "UNRECOGNIZED";
1278  }
1279 }
1280 
1281 /**
1282  * @brief @ref IonoDelayModel stream operator.
1283  * @ingroup config_types
1284  */
1286  IonoDelayModel iono_delay_model) {
1287  stream << to_string(iono_delay_model) << " (" << (int)iono_delay_model << ")";
1288  return stream;
1289 }
1290 
1291 /**
1292  * @brief Ionospheric delay model configuration.
1293  * @ingroup config_types
1294  */
1296  /** The ionospheric delay model to use. */
1298 
1299  uint8_t reserved[3] = {0};
1300 };
1301 
1302 /**
1303  * @brief The tropospheric delay model to use.
1304  * @ingroup config_types
1305  */
1306 enum class TropoDelayModel : uint8_t {
1307  /** Select the best available tropospheric delay model. */
1308  AUTO = 0,
1309  /** Tropospheric delay model disabled. */
1310  OFF = 1,
1311  /** Use the Saastamoinen tropospheric model. */
1312  SAASTAMOINEN = 2,
1313 };
1314 
1315 P1_CONSTEXPR_FUNC const char* to_string(TropoDelayModel tropo_delay_model) {
1316  switch (tropo_delay_model) {
1317  case TropoDelayModel::AUTO:
1318  return "AUTO";
1319  case TropoDelayModel::OFF:
1320  return "OFF";
1322  return "SAASTAMOINEN";
1323  default:
1324  return "UNRECOGNIZED";
1325  }
1326 }
1327 
1328 /**
1329  * @brief @ref TropoDelayModel stream operator.
1330  * @ingroup config_types
1331  */
1333  TropoDelayModel tropo_delay_model) {
1334  stream << to_string(tropo_delay_model) << " (" << (int)tropo_delay_model
1335  << ")";
1336  return stream;
1337 }
1338 
1339 /**
1340  * @brief Tropospheric delay model configuration.
1341  * @ingroup config_types
1342  */
1344  /** The tropospheric delay model to use. */
1346 
1347  uint8_t reserved[3] = {0};
1348 };
1349 
1350 /**************************************************************************/ /**
1351  * @defgroup import_export Device Configuration Import/Export
1352  * @brief Messages for importing/exporting device configuration.
1353  * @ingroup config_and_ctrl_messages
1354  *
1355  * See also @ref config_types.
1356  ******************************************************************************/
1357 
1358 /**
1359  * @brief Type of data stored on device.
1360  * @ingroup import_export
1361  */
1362 enum class DataType : uint8_t {
1363  CALIBRATION_STATE = 0,
1364  CRASH_LOG = 1,
1365  FILTER_STATE = 2,
1366  USER_CONFIG = 3,
1367  INVALID = 255
1368 };
1369 
1370 /**
1371  * @brief Get a string representation of a @ref DataType.
1372  * @ingroup import_export
1373  *
1374  * @param type The requested type.
1375  *
1376  * @return The corresponding string name.
1377  */
1379  switch (type) {
1381  return "CalibrationState";
1382  case DataType::CRASH_LOG:
1383  return "CrashLog";
1385  return "FilterState";
1386  case DataType::USER_CONFIG:
1387  return "UserConfig";
1388  default:
1389  return "Invalid";
1390  }
1391 }
1392 
1393 /**
1394  * @brief @ref DataType stream operator.
1395  * @ingroup import_export
1396  */
1397 inline p1_ostream& operator<<(p1_ostream& stream, DataType val) {
1398  stream << to_string(val) << " (" << (int)val << ")";
1399  return stream;
1400 }
1401 
1402 /**
1403  * @brief Import data from the host to the device (@ref
1404  * MessageType::IMPORT_DATA, version 1.0).
1405  * @ingroup import_export
1406  *
1407  * This message must be followed by @ref data_length_bytes bytes containing
1408  * the data to be imported:
1409  *
1410  * ```
1411  * {MessageHeader, ImportDataMessage, Payload[data_length_bytes]}
1412  * ```
1413  *
1414  * # Expected Response
1415  * The device will respond with a @ref CommandResponseMessage indicating whether
1416  * or not the request succeeded.
1417  */
1419  static constexpr MessageType MESSAGE_TYPE = MessageType::IMPORT_DATA;
1420  static constexpr uint8_t MESSAGE_VERSION = 0;
1421  /**
1422  * The type of data being imported.
1423  */
1425  /**
1426  * The location of the data to update (active, saved, etc.). For data that
1427  * doesn't have separate active and saved copies, this parameter is ignored.
1428  */
1430  uint8_t reserved1[2] = {0};
1431  /** @brief Version of data contents. */
1433  uint8_t reserved2[4] = {0};
1434  /** @brief Number of bytes to update. */
1435  uint32_t data_length_bytes = 0;
1436 };
1437 
1438 /**
1439  * @brief Export data from the device (@ref
1440  * MessageType::EXPORT_DATA, version 1.0).
1441  * @ingroup import_export
1442  *
1443  * # Expected Response
1444  * The device will respond with a @ref PlatformStorageDataMessage.
1445  */
1447  static constexpr MessageType MESSAGE_TYPE = MessageType::EXPORT_DATA;
1448  static constexpr uint8_t MESSAGE_VERSION = 0;
1449  /**
1450  * The type of data to be exported.
1451  */
1453  /**
1454  * The source to copy this data from. If the data_type doesn't separate active
1455  * and saved data, this will be ignored.
1456  */
1458  uint8_t reserved[2] = {0};
1459 };
1460 
1461 /**
1462  * @brief Message for reporting platform storage data (@ref
1463  * MessageType::PLATFORM_STORAGE_DATA, version 1.0).
1464  * @ingroup import_export
1465  *
1466  * This message will be followed by @ref data_length_bytes bytes containing
1467  * the data storage contents:
1468  *
1469  * ```
1470  * {MessageHeader, PlatformStorageDataMessage, Payload[data_length_bytes]}
1471  * ```
1472  *
1473  * See also @ref ExportDataMessage.
1474  *
1475  * Changes:
1476  * - Version 1: Added `data_validity` field.
1477  * - Version 2: Changed data_validity to a @ref Response enum and added
1478  * @ref source field.
1479  * - Version 3: Added @ref flags field.
1480  */
1482  static constexpr MessageType MESSAGE_TYPE =
1484  static constexpr uint8_t MESSAGE_VERSION = 3;
1485 
1486  /** @ref DataType::USER_CONFIG flag field is not set. */
1487  static constexpr uint8_t FLAG_USER_CONFIG_PLATFORM_NOT_SPECIFIED = 0;
1488  /** @ref DataType::USER_CONFIG flag for POSIX platforms. */
1489  static constexpr uint8_t FLAG_USER_CONFIG_PLATFORM_POSIX = 1;
1490  /** @ref DataType::USER_CONFIG flag for embedded platforms. */
1491  static constexpr uint8_t FLAG_USER_CONFIG_PLATFORM_EMBEDDED = 2;
1492  /** @ref DataType::USER_CONFIG flag for embedded SSR platforms. */
1493  static constexpr uint8_t FLAG_USER_CONFIG_PLATFORM_EMBEDDED_SSR = 3;
1494  /** @ref DataType::USER_CONFIG flag for the SSR client library. */
1495  static constexpr uint8_t FLAG_USER_CONFIG_SSR_CLIENT = 254;
1496 
1497  /**
1498  * The type of data contained in this message.
1499  */
1501  /**
1502  * The status of the specified data type on the device.
1503  */
1505  /**
1506  * The source this data was copied from. If the @ref data_type doesn't
1507  * separate active and saved data, this will be set to @ref
1508  * ConfigurationSource::ACTIVE.
1509  */
1511  /**
1512  * @ref DataType specific flags.
1513  *
1514  * Currently, only defined for @ref DataType::USER_CONFIG contents. This value
1515  * can optionally set to one of the `FLAG_USER_CONFIG_PLATFORM_*` values to
1516  * indicate which type of platform the UserConfig is valid for. This value
1517  * can be left at `0` for backwards compatibility or to indicate the platform
1518  * type is unknown.
1519  */
1520  uint8_t flags = 0;
1521  /** Version of data contents. */
1523  /** Number of bytes in data contents. */
1524  uint32_t data_length_bytes = 0;
1525 };
1526 
1527 /**************************************************************************/ /**
1528  * @defgroup io_interfaces Input/Output Interface And Message Rate Control
1529  * @brief Messages for controlling device output (e.g., define TCP server
1530  * parameters, configure message output rates).
1531  * @ingroup config_and_ctrl_messages
1532  ******************************************************************************/
1533 
1534 /**
1535  * @brief An identifier for the contents of a output interface configuration
1536  * submessage.
1537  * @ingroup io_interfaces
1538  *
1539  * See also @ref InterfaceConfigSubmessage.
1540  */
1541 enum class InterfaceConfigType : uint8_t {
1542  INVALID = 0,
1543 
1544  /**
1545  * Enable/disable output of diagnostic data on this interface.
1546  *
1547  * Valid for:
1548  * - All @ref TransportType
1549  *
1550  * @note
1551  * Enabling this setting will override the message rate/off settings for some
1552  * FusionEngine messages.
1553  *
1554  * Payload format: `bool`
1555  */
1557 
1558  /**
1559  * Configure the serial baud rate (in bits/second).
1560  *
1561  * Valid for:
1562  * - @ref TransportType::SERIAL
1563  *
1564  * Payload format: `uint32_t`
1565  */
1566  BAUD_RATE = 2,
1567 
1568  /**
1569  * Configure the network address for a client to connect to.
1570  *
1571  * For UNIX domain sockets, this string represents the path to the local
1572  * socket file.
1573  *
1574  * Valid for:
1575  * - @ref TransportType::TCP
1576  * - @ref TransportType::UDP
1577  * - @ref TransportType::UNIX
1578  *
1579  * Payload format: `char[64]` containing a NULL terminated string.
1580  */
1581  REMOTE_ADDRESS = 3,
1582 
1583  /**
1584  * Configure the network port.
1585  *
1586  * Valid for:
1587  * - @ref TransportType::TCP
1588  * - @ref TransportType::UDP
1589  * - @ref TransportType::WEBSOCKET
1590  *
1591  * Payload format: `uint16_t`
1592  */
1593  PORT = 4,
1594 
1595  /**
1596  * Enable/disable the interface.
1597  *
1598  * Valid for all @ref TransportType values.
1599  *
1600  * Payload format: `bool`
1601  */
1602  ENABLED = 5,
1603 
1604  /**
1605  * Set the interface direction (client/server).
1606  *
1607  * Valid for:
1608  * - @ref TransportType::TCP
1609  * - @ref TransportType::WEBSOCKET
1610  * - @ref TransportType::UNIX
1611  *
1612  * Payload format: @ref TransportDirection
1613  */
1614  DIRECTION = 6,
1615 
1616  /**
1617  * Set the UNIX domain socket type (streaming/datagram/sequenced).
1618  *
1619  * Valid for:
1620  * - @ref TransportType::UNIX
1621  *
1622  * Payload format: @ref SocketType
1623  */
1624  SOCKET_TYPE = 7,
1625 };
1626 
1627 /**
1628  * @brief Get a human-friendly string name for the specified @ref ConfigType.
1629  * @ingroup io_interfaces
1630  *
1631  * @param type The desired configuration parameter type.
1632  *
1633  * @return The corresponding string name.
1634  */
1636  switch (type) {
1638  return "Invalid";
1639 
1641  return "Diagnostic Messages Enabled";
1642 
1644  return "Serial Baud Rate";
1645 
1647  return "Remote Network Address";
1648 
1650  return "Network Port";
1651 
1653  return "Interface Enabled";
1654 
1656  return "Transport Direction";
1657 
1659  return "Socket Type";
1660 
1661  default:
1662  return "Unrecognized Configuration";
1663  }
1664 }
1665 
1666 /**
1667  * @brief @ref InterfaceConfigType stream operator.
1668  * @ingroup io_interfaces
1669  */
1671  stream << to_string(type) << " (" << (int)type << ")";
1672  return stream;
1673 }
1674 
1675 /**
1676  * @brief The framing protocol of a message.
1677  * @ingroup io_interfaces
1678  */
1679 enum class ProtocolType : uint8_t {
1680  INVALID = 0,
1681  FUSION_ENGINE = 1,
1682  NMEA = 2,
1683  RTCM = 3,
1684  /** This is used for requesting the configuration for all protocols. */
1685  ALL = 0xFF,
1686 };
1687 
1688 /** Setting message_id to this value acts as a wild card. */
1689 constexpr uint16_t ALL_MESSAGES_ID = 0xFFFF;
1690 
1691 /**
1692  * @brief Get a human-friendly string name for the specified @ref
1693  * ProtocolType.
1694  * @ingroup io_interfaces
1695  *
1696  * @param val The enum to get the string name for.
1697  *
1698  * @return The corresponding string name.
1699  */
1701  switch (val) {
1702  case ProtocolType::INVALID:
1703  return "Invalid";
1705  return "FusionEngine";
1706  case ProtocolType::NMEA:
1707  return "NMEA";
1708  case ProtocolType::RTCM:
1709  return "RTCM";
1710  case ProtocolType::ALL:
1711  return "ALL";
1712  default:
1713  return "Unrecognized";
1714  }
1715 }
1716 
1717 /**
1718  * @brief @ref ProtocolType stream operator.
1719  * @ingroup io_interfaces
1720  */
1722  stream << to_string(val) << " (" << (int)val << ")";
1723  return stream;
1724 }
1725 
1726 /**
1727  * @brief Type of I/O interface transport.
1728  * @ingroup io_interfaces
1729  */
1730 enum class TransportType : uint8_t {
1731  INVALID = 0,
1732  /** A serial data interface (e.g. an RS232 connection). */
1733  SERIAL = 1,
1734  /** A interface that writes to a file. */
1735  FILE = 2,
1736  // RESERVED = 3,
1737  /**
1738  * A TCP client or server.
1739  *
1740  * A TCP client will connect to a specified TCP server address and port. A TCP
1741  * server will listen for incoming client connections, and may communicate
1742  * with multiple clients at a time. Responses to commands will be sent only to
1743  * the the issuing client. All other configured output messages will be sent
1744  * to all clients.
1745  *
1746  * See also @ref TransportDirection.
1747  */
1748  TCP = 4,
1749  /**
1750  * A UDP client or server.
1751  *
1752  * UDP connections are stateless, unlike TCP. A UDP interface will listen for
1753  * incoming messages on a specified port. It may optionally be configured to
1754  * sent output to a specific hostname or IP address, including broadcast or
1755  * multicast addresses. If an address is not specified, the interface will not
1756  * send any output automatically, but it will respond to incoming commands,
1757  * sending responses back to the remote client's address and port.
1758  */
1759  UDP = 5,
1760  // RESERVED = 6,
1761  /**
1762  * A WebSocket client or server.
1763  *
1764  * WebSocket connections are similar to TCP connections, and use TCP as their
1765  * underlying transport, but use the WebSocket protocol to send and receive
1766  * data.
1767  *
1768  * See also @ref TransportDirection.
1769  */
1770  WEBSOCKET = 7,
1771  /**
1772  * A UNIX domain socket client or server.
1773  *
1774  * UNIX domain socket connections may be configured as either client that
1775  * connects to an existing server, or a server that listens for one or more
1776  * incoming client connections. UNIX domain sockets may operate in one of
1777  * three possible modes:
1778  * - A connection-oriented streaming mode where packet boundaries are not
1779  * preserved (similar to TCP)
1780  * - Datagram mode where packet boundaries are preserved but connections
1781  * between the client and server are not maintained, and the interface sends
1782  * output to an optional configured file (similar to UDP)
1783  * - Sequenced packet mode, which is connection-oriented (like TCP) but also
1784  * preserves message boundaries (like UDP) and guarantees in-order delivery
1785  *
1786  * For a UNIX domain socket, you must specify:
1787  * - The @ref TransportDirection (client or server)
1788  * - The @ref SocketType (streaming, datagram, or sequenced)
1789  * - The path to a socket file to connect to (client) or create (server)
1790  */
1791  UNIX = 8,
1792  /**
1793  * Set/get the configuration for the interface on which the command was
1794  * received.
1795  */
1796  CURRENT = 254,
1797  /** Set/get the configuration for the all I/O interfaces. */
1798  ALL = 255,
1799 };
1800 
1801 /**
1802  * @brief Get a human-friendly string name for the specified @ref
1803  * TransportType.
1804  * @ingroup io_interfaces
1805  *
1806  * @param val The enum to get the string name for.
1807  *
1808  * @return The corresponding string name.
1809  */
1811  switch (val) {
1813  return "Invalid";
1814  case TransportType::SERIAL:
1815  return "Serial";
1816  case TransportType::FILE:
1817  return "File";
1818  case TransportType::TCP:
1819  return "TCP";
1820  case TransportType::UDP:
1821  return "UDP";
1823  return "WebSocket";
1824  case TransportType::UNIX:
1825  return "UNIX";
1827  return "Current";
1828  case TransportType::ALL:
1829  return "All";
1830  }
1831  return "Unrecognized";
1832 }
1833 
1834 /**
1835  * @brief @ref TransportType stream operator.
1836  * @ingroup io_interfaces
1837  */
1839  stream << to_string(val) << " (" << (int)val << ")";
1840  return stream;
1841 }
1842 
1843 /**
1844  * @brief The direction (client/server) for an individual interface.
1845  * @ingroup io_interfaces
1846  */
1847 enum class TransportDirection : uint8_t {
1848  INVALID = 0,
1849  /** A server listening for one or more incoming remote connections. */
1850  SERVER = 1,
1851  /** A client connecting to a specified remote server. */
1852  CLIENT = 2,
1853 };
1854 
1855 /**
1856  * @brief Get a human-friendly string name for the specified @ref
1857  * TransportDirection.
1858  * @ingroup io_interfaces
1859  *
1860  * @param val The enum to get the string name for.
1861  *
1862  * @return The corresponding string name.
1863  */
1865  switch (val) {
1867  return "INVALID";
1869  return "SERVER";
1871  return "CLIENT";
1872  }
1873  return "Unrecognized";
1874 }
1875 
1876 /**
1877  * @brief @ref TransportDirection stream operator.
1878  * @ingroup io_interfaces
1879  */
1881  stream << to_string(val) << " (" << (int)val << ")";
1882  return stream;
1883 }
1884 
1885 /**
1886  * @brief The socket type specifying how data is transmitted for UNIX domain
1887  * sockets.
1888  * @ingroup io_interfaces
1889  */
1890 enum class SocketType : uint8_t {
1891  INVALID = 0,
1892  /**
1893  * Operate in connection-oriented streaming mode and do not preserve message
1894  * boundaries (similar to TCP).
1895  */
1896  STREAM = 1,
1897  /**
1898  * Operate in datagram mode, preserving message boundaries but not maintaining
1899  * client connections (similar to UDP).
1900  */
1901  DATAGRAM = 2,
1902  /**
1903  * Operate in sequenced packet mode, which is both connection-oriented and
1904  * preserves message boundaries.
1905  */
1906  SEQPACKET = 3,
1907 };
1908 
1909 /**
1910  * @brief Get a human-friendly string name for the specified @ref SocketType.
1911  * @ingroup io_interfaces
1912  *
1913  * @param val The enum to get the string name for.
1914  *
1915  * @return The corresponding string name.
1916  */
1918  switch (val) {
1919  case SocketType::INVALID:
1920  return "INVALID";
1921  case SocketType::STREAM:
1922  return "STREAM";
1923  case SocketType::DATAGRAM:
1924  return "DATAGRAM";
1925  case SocketType::SEQPACKET:
1926  return "SEQPACKET";
1927  }
1928  return "Unrecognized";
1929 }
1930 
1931 /**
1932  * @brief @ref SocketType stream operator.
1933  * @ingroup io_interfaces
1934  */
1936  stream << to_string(val) << " (" << (int)val << ")";
1937  return stream;
1938 }
1939 
1940 /**
1941  * @brief Identifier for an I/O interface.
1942  * @ingroup io_interfaces
1943  *
1944  * For example, serial port 1 or TCP server 2.
1945  *
1946  * @note
1947  * On most devices, serial ports (UARTs) use 1-based numbering: the first serial
1948  * port is typically index 1 (UART1).
1949  */
1951  /** The interface's transport type. **/
1953  /** An identifier for the instance of this transport. */
1954  uint8_t index = 0;
1955  uint8_t reserved[2] = {0};
1956 
1958 
1959  P1_CONSTEXPR_FUNC explicit InterfaceID(TransportType type, uint8_t index = 0)
1960  : type(type), index(index) {}
1961 
1962  P1_CONSTEXPR_FUNC bool operator==(const InterfaceID& other) const {
1963  return type == other.type && index == other.index;
1964  }
1965 
1966  P1_CONSTEXPR_FUNC bool operator!=(const InterfaceID& other) const {
1967  return !(*this == other);
1968  }
1969 
1970  P1_CONSTEXPR_FUNC bool operator<(const InterfaceID& other) const {
1971  if (type == other.type) {
1972  return index < other.index;
1973  } else {
1974  return type < other.type;
1975  }
1976  }
1977 
1978  P1_CONSTEXPR_FUNC bool operator>(const InterfaceID& other) const {
1979  return other < *this;
1980  }
1981 
1982  P1_CONSTEXPR_FUNC bool operator>=(const InterfaceID& other) const {
1983  return !(*this < other);
1984  }
1985 
1986  P1_CONSTEXPR_FUNC bool operator<=(const InterfaceID& other) const {
1987  return !(*this > other);
1988  }
1989 };
1990 
1991 /**
1992  * @brief @ref InterfaceID stream operator.
1993  * @ingroup io_interfaces
1994  */
1995 inline p1_ostream& operator<<(p1_ostream& stream, const InterfaceID& val) {
1996  stream << "[type=" << val.type << ", index=" << (int)val.index << "]";
1997  return stream;
1998 }
1999 
2000 /**
2001  * @brief Integer ID for NMEA messages.
2002  * @ingroup io_interfaces
2003  */
2004 enum class NmeaMessageType : uint16_t {
2005  INVALID = 0,
2006 
2007  /**
2008  * @name Standard NMEA Messages
2009  * @{
2010  */
2011  GGA = 1,
2012  GLL = 2,
2013  GSA = 3,
2014  GSV = 4,
2015  RMC = 5,
2016  VTG = 6,
2017  ZDA = 7,
2018  /** @} */
2019 
2020  /**
2021  * @name Point One Proprietary Messages
2022  * @{
2023  */
2024  P1CALSTATUS = 1000,
2025  P1MSG = 1001,
2026  /** @} */
2027 
2028  /**
2029  * @name Quectel Proprietary Messages
2030  * @{
2031  */
2032  PQTMVERNO = 1200,
2033  PQTMVER = 1201,
2034  PQTMGNSS = 1202,
2035  PQTMVERNO_SUB = 1203,
2036  PQTMVER_SUB = 1204,
2037  PQTMTXT = 1205,
2038  /** @} */
2039 };
2040 
2041 /**
2042  * @brief Get a human-friendly string name for the specified @ref
2043  * NmeaMessageType.
2044  * @ingroup io_interfaces
2045  *
2046  * @param value The enum to get the string name for.
2047  *
2048  * @return The corresponding string name.
2049  */
2051  switch (value) {
2053  return "INVALID";
2054  case NmeaMessageType::GGA:
2055  return "GGA";
2056  case NmeaMessageType::GLL:
2057  return "GLL";
2058  case NmeaMessageType::GSA:
2059  return "GSA";
2060  case NmeaMessageType::GSV:
2061  return "GSV";
2062  case NmeaMessageType::RMC:
2063  return "RMC";
2064  case NmeaMessageType::VTG:
2065  return "VTG";
2066  case NmeaMessageType::ZDA:
2067  return "ZDA";
2069  return "P1CALSTATUS";
2071  return "P1MSG";
2073  return "PQTMVERNO";
2075  return "PQTMVER";
2077  return "PQTMGNSS";
2079  return "PQTMVERNO_SUB";
2081  return "PQTMVER_SUB";
2083  return "PQTMTXT";
2084  default:
2085  return "Unrecognized";
2086  }
2087 }
2088 
2089 /**
2090  * @brief @ref NmeaMessageType stream operator.
2091  * @ingroup io_interfaces
2092  */
2094  stream << to_string(val) << " (" << (int)val << ")";
2095  return stream;
2096 }
2097 
2098 /**
2099  * @brief The output rate for a message type on an interface.
2100  * @ingroup io_interfaces
2101  */
2102 enum class MessageRate : uint8_t {
2103  /**
2104  * Disable output of this message.
2105  */
2106  OFF = 0,
2107  /**
2108  * Output this message each time a new value is available.
2109  */
2110  ON_CHANGE = 1,
2111  /** Alias for @ref MessageRate::ON_CHANGE. */
2112  MAX_RATE = 1,
2113  /**
2114  * Output this message every 10 milliseconds. Not supported for all messages
2115  * or platforms.
2116  */
2117  INTERVAL_10_MS = 2,
2118  /**
2119  * Output this message every 20 milliseconds. Not supported for all messages
2120  * or platforms.
2121  */
2122  INTERVAL_20_MS = 3,
2123  /**
2124  * Output this message every 40 milliseconds. Not supported for all messages
2125  * or platforms.
2126  */
2127  INTERVAL_40_MS = 4,
2128  /**
2129  * Output this message every 50 milliseconds. Not supported for all messages
2130  * or platforms.
2131  */
2132  INTERVAL_50_MS = 5,
2133  /**
2134  * Output this message every 100 milliseconds. Not supported for all messages
2135  * or platforms.
2136  */
2137  INTERVAL_100_MS = 6,
2138  /**
2139  * Output this message every 200 milliseconds. Not supported for all messages
2140  * or platforms.
2141  */
2142  INTERVAL_200_MS = 7,
2143  /**
2144  * Output this message every 500 milliseconds. Not supported for all messages
2145  * or platforms.
2146  */
2147  INTERVAL_500_MS = 8,
2148  /**
2149  * Output this message every second. Not supported for all messages or
2150  * platforms.
2151  */
2152  INTERVAL_1_S = 9,
2153  /**
2154  * Output this message every 2 seconds. Not supported for all messages or
2155  * platforms.
2156  */
2157  INTERVAL_2_S = 10,
2158  /**
2159  * Output this message every 5 seconds. Not supported for all messages or
2160  * platforms.
2161  */
2162  INTERVAL_5_S = 11,
2163  /**
2164  * Output this message every 10 seconds. Not supported for all messages or
2165  * platforms.
2166  */
2167  INTERVAL_10_S = 12,
2168  /**
2169  * Output this message every 30 seconds. Not supported for all messages or
2170  * platforms.
2171  */
2172  INTERVAL_30_S = 13,
2173  /**
2174  * Output this message every 60 seconds. Not supported for all messages or
2175  * platforms.
2176  */
2177  INTERVAL_60_S = 14,
2178  /**
2179  * Restore this message's rate back to its default value.
2180  */
2181  DEFAULT = 255
2182 };
2183 
2184 /**
2185  * @brief Get a human-friendly string name for the specified @ref
2186  * MessageRate.
2187  * @ingroup io_interfaces
2188  *
2189  * @param value The enum to get the string name for.
2190  *
2191  * @return The corresponding string name.
2192  */
2194  switch (value) {
2195  case MessageRate::OFF:
2196  return "OFF";
2198  return "ON_CHANGE";
2200  return "INTERVAL_10_MS";
2202  return "INTERVAL_20_MS";
2204  return "INTERVAL_40_MS";
2206  return "INTERVAL_50_MS";
2208  return "INTERVAL_100_MS";
2210  return "INTERVAL_200_MS";
2212  return "INTERVAL_500_MS";
2214  return "INTERVAL_1_S";
2216  return "INTERVAL_2_S";
2218  return "INTERVAL_5_S";
2220  return "INTERVAL_10_S";
2222  return "INTERVAL_30_S";
2224  return "INTERVAL_60_S";
2225  case MessageRate::DEFAULT:
2226  return "DEFAULT";
2227  default:
2228  return "Unrecognized";
2229  }
2230 }
2231 
2232 /**
2233  * @brief @ref MessageRate stream operator.
2234  * @ingroup io_interfaces
2235  */
2237  stream << to_string(val) << " (" << (int)val << ")";
2238  return stream;
2239 }
2240 
2241 /**
2242  * @brief I/O interface parameter configuration submessage (used when sending
2243  * a @ref SetConfigMessage or @ref GetConfigMessage for @ref
2244  * ConfigType::INTERFACE_CONFIG).
2245  * @ingroup io_interfaces
2246  *
2247  * In @ref SetConfigMessage, @ref GetConfigMessage, and @ref
2248  * ConfigResponseMessage, this struct can be used to access settings
2249  * associated with a a particular I/O interface. For example, to set the
2250  * baudrate for serial port 1:
2251  *
2252  * ```
2253  * {
2254  * SetConfigMessage(
2255  * config_type=INTERFACE_CONFIG),
2256  * InterfaceConfigSubmessage(
2257  * interface=InterfaceID(TransportType::SERIAL, 1),
2258  * subtype=BAUD_RATE),
2259  * uint32_t 115200
2260  * }
2261  * ```
2262  *
2263  * This message must be followed by the parameter value to be used:
2264  *
2265  * ```
2266  * {MessageHeader, SetConfigMessage, InterfaceConfigSubmessage, Parameter}
2267  * ```
2268  *
2269  * See @ref InterfaceConfigType for a complete list of parameters and their
2270  * data formats.
2271  */
2273  /**
2274  * The ID of the interface to be configured or queried.
2275  *
2276  * @note
2277  * TransportType::ALL is not supported.
2278  */
2280 
2281  /**
2282  * The interface setting to get or set.
2283  */
2285 
2286  uint8_t reserved[3] = {0};
2287 };
2288 
2289 /**
2290  * @brief Set the output rate for the requested message types (@ref
2291  * MessageType::SET_MESSAGE_RATE, version 1.0).
2292  * @ingroup io_interfaces
2293  *
2294  * Multiple message rates can be configured with a single command if wild cards
2295  * are used for the interface, protocol, or message ID. When multiple messages
2296  * are specified, the following behaviors apply:
2297  * - Messages that are currently @ref MessageRate::OFF will not be changed
2298  * unless the @ref FLAG_INCLUDE_DISABLED_MESSAGES bit is set in the @ref flags
2299  * or the new rate is @ref MessageRate::DEFAULT.
2300  * - If the rate is an interval, it will only affect the messages that support
2301  * being rate controlled.
2302  *
2303  * Setting all the messages on an interface to @ref MessageRate::DEFAULT will
2304  * also restore the default `*_OUTPUT_DIAGNOSTICS_MESSAGES` configuration option
2305  * value for that interface. See @ref ConfigType.
2306  *
2307  * @note
2308  * When specifying @ref ProtocolType::ALL, message ID @ref ALL_MESSAGES_ID must
2309  * also be specified. Further, the rate must be set to either
2310  * @ref MessageRate::OFF or @ref MessageRate::DEFAULT.
2311  *
2312  * @section set_rate_examples Typical Use Cases
2313  *
2314  * @subsection set_rate_restore Restore Default Settings For All Messages
2315  *
2316  * To restore the default configuration on UART1 for all message types across all
2317  * supported protocols, specify the following:
2318  * - Interface transport type: @ref TransportType::SERIAL
2319  * - Interface index: 1
2320  * - Protocol: @ref ProtocolType::ALL
2321  * - Message ID: @ref ALL_MESSAGES_ID
2322  * - Rate: @ref MessageRate::DEFAULT
2323  *
2324  * @subsection set_rate_restore_nmea Restore Default Settings For All NMEA
2325  *
2326  * To restore the default configuration on UART1 for all NMEA message types,
2327  * specify the following:
2328  * - Interface transport type: @ref TransportType::SERIAL
2329  * - Interface index: 1
2330  * - Protocol: @ref ProtocolType::NMEA
2331  * - Message ID: @ref ALL_MESSAGES_ID
2332  * - Rate: @ref MessageRate::DEFAULT
2333  *
2334  * @subsection set_rate_change_nmea Change UART1 Output Rate To 1 Hz:
2335  *
2336  * To change the rate of all NMEA message types to 1 Hz on UART1, specify the
2337  * following:
2338  * - Interface transport type: @ref TransportType::SERIAL
2339  * - Interface index: 1
2340  * - Protocol: @ref ProtocolType::NMEA
2341  * - Message ID: @ref ALL_MESSAGES_ID
2342  * - Rate: @ref MessageRate::INTERVAL_1_S
2343  *
2344  * @note
2345  * Note that this will not affect any message types that are not rate controlled
2346  * (e.g., @ref MessageType::EVENT_NOTIFICATION).
2347  *
2348  * @subsection set_rate_off_all Change The Uart1 Output Rates For All Messages To Be Off:
2349  *
2350  * To change the rate of all messages to their max rate on UART1, specify the
2351  * following:
2352  * - Interface transport type: @ref TransportType::SERIAL
2353  * - Interface index: 1
2354  * - Protocol: @ref ProtocolType::ALL
2355  * - flags: @ref FLAG_INCLUDE_DISABLED_MESSAGES
2356  * - Message ID: @ref ALL_MESSAGES_ID
2357  * - Rate: @ref MessageRate::OFF
2358  *
2359  * @note
2360  * This will disable every message.
2361  *
2362  * @subsection set_and_save_rate_off_all Change And Save The UART1 Output Rates For All Messages To Be Off:
2363  *
2364  * To change the rate of all messages to their max rate on UART1, specify the
2365  * following:
2366  * - Interface transport type: @ref TransportType::SERIAL
2367  * - Interface index: 1
2368  * - Protocol: @ref ProtocolType::ALL
2369  * - flags: 0x03 (@ref FLAG_INCLUDE_DISABLED_MESSAGES | @ref FLAG_APPLY_AND_SAVE)
2370  * - Message ID: @ref ALL_MESSAGES_ID
2371  * - Rate: @ref MessageRate::OFF
2372  *
2373  * @note
2374  * Both of the bit flags are set for this message. This will cause the
2375  * configuration to be saved to non-volatile memory.
2376  *
2377  * # Expected Response
2378  * The device will respond with a @ref CommandResponseMessage indicating whether
2379  * or not the request succeeded.
2380  */
2382  static constexpr MessageType MESSAGE_TYPE = MessageType::SET_MESSAGE_RATE;
2383  static constexpr uint8_t MESSAGE_VERSION = 0;
2384 
2385  /** Flag to immediately save the config after applying this setting. */
2386  static constexpr uint8_t FLAG_APPLY_AND_SAVE = 0x01;
2387 
2388  /**
2389  * Flag to apply bulk interval changes to all messages instead of just
2390  * enabled messages.
2391  */
2392  static constexpr uint8_t FLAG_INCLUDE_DISABLED_MESSAGES = 0x02;
2393 
2394  /**
2395  * The output interface to configure. If @ref TransportType::ALL, set rates on
2396  * all supported interfaces.
2397  */
2399 
2400  /**
2401  * The message protocol being configured. If @ref ProtocolType::ALL, set rates
2402  * on all supported protocols.
2403  */
2405 
2406  /** Bitmask of additional flags to modify the command. */
2407  uint8_t flags = 0;
2408 
2409  /**
2410  * The ID of the desired message type (e.g., 10000 for FusionEngine
2411  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
2412  * messages. If @ref ALL_MESSAGES_ID, set the rate for all messages on the
2413  * selected interface and protocol.
2414  */
2415  uint16_t message_id = ALL_MESSAGES_ID;
2416 
2417  /** The desired message rate. */
2419 
2420  uint8_t reserved2[3] = {0};
2421 };
2422 
2423 /**
2424  * @brief Get the configured output rate for the he requested message type on
2425  * the specified interface (@ref MessageType::GET_MESSAGE_RATE,
2426  * version 1.0).
2427  * @ingroup io_interfaces
2428  *
2429  * Multiple message rates can be requested with a single command if wild cards
2430  * are used for the protocol, or message ID.
2431  *
2432  * # Expected Response
2433  * The device will respond with a @ref MessageRateResponse containing the
2434  * requested values or an error @ref Response value if the request did not
2435  * succeed.
2436  */
2438  static constexpr MessageType MESSAGE_TYPE = MessageType::GET_MESSAGE_RATE;
2439  static constexpr uint8_t MESSAGE_VERSION = 0;
2440 
2441  /**
2442  * The output interface to be queried.
2443  *
2444  * @ref TransportType::ALL is not supported. To query for multiple transports,
2445  * send separate requests.
2446  */
2448 
2449  /**
2450  * The desired message protocol. If @ref ProtocolType::ALL, return the current
2451  * settings for all supported protocols.
2452  */
2454 
2455  /** The source of the parameter value (active, saved, etc.). */
2457 
2458  /**
2459  * The ID of the desired message type (e.g., 10000 for FusionEngine
2460  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
2461  * messages. If @ref ALL_MESSAGES_ID, return the current settings for all
2462  * supported messages on the selected interface and protocol.
2463  */
2464  uint16_t message_id = ALL_MESSAGES_ID;
2465 };
2466 
2467 /**
2468  * @brief A list of transport interfaces supported by the device (@ref
2469  * MessageType::SUPPORTED_IO_INTERFACES, version 1.0).
2470  * @ingroup io_interfaces
2471  */
2473  static constexpr MessageType MESSAGE_TYPE =
2475  static constexpr uint8_t MESSAGE_VERSION = 0;
2476 
2477  /** The number of interfaces reported by this message. */
2478  uint8_t num_interfaces = 0;
2479 
2480  uint8_t reserved1[7] = {0};
2481 
2482  /** This is followed `num_interfaces` @ref InterfaceID elements. */
2483  // InterfaceID interfaces[num_interfaces]
2484 };
2485 
2486 /**
2487  * @brief An element of a @ref MessageRateResponse message.
2488  * @ingroup io_interfaces
2489  */
2491  /**
2492  * Flag to indicate the active value for this configuration differs from the
2493  * value saved to persistent memory.
2494  */
2495  static constexpr uint8_t FLAG_ACTIVE_DIFFERS_FROM_SAVED = 0x1;
2496 
2497  /** The protocol of the message being returned. */
2499 
2500  /** Flags that describe the entry. */
2501  uint8_t flags = 0;
2502 
2503  /**
2504  * The ID of the returned message type (e.g., 10000 for FusionEngine
2505  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
2506  * messages.
2507  */
2508  uint16_t message_id = 0;
2509 
2510  /** The current configuration for this message. */
2511  MessageRate configured_rate = MessageRate::OFF;
2512 
2513  /**
2514  * The currently active output rate for this message, factoring in effects of
2515  * additional configuration settings that may override the configured rate
2516  * such as enabling diagnostic output.
2517  */
2518  MessageRate effective_rate = MessageRate::OFF;
2519 
2520  uint8_t reserved1[2] = {0};
2521 };
2522 
2523 /**
2524  * @brief Response to a @ref GetMessageRate request (@ref
2525  * MessageType::MESSAGE_RATE_RESPONSE, version 1.1).
2526  * @ingroup io_interfaces
2527  *
2528  * This message will be followed by @ref num_rates @ref MessageRateResponseEntry
2529  * elements:
2530  *
2531  * ```
2532  * {MessageHeader, MessageRateResponse, MessageRateResponseEntry[num_rates]}
2533  * ```
2534  */
2536  static constexpr MessageType MESSAGE_TYPE =
2538  static constexpr uint8_t MESSAGE_VERSION = 1;
2539 
2540  /** The source of the parameter value (active, saved, etc.). */
2542 
2543  /** The response status (success, error, etc.). */
2545 
2546  /** The number of rates reported by this message. */
2547  uint16_t num_rates = 0;
2548 
2549  /** The output interface corresponding with this response. */
2550  InterfaceID output_interface = {};
2551 };
2552 
2553 /**************************************************************************/ /**
2554  * @defgroup gnss_corrections_control GNSS Corrections Control
2555  * @brief Messages for enabling/disabling GNSS corrections sources.
2556  * @ingroup config_and_ctrl_messages
2557  ******************************************************************************/
2558 
2559 /**
2560  * @brief L-band demodulator configuration parameters.
2561  * @ingroup gnss_corrections_control
2562  */
2564  /**
2565  * The center frequency of the L-band beam (Hz).
2566  */
2567  double center_frequency_hz = 1555492500.0;
2568 
2569  /**
2570  * The size of the signal acquisition search space (in Hz) around the center
2571  * frequency.
2572  *
2573  * For example, a value of 6000 will search +/- 3 kHz around the center
2574  * frequency.
2575  */
2576  float search_window_hz = 2000.0;
2577 
2578  /**
2579  * If `true`, only output data frames with the configured service ID.
2580  * Otherwise, output all decoded frames.
2581  */
2582  bool filter_data_by_service_id = true;
2583 
2584  /** Enable/disable the descrambler. */
2585  bool use_descrambler = true;
2586 
2587  /** Service ID of the provider. */
2588  uint16_t pmp_service_id = 0x5555;
2589 
2590  /** Unique word of the provider. */
2591  uint64_t pmp_unique_word = 0xE15AE893E15AE893ull;
2592 
2593  /** Data rate of the provider (bps). */
2594  uint16_t pmp_data_rate_bps = 4800;
2595 
2596  /** The initialization value for the descrambling vector. */
2597  uint16_t descrambler_init = 0x6969;
2598 };
2599 
2600 #pragma pack(pop)
2601 
2602 } // namespace messages
2603 } // namespace fusion_engine
2604 } // namespace point_one
@ INTERVAL_1_S
Output this message every second.
@ OFF
Tropospheric delay model disabled.
@ AUDI_Q7
@ INTERVAL_5_S
Output this message every 5 seconds.
P1_CONSTEXPR_FUNC InterfaceID()=default
@ IMPORT_DATA
ImportDataMessage
@ AUTO
Select the best available ionospheric delay model.
@ PQTMGNSS
@ ALL
Set/get the configuration for the all I/O interfaces.
@ WHEEL_SPEED
Individual speed measurements for multiple wheels, reported in meters/second.
@ FRONT_WHEELS
Front wheel speed data to be applied to the system.
ConfigurationSource
The type of a device's configuration settings.
@ INTERVAL_50_MS
Output this message every 50 milliseconds.
A 3-dimensional vector (used for lever arms, etc.).
P1_CONSTEXPR_FUNC InterfaceID(TransportType type, uint8_t index=0)
Identifier for an I/O interface.
@ FORWARD_ACTIVE_HIGH
Assume vehicle is moving forward when direction signal voltage is high, and backward when direction s...
TransportType type
The interface's transport type.
@ VEHICLE_DETAILS
Information about the vehicle including model and dimensions.
MessageType
Identifiers for the defined output message types.
Definition: defs.h:34
@ DEVICE_LEVER_ARM
The location of the device IMU with respect to the vehicle body frame, resolved in the vehicle body f...
@ NONE
Wheel/vehicle speed data not available.
Library portability helper definitions.
@ INTERVAL_100_MS
Output this message every 100 milliseconds.
@ INVALID
Response to a GetConfigMessage request (MessageType::CONFIG_RESPONSE, version 1.0).
@ ENABLED
Enable/disable the interface.
@ OK
@ RMC
@ USER_CONFIG
TropoDelayModel
The tropospheric delay model to use.
The orientation of a device with respect to the vehicle body axes.
@ BMW_MOTORRAD
@ UNIX
A UNIX domain socket client or server.
Hardware wheel tick encoder configuration settings.
P1_CONSTEXPR_FUNC const char * to_string(ConfigType type)
Get a human-friendly string name for the specified ConfigType.
Tropospheric delay model configuration.
VehicleModel
The make and model of the vehicle.
@ MAN_TGX
@ P1CALSTATUS
@ AUDI_A8L
@ GNSS_AUX_LEVER_ARM
The location of the secondary GNSS antenna with respect to the vehicle body frame on a dual-antenna p...
#define P1_ALIGNAS(N)
Definition: portability.h:57
@ HARDWARE_TICK_CONFIG
Indicates the mode and direction used when capturing vehicle wheel tick data from a voltage pulse on ...
@ OFF
Wheel tick capture disabled.
@ OFF
Disable output of this message.
@ REMOTE_ADDRESS
Configure the network address for a client to connect to.
@ SAASTAMOINEN
Use the Saastamoinen tropospheric model.
@ DATAGRAM
Operate in datagram mode, preserving message boundaries but not maintaining client connections (simil...
@ PEUGEOT_206
@ P1MSG
@ SUPPORTED_IO_INTERFACES
SupportedIOInterfacesMessage
@ REVERT_TO_SAVED
Revert the active configuration to previously saved values.
@ RIVIAN
Response to a GetMessageRate request (MessageType::MESSAGE_RATE_RESPONSE, version 1....
@ FRONT
Front wheels are steered.
@ FALLING_EDGE
Capture a wheel tick on the falling edge of the incoming pulse.
@ DATASPEED_CD4
MessageRate
The output rate for a message type on an interface.
@ INTERVAL_60_S
Output this message every 60 seconds.
@ PQTMTXT
@ FRONT_AND_REAR
Front and rear wheels are steered.
@ PQTMVERNO_SUB
Information about the vehicle including model and dimensions.
@ INVALID
@ GGA
@ REVERT_TO_DEFAULT
Reset the active and saved configuration to default values.
AppliedSpeedType
The type of vehicle/wheel speed measurements to be applied.
@ SAVED
Settings currently saved to persistent storage.
@ DIRECTION
Set the interface direction (client/server).
@ VTG
@ UNKNOWN
Steered wheels unknown.
Set the output rate for the requested message types (MessageType::SET_MESSAGE_RATE,...
@ KIA_SORENTO
I/O interface parameter configuration submessage (used when sending a SetConfigMessage or GetConfigMe...
@ SERIAL
A serial data interface (e.g.
@ SBAS
Use the SBAS ionospheric model.
Import data from the host to the device (MessageType::IMPORT_DATA, version 1.0).
@ MESSAGE_RATE_RESPONSE
MessageRateResponse
@ SAVE_CONFIG
SaveConfigMessage
@ STREAM
Operate in connection-oriented streaming mode and do not preserve message boundaries (similar to TCP)...
@ INVALID
@ FILE
A interface that writes to a file.
@ GLL
@ HYUNDAI_ELANTRA
P1_CONSTEXPR_FUNC bool operator<(const InterfaceID &other) const
P1_CONSTEXPR_FUNC bool operator!=(const InterfaceID &other) const
@ RISING_EDGE
Capture a wheel tick on the rising edge of the incoming pulse.
@ REAR_WHEELS
Rear wheel speed data to be applied to the system (recommended).
The base class for all message payloads.
Definition: defs.h:687
@ VEHICLE_TICKS
A single wheel rotational angle, reported as accumulated encoder ticks.
Query the value of a user configuration parameter (MessageType::GET_CONFIG, version 1....
@ J1939
@ DEFAULT
Restore this message's rate back to its default value.
@ IONOSPHERE_CONFIG
Ionospheric delay model configuration.
@ INTERVAL_20_MS
Output this message every 20 milliseconds.
TickMode
The signal edge to use when capturing a wheel tick voltage signal.
@ INTERFACE_CONFIG
Change a configuration setting for a specified output interface.
@ ENABLED_GNSS_FREQUENCY_BANDS
A bitmask indicating which GNSS frequency bands are enabled.
@ LBAND_PARAMETERS
Configuration of L-band Demodulator Parameters.
@ OFF
Wheel tick direction not provided.
@ FRONT_AND_REAR_WHEELS
Front and rear wheel speed data to be applied to the system.
@ UNKNOWN_VEHICLE
@ OUTPUT_LEVER_ARM
The offset of the desired output location with respect to the vehicle body frame, resolved in the veh...
GNSS signal and frequency type definitions.
Definition: logging.h:38
Get the configured output rate for the he requested message type on the specified interface (MessageT...
Export data from the device (MessageType::EXPORT_DATA, version 1.0).
@ UDP
A UDP client or server.
DataVersion data_version
Version of data contents.
@ DEVICE_COARSE_ORIENTATION
The orientation of the device IMU with respect to the vehicle body axes.
@ TCP
A TCP client or server.
@ TROPOSPHERE_CONFIG
Tropospheric delay model configuration.
uint8_t index
An identifier for the instance of this transport.
P1_CONSTEXPR_FUNC bool operator>(const InterfaceID &other) const
@ DEFAULT
Read only device defaults.
ConfigType
An identifier for the contents of a parameter configuration message.
Definition: configuration.h:37
@ GPS_WEEK_ROLLOVER
Specify a GPS legacy week rollover count override to use when converting all legacy 10-bit GPS week n...
@ WHEEL_CONFIG
Information pertaining to wheel speed/rotation measurements when wheel data is transmitted via softwa...
P1_CONSTEXPR_FUNC bool operator<=(const InterfaceID &other) const
@ PQTMVER
@ GNSS_LEVER_ARM
The location of the primary GNSS antenna with respect to the vehicle body frame, resolved in the vehi...
WheelSensorType
The type of vehicle/wheel speed measurements produced by the vehicle.
@ INVALID
@ UART2_BAUD
Configure the UART2 serial baud rate (in bits/second).
Direction
SaveAction
The type configuration save operation to be performed.
@ GET_MESSAGE_RATE
GetMessageRate
@ NONE
Speed data not applied to the system.
@ BAUD_RATE
Configure the serial baud rate (in bits/second).
@ INVALID
@ ENABLED_GNSS_SYSTEMS
A bitmask indicating which GNSS constellations are enabled.
std::ostream p1_ostream
Definition: portability.h:75
ConfigType config_type
The type of parameter to be configured.
Response
Command response status indicators.
Definition: defs.h:406
A list of transport interfaces supported by the device (MessageType::SUPPORTED_IO_INTERFACES,...
@ SOCKET_TYPE
Set the UNIX domain socket type (streaming/datagram/sequenced).
@ EXPORT_DATA
ExportDataMessage
@ FLEXRAY_DEVICE_AUDI_ETRON
@ GSA
@ PROFILING_MASK
A bitmask indicating which profiling features are enabled.
@ SAVE
Save all active parameters to persistent storage.
@ UART2_OUTPUT_DIAGNOSTICS_MESSAGES
Enable/disable output of diagnostic data on UART2.
@ MAX_RATE
Alias for MessageRate::ON_CHANGE.
p1_ostream & operator<<(p1_ostream &stream, ConfigType type)
ConfigType stream operator.
TickDirection
The way to interpret an incoming voltage signal, used to indicate direction of a hardware wheel tick ...
@ ENABLE_WATCHDOG_TIMER
Enable watchdog timer to restart device after fatal errors.
@ CALIBRATION_STATE
An element of a MessageRateResponse message.
NmeaMessageType
Integer ID for NMEA messages.
@ INTERVAL_500_MS
Output this message every 500 milliseconds.
DataType
Type of data stored on device.
@ SET_MESSAGE_RATE
SetMessageRate
@ FUSION_ENGINE
@ CURRENT
Set/get the configuration for the interface on which the command was received.
Save or reload configuration settings (MessageType::SAVE_CONFIG, version 1.0).
@ INTERVAL_10_S
Output this message every 10 seconds.
InterfaceConfigType
An identifier for the contents of a output interface configuration submessage.
@ RTCM
@ OFF
Ionospheric delay model disabled.
#define P1_CONSTEXPR_FUNC
Definition: portability.h:105
L-band demodulator configuration parameters.
Set a user configuration parameter (MessageType::SET_CONFIG, version 1.0).
ProtocolType
The framing protocol of a message.
Message for reporting platform storage data (MessageType::PLATFORM_STORAGE_DATA, version 1....
@ INVALID
@ CLIENT
A client connecting to a specified remote server.
@ INVALID
TransportType
Type of I/O interface transport.
@ WEBSOCKET
A WebSocket client or server.
@ FACTION
TransportDirection
The direction (client/server) for an individual interface.
@ INVALID
@ GET_CONFIG
GetConfigMessage
@ OUTPUT_DIAGNOSTICS_MESSAGES
Enable/disable output of diagnostic data on this interface.
@ ZDA
@ CRASH_LOG
@ PQTMVER_SUB
@ SERVER
A server listening for one or more incoming remote connections.
@ SET_CONFIG
SetConfigMessage
@ TICKS
Individual rotational angle measurements for multiple wheels, reported as accumulated encoder ticks.
@ ON_CHANGE
Output this message each time a new value is available.
@ VEHICLE_SPEED
A single value indicating the vehicle speed (in meters/second).
@ NMEA
@ KLOBUCHAR
Use the Klobuchar ionospheric model.
@ LEAP_SECOND
Specify a UTC leap second count override value to use for all UTC time conversions.
@ ACTIVE
Active configuration currently in use by the device.
P1_CONSTEXPR_FUNC bool operator==(const InterfaceID &other) const
@ FORWARD
The vehicle is in a forward gear.
SteeringType
Indication of which of the vehicle's wheels are steered.
Point One FusionEngine output message common definitions.
@ GSV
Software vehicle/wheel speed measurement configuration settings.
@ INTERVAL_2_S
Output this message every 2 seconds.
@ SEQPACKET
Operate in sequenced packet mode, which is both connection-oriented and preserves message boundaries.
Ionospheric delay model configuration.
@ LINCOLN_MKZ
@ PLATFORM_STORAGE_DATA
PlatformStorageDataMessage
IonoDelayModel
The ionospheric delay model to use.
@ FACTION_V2
@ BMW_7
@ ALL
This is used for requesting the configuration for all protocols.
@ PQTMVERNO
SocketType
The socket type specifying how data is transmitted for UNIX domain sockets.
DataVersion data_version
Version of data contents.
@ INTERVAL_30_S
Output this message every 30 seconds.
@ DEPRECATED_HEADING_BIAS
Used to set horizontal (yaw) & vertical (pitch) biases (in degrees) on a dual-antenna heading platfor...
@ AUTO
Select the best available tropospheric delay model.
@ UART1_OUTPUT_DIAGNOSTICS_MESSAGES
Enable/disable output of diagnostic data on UART1.
@ KIA_SPORTAGE
@ TESLA_MODEL_X
@ FORWARD_ACTIVE_LOW
Assume vehicle is moving forward when direction signal voltage is low, and backward when direction si...
@ LEXUS_CT200H
@ INTERVAL_40_MS
Output this message every 40 milliseconds.
@ FILTER_STATE
A struct representing the version of a data object.
Definition: data_version.h:24
@ INTERVAL_200_MS
Output this message every 200 milliseconds.
P1_CONSTEXPR_FUNC bool operator>=(const InterfaceID &other) const
@ PORT
Configure the network port.
@ TESLA_MODEL_3
constexpr uint16_t ALL_MESSAGES_ID
Setting message_id to this value acts as a wild card.
@ INTERVAL_10_MS
Output this message every 10 milliseconds.
@ VW_4
@ VEHICLE_BODY
Individual vehicle speed to be applied to the system.
@ UART1_BAUD
Configure the UART1 serial baud rate (in bits/second).
@ USER_DEVICE_ID
A string for identifying a device.
@ CONFIG_RESPONSE
ConfigResponseMessage