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  return "Unrecognized Configuration";
363 }
364 
365 /**
366  * @brief @ref ConfigType stream operator.
367  * @ingroup config_types
368  */
369 inline p1_ostream& operator<<(p1_ostream& stream, ConfigType type) {
370  stream << to_string(type) << " (" << (int)type << ")";
371  return stream;
372 }
373 
374 /**
375  * @brief The type of a device's configuration settings.
376  * @ingroup config_types
377  */
378 enum class ConfigurationSource : uint8_t {
379  ACTIVE = 0, ///< Active configuration currently in use by the device.
380  SAVED = 1, ///< Settings currently saved to persistent storage.
381  /**
382  * Read only device defaults. Attempting to write to this source will fail
383  * with a @ref Response::VALUE_ERROR.
384  */
385  DEFAULT = 2,
386 };
387 
388 /**
389  * @brief Get a human-friendly string name for the specified @ref
390  * ConfigurationSource.
391  * @ingroup config_types
392  *
393  * @param source The desired configuration source.
394  *
395  * @return The corresponding string name.
396  */
398  switch (source) {
400  return "Active";
401 
403  return "Saved";
404 
406  return "Default";
407  }
408 
409  return "Unrecognized Source";
410 }
411 
412 /**
413  * @brief @ref ConfigurationSource stream operator.
414  * @ingroup config_types
415  */
417  stream << to_string(source) << " (" << (int)source << ")";
418  return stream;
419 }
420 
421 /**
422  * @brief The type configuration save operation to be performed.
423  * @ingroup config_types
424  */
425 enum class SaveAction : uint8_t {
426  /** Save all active parameters to persistent storage. */
427  SAVE = 0,
428  /** Revert the active configuration to previously saved values. */
429  REVERT_TO_SAVED = 1,
430  /** Reset the active _and_ saved configuration to default values. */
431  REVERT_TO_DEFAULT = 2,
432 };
433 
434 /**
435  * @brief Get a human-friendly string name for the specified @ref SaveAction.
436  * @ingroup config_types
437  *
438  * @param action The desired save operation.
439  *
440  * @return The corresponding string name.
441  */
443  switch (action) {
444  case SaveAction::SAVE:
445  return "Save";
446 
448  return "Revert To Saved";
449 
451  return "Revert To Default";
452  }
453 
454  return "Unrecognized";
455 }
456 
457 /**
458  * @brief @ref SaveAction stream operator.
459  * @ingroup config_types
460  */
461 inline p1_ostream& operator<<(p1_ostream& stream, SaveAction action) {
462  stream << to_string(action) << " (" << (int)action << ")";
463  return stream;
464 }
465 
466 /**
467  * @brief Set a user configuration parameter (@ref MessageType::SET_CONFIG,
468  * version 1.0).
469  * @ingroup config_types
470  *
471  * This message must be followed by the parameter value to be used:
472  *
473  * ```
474  * {MessageHeader, SetConfigMessage, Parameter[data_length_bytes]}
475  * ```
476  *
477  * The format of the parameter value is defined by the the specified @ref
478  * config_type (@ref ConfigType). For example, an antenna lever arm definition
479  * may require three 32-bit `float` values, one for each axis, while a serial
480  * port baud rate may be specified as single 32-bit unsigned integer
481  * (`uint32_t`).
482  *
483  * Not all parameters defined in @ref ConfigType are supported on all devices.
484  *
485  * Parameter changes are applied to the device's active configuration
486  * immediately, but are not saved to persistent storage and will be restored to
487  * their previous values on reset. To save configuration settings to persistent
488  * storage, see @ref SaveConfigMessage.
489  *
490  * # Expected Response
491  * The device will respond with a @ref CommandResponseMessage indicating whether
492  * or not the request succeeded.
493  */
495  static constexpr MessageType MESSAGE_TYPE = MessageType::SET_CONFIG;
496  static constexpr uint8_t MESSAGE_VERSION = 0;
497 
498  /** Flag to immediately save the config after applying this setting. */
499  static constexpr uint8_t FLAG_APPLY_AND_SAVE = 0x01;
500  /**
501  * Flag to restore the config_type back to its default value.
502  *
503  * When set, the @ref config_length_bytes should be 0 and no data should be
504  * included unless the config_type is @ref ConfigType::INTERFACE_CONFIG. In
505  * that case the @ref config_length_bytes should be
506  * `sizeof(InterfaceConfigSubmessage)` with a an @ref
507  * InterfaceConfigSubmessage as the parameter value without any further
508  * payload.
509  */
510  static constexpr uint8_t FLAG_REVERT_TO_DEFAULT = 0x02;
511 
512  /** The type of parameter to be configured. */
514 
515  /** Bitmask of additional flags to modify the command. */
516  uint8_t flags = 0;
517 
518  uint8_t reserved[1] = {0};
519 
520  /** The size of the parameter value (in bytes). */
521  uint32_t config_length_bytes = 0;
522 };
523 
524 /**
525  * @brief Query the value of a user configuration parameter (@ref
526  * MessageType::GET_CONFIG, version 1.1).
527  * @ingroup config_types
528  *
529  * # Expected Response
530  * The device will respond with a @ref ConfigResponseMessage containing the
531  * requested parameter value or an error @ref Response value if the request did
532  * not succeed.
533  */
535  static constexpr MessageType MESSAGE_TYPE = MessageType::GET_CONFIG;
536  static constexpr uint8_t MESSAGE_VERSION = 1;
537 
538  /** The desired parameter. */
540 
541  /** The config source to request data from (active, saved, etc.). */
543 
544  uint8_t reserved[1] = {0};
545 
546  /**
547  * When @ref config_type is @ref ConfigType::INTERFACE_CONFIG, a @ref
548  * InterfaceConfigSubmessage must be added to the end of this message with
549  * empty @ref InterfaceConfigSubmessage::config_data.
550  */
551  //uint8_t optional_submessage_header[0];
552 };
553 
554 /**
555  * @brief Save or reload configuration settings (@ref MessageType::SAVE_CONFIG,
556  * version 1.0).
557  * @ingroup config_types
558  *
559  * # Expected Response
560  * The device will respond with a @ref CommandResponseMessage indicating whether
561  * or not the request succeeded.
562  */
564  static constexpr MessageType MESSAGE_TYPE = MessageType::SAVE_CONFIG;
565  static constexpr uint8_t MESSAGE_VERSION = 0;
566 
567  /** The action to performed. */
569 
570  uint8_t reserved[3] = {0};
571 };
572 
573 /**
574  * @brief Response to a @ref GetConfigMessage request (@ref
575  * MessageType::CONFIG_RESPONSE, version 1.0).
576  * @ingroup config_types
577  *
578  * This message is followed by `N` bytes, where `N` is equal to @ref
579  * config_length_bytes that make up the data associated with @ref config_type.
580  * For example if the @ref config_type is @ref ConfigType::UART1_BAUD, the
581  * payload will include a single 32-bit unsigned integer:
582  *
583  * ```
584  * {MessageHeader, ConfigResponseMessage, uint32_t}
585  * ```
586  *
587  * The @ref response field will indicate the status of the requested value. If
588  * the response is not @ref Response::OK, the parameter value may be omitted and
589  * @ref config_length_bytes will be set to 0.
590  *
591  * In response to a @ref GetConfigMessage with an invalid or unsupported @ref
592  * ConfigType, @ref config_type in the resulting @ref ConfigResponseMessage will
593  * be set to @ref ConfigType::INVALID, and @ref response will indicate the
594  * reason. Note that all @ref GetConfigMessage requests, including invalid and
595  * rejected requests, will receive a @ref ConfigResponseMessage, not a
596  * @ref CommandResponseMessage.
597  */
599  static constexpr MessageType MESSAGE_TYPE = MessageType::CONFIG_RESPONSE;
600  static constexpr uint8_t MESSAGE_VERSION = 0;
601 
602  /**
603  * Flag to indicate the active value for this configuration differs from the
604  * value saved to persistent memory.
605  */
606  static constexpr uint8_t FLAG_ACTIVE_DIFFERS_FROM_SAVED = 0x1;
607 
608  /** The source of the parameter value (active, saved, etc.). */
610 
611  /** Flags that describe the configuration parameter. */
612  uint8_t flags = 0;
613 
614  /** The type of configuration parameter contained in this message. */
616 
617  /** The response status (success, error, etc.). */
618  Response response = Response::OK;
619 
620  uint8_t reserved[3] = {0};
621 
622  /** The size of the parameter value (in bytes). */
623  uint32_t config_length_bytes = 0;
624 
625  /**
626  * A pointer to the beginning of the configuration parameter value.
627  *
628  * The size and format of the contents is specified by the @ref config_type.
629  * See @ref ConfigType.
630  */
631  //uint8_t config_change_data[0];
632 };
633 
634 /**
635  * @brief A 3-dimensional vector (used for lever arms, etc.).
636  * @ingroup config_types
637  */
638 struct P1_ALIGNAS(4) Point3f {
639  float x = NAN;
640  float y = NAN;
641  float z = NAN;
642 };
643 
644 /**
645  * @brief The orientation of a device with respect to the vehicle body axes.
646  * @ingroup config_types
647  *
648  * A device's orientation is defined by specifying how the +x and +z axes of its
649  * IMU are aligned with the vehicle body axes. For example, in a car:
650  * - `forward,up`: device +x = vehicle +x, device +z = vehicle +z (i.e.,
651  * IMU pointed towards the front of the vehicle).
652  * - `left,up`: device +x = vehicle +y, device +z = vehicle +z (i.e., IMU
653  * pointed towards the left side of the vehicle)
654  * - `up,backward`: device +x = vehicle +z, device +z = vehicle -x (i.e.,
655  * IMU pointed vertically upward, with the top of the IMU pointed towards the
656  * trunk)
657  */
659  enum class Direction : uint8_t {
660  FORWARD = 0, ///< Aligned with vehicle +x axis.
661  BACKWARD = 1, ///< Aligned with vehicle -x axis.
662  LEFT = 2, ///< Aligned with vehicle +y axis.
663  RIGHT = 3, ///< Aligned with vehicle -y axis.
664  UP = 4, ///< Aligned with vehicle +z axis.
665  DOWN = 5, ///< Aligned with vehicle -z axis.
666  INVALID = 255
667  };
668 
669  /** The direction of the device +x axis relative to the vehicle body axes. */
670  Direction x_direction = Direction::FORWARD;
671 
672  /** The direction of the device +z axis relative to the vehicle body axes. */
673  Direction z_direction = Direction::UP;
674 
675  uint8_t reserved[2] = {0};
676 };
677 
678 /**
679  * @brief The make and model of the vehicle.
680  * @ingroup config_types
681  */
682 enum class VehicleModel : uint16_t {
683  UNKNOWN_VEHICLE = 0,
684  DATASPEED_CD4 = 1,
685  // In general, all J1939 vehicles support a subset of the J1939 standard and
686  // may be set to vehicle model `J1939`. Their 29-bit CAN IDs may differ
687  // based on how the platform assigns message priorities and source
688  // addresses, but the underlying program group number (PGN) and message
689  // contents will be consistent.
690  //
691  // For most vehicles, it is not necessary to specify and particular make and
692  // model.
693  J1939 = 2,
694 
695  LEXUS_CT200H = 20,
696  LEXUS_RX450H = 21,
697 
698  KIA_SORENTO = 40,
699  KIA_SPORTAGE = 41,
700 
701  AUDI_Q7 = 60,
702  AUDI_A8L = 61,
703 
704  TESLA_MODEL_X = 80,
705  TESLA_MODEL_3 = 81,
706 
707  HYUNDAI_ELANTRA = 100,
708 
709  PEUGEOT_206 = 120,
710 
711  MAN_TGX = 140,
712 
713  FACTION = 160,
714  FACTION_V2 = 161,
715 
716  LINCOLN_MKZ = 180,
717 
718  BMW_7 = 200,
719  BMW_MOTORRAD = 201,
720 
721  VW_4 = 220,
722 
723  RIVIAN = 240,
724 
726 
727  ISUZU_F_SERIES = 280,
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 "LEXUS_RX450H";
751  return "KIA_SORENTO";
753  return "KIA_SPORTAGE";
755  return "AUDI_Q7";
757  return "AUDI_A8L";
759  return "TESLA_MODEL_X";
761  return "TESLA_MODEL_3";
763  return "HYUNDAI_ELANTRA";
765  return "PEUGEOT_206";
767  return "MAN_TGX";
769  return "FACTION";
771  return "FACTION_V2";
773  return "LINCOLN_MKZ";
774  case VehicleModel::BMW_7:
775  return "BMW_7";
777  return "BMW_MOTORRAD";
778  case VehicleModel::VW_4:
779  return "VW_4";
781  return "RIVIAN";
783  return "FLEXRAY_DEVICE_AUDI_ETRON";
785  return "ISUZU_F_SERIES";
786  }
787 
788  return "UNRECOGNIZED";
789 }
790 
791 /**
792  * @brief @ref VehicleModel stream operator.
793  * @ingroup config_types
794  */
795 inline p1_ostream& operator<<(p1_ostream& stream, VehicleModel vehicle_model) {
796  stream << to_string(vehicle_model) << " (" << (int)vehicle_model << ")";
797  return stream;
798 }
799 
800 /**
801  * @brief Information about the vehicle including model and dimensions.
802  * @ingroup config_types
803  */
806  uint8_t reserved[10] = {0};
807 
808  /** The distance between the front axle and rear axle (in meters). */
809  float wheelbase_m = NAN;
810 
811  /** The distance between the two front wheels (in meters). */
812  float front_track_width_m = NAN;
813 
814  /** The distance between the two rear wheels (in meters). */
815  float rear_track_width_m = NAN;
816 };
817 
818 /**
819  * @brief The type of vehicle/wheel speed measurements produced by the vehicle.
820  * @ingroup config_types
821  */
822 enum class WheelSensorType : uint8_t {
823  /** Wheel/vehicle speed data not available. */
824  NONE = 0,
825  // RESERVED = 1,
826  /**
827  * Individual rotational angle measurements for multiple wheels, reported as
828  * accumulated encoder ticks. See @ref WheelTickInput.
829  * */
830  TICKS = 2,
831  /**
832  * Individual speed measurements for multiple wheels, reported in
833  * meters/second. See @ref WheelSpeedInput.
834  */
835  WHEEL_SPEED = 3,
836  /**
837  * A single value indicating the vehicle speed (in meters/second). See @ref
838  * VehicleSpeedInput.
839  */
840  VEHICLE_SPEED = 4,
841  /**
842  * A single wheel rotational angle, reported as accumulated encoder ticks. See
843  * @ref VehicleSpeedInput.
844  */
845  VEHICLE_TICKS = 5,
846 };
847 
848 /**
849  * @brief Get a human-friendly string name for the specified @ref
850  * WheelSensorType.
851  * @ingroup config_types
852  *
853  * @param wheel_sensor_type The desired wheel sensor type.
854  *
855  * @return The corresponding string name.
856  */
857 P1_CONSTEXPR_FUNC const char* to_string(WheelSensorType wheel_sensor_type) {
858  switch (wheel_sensor_type) {
860  return "None";
862  return "Ticks";
864  return "Wheel Speed";
866  return "Vehicle Speed";
868  return "Vehicle Ticks";
869  }
870 
871  return "None";
872 }
873 
874 /**
875  * @brief @ref WheelSensorType stream operator.
876  * @ingroup config_types
877  */
879  WheelSensorType wheel_sensor_type) {
880  stream << to_string(wheel_sensor_type) << " (" << (int)wheel_sensor_type
881  << ")";
882  return stream;
883 }
884 
885 /**
886  * @brief The type of vehicle/wheel speed measurements to be applied.
887  * @ingroup config_types
888  */
889 enum class AppliedSpeedType : uint8_t {
890  /** Speed data not applied to the system. */
891  NONE = 0,
892  /** Rear wheel speed data to be applied to the system (recommended). */
893  REAR_WHEELS = 1,
894  /** Front wheel speed data to be applied to the system. */
895  FRONT_WHEELS = 2,
896  /** Front and rear wheel speed data to be applied to the system. */
898  /** Individual vehicle speed to be applied to the system. */
899  VEHICLE_BODY = 4,
900 };
901 
902 /**
903  * @brief Get a human-friendly string name for the specified @ref
904  * AppliedSpeedType.
905  * @ingroup config_types
906  *
907  * @param applied_speed_type The desired applied speed type.
908  *
909  * @return The corresponding string name.
910  */
911 P1_CONSTEXPR_FUNC const char* to_string(AppliedSpeedType applied_speed_type) {
912  switch (applied_speed_type) {
914  return "None";
916  return "Rear Wheels";
918  return "Front Wheels";
920  return "Front and Rear Wheels";
922  return "Vehicle Body";
923  }
924 
925  return "Unrecognized";
926 }
927 
928 /**
929  * @brief @ref AppliedSpeedType stream operator.
930  * @ingroup config_types
931  */
933  AppliedSpeedType applied_speed_type) {
934  stream << to_string(applied_speed_type) << " (" << (int)applied_speed_type
935  << ")";
936  return stream;
937 }
938 
939 /**
940  * @brief Indication of which of the vehicle's wheels are steered.
941  * @ingroup config_types
942  */
943 enum class SteeringType : uint8_t {
944  /** Steered wheels unknown. */
945  UNKNOWN = 0,
946  /** Front wheels are steered. */
947  FRONT = 1,
948  /** Front and rear wheels are steered. */
949  FRONT_AND_REAR = 2,
950 };
951 
952 /**
953  * @brief Get a human-friendly string name for the specified @ref SteeringType.
954  * @ingroup config_types
955  *
956  * @param steering_type The desired steering type.
957  *
958  * @return The corresponding string name.
959  */
960 P1_CONSTEXPR_FUNC const char* to_string(SteeringType steering_type) {
961  switch (steering_type) {
963  return "Unknown Steering";
964  case SteeringType::FRONT:
965  return "Front Steering";
967  return "Front and Rear Steering";
968  }
969 
970  return "Unrecognized";
971 }
972 
973 /**
974  * @brief @ref SteeringType stream operator.
975  * @ingroup config_types
976  */
977 inline p1_ostream& operator<<(p1_ostream& stream, SteeringType steering_type) {
978  stream << to_string(steering_type) << " (" << (int)steering_type << ")";
979  return stream;
980 }
981 
982 /**
983  * @brief Software vehicle/wheel speed measurement configuration settings.
984  * @ingroup config_types
985  *
986  * @warning
987  * The @ref WheelConfig payload is intended for use on vehicles where wheel
988  * speed or angle (tick) data is received via software, either using
989  * FusionEngine measurement messages, or from another software data source such
990  * as a vehicle CAN bus. For vehicles using a hardware wheel tick voltage
991  * signal, use @ref HardwareTickConfig instead.
992  *
993  * Wheel data may be differential (measurements from each individual wheel), or
994  * scalar (a single speed measurement for the vehicle body).
995  *
996  * When using software wheel data, you must also specify @ref VehicleDetails,
997  * which is used to describe the vehicle dimensions and make/model.
998  *
999  * See also:
1000  * - @ref WheelSpeedInput
1001  * - @ref VehicleSpeedInput
1002  * - @ref WheelTickInput
1003  * - @ref VehicleTickInput
1004  */
1006  /**
1007  * The type of vehicle/wheel speed measurements produced by the vehicle.
1008  */
1010 
1011  /**
1012  * The type of vehicle/wheel speed measurements to be applied to the
1013  * navigation solution.
1014  */
1016 
1017  /** Indication of which of the vehicle's wheels are steered. */
1019 
1020  uint8_t reserved1[1] = {0};
1021 
1022  /**
1023  * The rate at which wheel speed/tick measurements will be sent to the device
1024  * (in seconds).
1025  *
1026  * @note
1027  * This parameter is required when using software wheel measurements. It
1028  * may not be `NAN` if wheel measurements are enabled, and cannot be
1029  * determined automatically by the device.
1030  */
1031  float wheel_update_interval_sec = NAN;
1032 
1033  /**
1034  * Override the rate at which wheel tick measurements will be used by the
1035  * navigation engine (in seconds).
1036  *
1037  * If this parameter is `NAN` (default), the best rate will be selected
1038  * automatically by the device based on the input rate (@ref
1039  * wheel_update_interval_sec) and the wheel tick quantization (@ref
1040  * wheel_ticks_to_m).
1041  *
1042  * @warning
1043  * For most system configurations, we recommend setting this value to `NAN` to
1044  * let the device choose the appropriate setting. Use this setting with
1045  * caution.
1046  */
1047  float wheel_tick_output_interval_sec = NAN;
1048 
1049  /**
1050  * Ratio between angle of the steering wheel and the angle of the wheels on
1051  * the ground.
1052  *
1053  * Used when applying measurements from steered wheels only, ignored
1054  * otherwise.
1055  */
1056  float steering_ratio = NAN;
1057 
1058  /**
1059  * The scale factor to convert from wheel encoder ticks to distance (in
1060  * meters/tick).
1061  *
1062  * Used for @ref WheelSensorType::TICKS and @ref
1063  * WheelSensorType::VEHICLE_TICKS, ignored for wheel speed input.
1064  */
1065  float wheel_ticks_to_m = NAN;
1066 
1067  /**
1068  * The maximum value (inclusive) before the wheel tick measurement will roll
1069  * over.
1070  *
1071  * The rollover behavior depends on the value of @ref wheel_ticks_signed. For
1072  * example, a maximum value of 10 will work as follows:
1073  * - `wheel_ticks_signed == true`: [-11, 10]
1074  * - `wheel_ticks_signed == false`: [0, 10]
1075  *
1076  * Signed values are assumed to be asymmetric, consistent with a typical 2's
1077  * complement rollover.
1078  *
1079  * Used for @ref WheelSensorType::TICKS and @ref
1080  * WheelSensorType::VEHICLE_TICKS, ignored for wheel speed input.
1081  */
1082  uint32_t wheel_tick_max_value = 0;
1083 
1084  /**
1085  * `true` if the reported wheel tick measurements should be interpreted as
1086  * signed integers, or `false` if they should be interpreted as unsigned
1087  * integers.
1088  *
1089  * Used for @ref WheelSensorType::TICKS and @ref
1090  * WheelSensorType::VEHICLE_TICKS, ignored for wheel speed input. See
1091  * @ref wheel_tick_max_value for details.
1092  */
1093  bool wheel_ticks_signed = false;
1094 
1095  /**
1096  * `true` if the wheel tick measurements increase by a positive amount when
1097  * driving forward or backward. `false` if wheel tick measurements decrease
1098  * when driving backward.
1099  *
1100  * Used for @ref WheelSensorType::TICKS and @ref
1101  * WheelSensorType::VEHICLE_TICKS, ignored for wheel speed input.
1102  */
1103  bool wheel_ticks_always_increase = true;
1104 
1105  uint8_t reserved2[2] = {0};
1106 };
1107 
1108 /**
1109  * @brief The signal edge to use when capturing a wheel tick voltage signal.
1110  * @ingroup config_types
1111  */
1112 enum class TickMode : uint8_t {
1113  /** Wheel tick capture disabled. */
1114  OFF = 0,
1115  /** Capture a wheel tick on the rising edge of the incoming pulse. */
1116  RISING_EDGE = 1,
1117  /** Capture a wheel tick on the falling edge of the incoming pulse. */
1118  FALLING_EDGE = 2,
1119 };
1120 
1121 P1_CONSTEXPR_FUNC const char* to_string(TickMode tick_mode) {
1122  switch (tick_mode) {
1123  case TickMode::OFF:
1124  return "OFF";
1125  case TickMode::RISING_EDGE:
1126  return "RISING_EDGE";
1128  return "FALLING_EDGE";
1129  }
1130 
1131  return "UNRECOGNIZED";
1132 }
1133 
1134 /**
1135  * @brief @ref TickMode stream operator.
1136  * @ingroup config_types
1137  */
1138 inline p1_ostream& operator<<(p1_ostream& stream, TickMode tick_mode) {
1139  stream << to_string(tick_mode) << " (" << (int)tick_mode << ")";
1140  return stream;
1141 }
1142 
1143 /**
1144  * @brief The way to interpret an incoming voltage signal, used to indicate
1145  * direction of a hardware wheel tick pulse, if available.
1146  * @ingroup config_types
1147  */
1148 enum class TickDirection : uint8_t {
1149  /** Wheel tick direction not provided. */
1150  OFF = 0,
1151  /**
1152  * Assume vehicle is moving forward when direction signal voltage is high, and
1153  * backward when direction signal is low.
1154  */
1155  FORWARD_ACTIVE_HIGH = 1,
1156  /**
1157  * Assume vehicle is moving forward when direction signal voltage is low, and
1158  * backward when direction signal is high.
1159  */
1160  FORWARD_ACTIVE_LOW = 2,
1161 };
1162 
1163 P1_CONSTEXPR_FUNC const char* to_string(TickDirection tick_direction) {
1164  switch (tick_direction) {
1165  case TickDirection::OFF:
1166  return "OFF";
1168  return "FORWARD_ACTIVE_HIGH";
1170  return "FORWARD_ACTIVE_LOW";
1171  }
1172 
1173  return "UNRECOGNIZED";
1174 }
1175 
1176 /**
1177  * @brief @ref TickDirection stream operator.
1178  * @ingroup config_types
1179  */
1181  TickDirection tick_direction) {
1182  stream << to_string(tick_direction) << " (" << (int)tick_direction << ")";
1183  return stream;
1184 }
1185 
1186 /**
1187  * @brief Hardware wheel tick encoder configuration settings.
1188  * @ingroup config_types
1189  *
1190  * @warning
1191  * The @ref HardwareTickConfig payload is intended for use on vehicles with a
1192  * physical voltage signal, generated by a wheel encoder, that produces a series
1193  * of voltage pulses (encoder ticks) as the vehicle’s wheel rotates. These ticks
1194  * will be captured by the device on an input pin and used to indicate vehicle
1195  * speed. For vehicles using software wheel speed/tick information, including
1196  * data send using FusionEngine messages or a vehicle CAN bus, use @ref
1197  * WheelConfig instead.
1198  *
1199  * @note
1200  * In addition to the wheel tick signal, an optional voltage signal may be
1201  * provided to indicate vehicle direction. If this signal is not connected, the
1202  * @ref tick_direction setting MUST be set to `OFF` otherwise there will be
1203  * substantial errors in dead reckoning.
1204  *
1205  * See also @ref VehicleTickInput.
1206  */
1208  /**
1209  * If enabled -- tick mode is not @ref TickMode::OFF -- the device will
1210  * accumulate ticks received on the I/O pin, and use them as an indication of
1211  * vehicle speed. If enabled, you must also specify @ref wheel_ticks_to_m to
1212  * indicate the mapping of wheel tick encoder angle to tire circumference. All
1213  * other wheel tick-related parameters such as tick capture rate, rollover
1214  * value, etc. will be set internally.
1215  *
1216  * @warning
1217  * Do not enable this feature if a wheel tick voltage signal is not present.
1218  */
1220 
1221  /**
1222  * When direction is @ref TickDirection::OFF, the incoming ticks will be
1223  * treated as unsigned, meaning the tick count will continue to increase in
1224  * either direction of travel. If direction is not @ref TickDirection::OFF,
1225  * a second direction I/O pin will be used to indicate the direction of
1226  * travel and the accumulated tick count will increase/decrease accordingly.
1227  */
1229 
1230  uint8_t reserved1[2] = {0};
1231 
1232  /**
1233  * The scale factor to convert from wheel encoder ticks to distance (in
1234  * meters/tick). Used for @ref WheelSensorType::TICKS.
1235  */
1236  float wheel_ticks_to_m = NAN;
1237 };
1238 
1239 /**
1240  * @brief The ionospheric delay model to use.
1241  * @ingroup config_types
1242  */
1243 enum class IonoDelayModel : uint8_t {
1244  /** Select the best available ionospheric delay model. */
1245  AUTO = 0,
1246  /** Ionospheric delay model disabled. */
1247  OFF = 1,
1248  /** Use the Klobuchar ionospheric model. */
1249  KLOBUCHAR = 2,
1250  /** Use the SBAS ionospheric model. */
1251  SBAS = 3,
1252 };
1253 
1254 P1_CONSTEXPR_FUNC const char* to_string(IonoDelayModel iono_delay_model) {
1255  switch (iono_delay_model) {
1256  case IonoDelayModel::AUTO:
1257  return "AUTO";
1258  case IonoDelayModel::OFF:
1259  return "OFF";
1261  return "KLOBUCHAR";
1262  case IonoDelayModel::SBAS:
1263  return "SBAS";
1264  }
1265 
1266  return "UNRECOGNIZED";
1267 }
1268 
1269 /**
1270  * @brief @ref IonoDelayModel stream operator.
1271  * @ingroup config_types
1272  */
1274  IonoDelayModel iono_delay_model) {
1275  stream << to_string(iono_delay_model) << " (" << (int)iono_delay_model << ")";
1276  return stream;
1277 }
1278 
1279 /**
1280  * @brief Ionospheric delay model configuration.
1281  * @ingroup config_types
1282  */
1284  /** The ionospheric delay model to use. */
1286 
1287  uint8_t reserved[3] = {0};
1288 };
1289 
1290 /**
1291  * @brief The tropospheric delay model to use.
1292  * @ingroup config_types
1293  */
1294 enum class TropoDelayModel : uint8_t {
1295  /** Select the best available tropospheric delay model. */
1296  AUTO = 0,
1297  /** Tropospheric delay model disabled. */
1298  OFF = 1,
1299  /** Use the Saastamoinen tropospheric model. */
1300  SAASTAMOINEN = 2,
1301 };
1302 
1303 P1_CONSTEXPR_FUNC const char* to_string(TropoDelayModel tropo_delay_model) {
1304  switch (tropo_delay_model) {
1305  case TropoDelayModel::AUTO:
1306  return "AUTO";
1307  case TropoDelayModel::OFF:
1308  return "OFF";
1310  return "SAASTAMOINEN";
1311  }
1312 
1313  return "UNRECOGNIZED";
1314 }
1315 
1316 /**
1317  * @brief @ref TropoDelayModel stream operator.
1318  * @ingroup config_types
1319  */
1321  TropoDelayModel tropo_delay_model) {
1322  stream << to_string(tropo_delay_model) << " (" << (int)tropo_delay_model
1323  << ")";
1324  return stream;
1325 }
1326 
1327 /**
1328  * @brief Tropospheric delay model configuration.
1329  * @ingroup config_types
1330  */
1332  /** The tropospheric delay model to use. */
1334 
1335  uint8_t reserved[3] = {0};
1336 };
1337 
1338 /**************************************************************************/ /**
1339  * @defgroup import_export Device Configuration Import/Export
1340  * @brief Messages for importing/exporting device configuration.
1341  * @ingroup config_and_ctrl_messages
1342  *
1343  * See also @ref config_types.
1344  ******************************************************************************/
1345 
1346 /**
1347  * @brief Type of data stored on device.
1348  * @ingroup import_export
1349  */
1350 enum class DataType : uint8_t {
1351  CALIBRATION_STATE = 0,
1352  CRASH_LOG = 1,
1353  FILTER_STATE = 2,
1354  USER_CONFIG = 3,
1355  INVALID = 255
1356 };
1357 
1358 /**
1359  * @brief Get a string representation of a @ref DataType.
1360  * @ingroup import_export
1361  *
1362  * @param type The requested type.
1363  *
1364  * @return The corresponding string name.
1365  */
1367  switch (type) {
1369  return "CalibrationState";
1370  case DataType::CRASH_LOG:
1371  return "CrashLog";
1373  return "FilterState";
1374  case DataType::USER_CONFIG:
1375  return "UserConfig";
1376  case DataType::INVALID:
1377  return "Invalid";
1378  }
1379 
1380  return "Unrecognized";
1381 }
1382 
1383 /**
1384  * @brief @ref DataType stream operator.
1385  * @ingroup import_export
1386  */
1387 inline p1_ostream& operator<<(p1_ostream& stream, DataType val) {
1388  stream << to_string(val) << " (" << (int)val << ")";
1389  return stream;
1390 }
1391 
1392 /**
1393  * @brief Import data from the host to the device (@ref
1394  * MessageType::IMPORT_DATA, version 1.0).
1395  * @ingroup import_export
1396  *
1397  * This message must be followed by @ref data_length_bytes bytes containing
1398  * the data to be imported:
1399  *
1400  * ```
1401  * {MessageHeader, ImportDataMessage, Payload[data_length_bytes]}
1402  * ```
1403  *
1404  * # Expected Response
1405  * The device will respond with a @ref CommandResponseMessage indicating whether
1406  * or not the request succeeded.
1407  */
1409  static constexpr MessageType MESSAGE_TYPE = MessageType::IMPORT_DATA;
1410  static constexpr uint8_t MESSAGE_VERSION = 0;
1411  /**
1412  * The type of data being imported.
1413  */
1415  /**
1416  * The location of the data to update (active, saved, etc.). For data that
1417  * doesn't have separate active and saved copies, this parameter is ignored.
1418  */
1420  uint8_t reserved1[2] = {0};
1421  /** @brief Version of data contents. */
1423  uint8_t reserved2[4] = {0};
1424  /** @brief Number of bytes to update. */
1425  uint32_t data_length_bytes = 0;
1426 };
1427 
1428 /**
1429  * @brief Export data from the device (@ref
1430  * MessageType::EXPORT_DATA, version 1.0).
1431  * @ingroup import_export
1432  *
1433  * # Expected Response
1434  * The device will respond with a @ref PlatformStorageDataMessage.
1435  */
1437  static constexpr MessageType MESSAGE_TYPE = MessageType::EXPORT_DATA;
1438  static constexpr uint8_t MESSAGE_VERSION = 0;
1439  /**
1440  * The type of data to be exported.
1441  */
1443  /**
1444  * The source to copy this data from. If the data_type doesn't separate active
1445  * and saved data, this will be ignored.
1446  */
1448  uint8_t reserved[2] = {0};
1449 };
1450 
1451 /**
1452  * @brief Message for reporting platform storage data (@ref
1453  * MessageType::PLATFORM_STORAGE_DATA, version 1.0).
1454  * @ingroup import_export
1455  *
1456  * This message will be followed by @ref data_length_bytes bytes containing
1457  * the data storage contents:
1458  *
1459  * ```
1460  * {MessageHeader, PlatformStorageDataMessage, Payload[data_length_bytes]}
1461  * ```
1462  *
1463  * See also @ref ExportDataMessage.
1464  *
1465  * Changes:
1466  * - Version 1: Added `data_validity` field.
1467  * - Version 2: Changed data_validity to a @ref Response enum and added
1468  * @ref source field.
1469  * - Version 3: Added @ref flags field.
1470  */
1472  static constexpr MessageType MESSAGE_TYPE =
1474  static constexpr uint8_t MESSAGE_VERSION = 3;
1475 
1476  /** @ref DataType::USER_CONFIG flag field is not set. */
1477  static constexpr uint8_t FLAG_USER_CONFIG_PLATFORM_NOT_SPECIFIED = 0;
1478  /** @ref DataType::USER_CONFIG flag for POSIX platforms. */
1479  static constexpr uint8_t FLAG_USER_CONFIG_PLATFORM_POSIX = 1;
1480  /** @ref DataType::USER_CONFIG flag for embedded platforms. */
1481  static constexpr uint8_t FLAG_USER_CONFIG_PLATFORM_EMBEDDED = 2;
1482  /** @ref DataType::USER_CONFIG flag for embedded SSR platforms. */
1483  static constexpr uint8_t FLAG_USER_CONFIG_PLATFORM_EMBEDDED_SSR = 3;
1484  /** @ref DataType::USER_CONFIG flag for the SSR client library. */
1485  static constexpr uint8_t FLAG_USER_CONFIG_SSR_CLIENT = 254;
1486 
1487  /**
1488  * The type of data contained in this message.
1489  */
1491  /**
1492  * The status of the specified data type on the device.
1493  */
1495  /**
1496  * The source this data was copied from. If the @ref data_type doesn't
1497  * separate active and saved data, this will be set to @ref
1498  * ConfigurationSource::ACTIVE.
1499  */
1501  /**
1502  * @ref DataType specific flags.
1503  *
1504  * Currently, only defined for @ref DataType::USER_CONFIG contents. This value
1505  * can optionally set to one of the `FLAG_USER_CONFIG_PLATFORM_*` values to
1506  * indicate which type of platform the UserConfig is valid for. This value
1507  * can be left at `0` for backwards compatibility or to indicate the platform
1508  * type is unknown.
1509  */
1510  uint8_t flags = 0;
1511  /** Version of data contents. */
1513  /** Number of bytes in data contents. */
1514  uint32_t data_length_bytes = 0;
1515 };
1516 
1517 /**************************************************************************/ /**
1518  * @defgroup io_interfaces Input/Output Interface And Message Rate Control
1519  * @brief Messages for controlling device output (e.g., define TCP server
1520  * parameters, configure message output rates).
1521  * @ingroup config_and_ctrl_messages
1522  ******************************************************************************/
1523 
1524 /**
1525  * @brief An identifier for the contents of a output interface configuration
1526  * submessage.
1527  * @ingroup io_interfaces
1528  *
1529  * See also @ref InterfaceConfigSubmessage.
1530  */
1531 enum class InterfaceConfigType : uint8_t {
1532  INVALID = 0,
1533 
1534  /**
1535  * Enable/disable output of diagnostic data on this interface.
1536  *
1537  * Valid for:
1538  * - All @ref TransportType
1539  *
1540  * @note
1541  * Enabling this setting will override the message rate/off settings for some
1542  * FusionEngine messages.
1543  *
1544  * Payload format: `bool`
1545  */
1547 
1548  /**
1549  * Configure the serial baud rate (in bits/second).
1550  *
1551  * Valid for:
1552  * - @ref TransportType::SERIAL
1553  *
1554  * Payload format: `uint32_t`
1555  */
1556  BAUD_RATE = 2,
1557 
1558  /**
1559  * Configure the remote network IP address or hostname for a client to connect
1560  * to.
1561  *
1562  * Valid for:
1563  * - @ref TransportType::TCP
1564  * - @ref TransportType::UDP
1565  *
1566  * Payload format: `char[64]` containing a NULL terminated string.
1567  */
1568  REMOTE_ADDRESS = 3,
1569 
1570  /**
1571  * Configure the network port.
1572  *
1573  * Valid for:
1574  * - @ref TransportType::TCP
1575  * - @ref TransportType::UDP
1576  * - @ref TransportType::WEBSOCKET
1577  *
1578  * Payload format: `uint16_t`
1579  */
1580  PORT = 4,
1581 
1582  /**
1583  * Enable/disable the interface.
1584  *
1585  * Valid for all @ref TransportType values.
1586  *
1587  * Payload format: `bool`
1588  */
1589  ENABLED = 5,
1590 
1591  /**
1592  * Set the interface direction (client/server).
1593  *
1594  * Valid for:
1595  * - @ref TransportType::TCP
1596  * - @ref TransportType::WEBSOCKET
1597  * - @ref TransportType::UNIX
1598  *
1599  * Payload format: @ref TransportDirection
1600  */
1601  DIRECTION = 6,
1602 
1603  /**
1604  * Set the UNIX domain socket type (streaming/datagram/sequenced).
1605  *
1606  * Valid for:
1607  * - @ref TransportType::UNIX
1608  *
1609  * Payload format: @ref SocketType
1610  */
1611  SOCKET_TYPE = 7,
1612 
1613  /**
1614  * Configure the path to a local file or UNIX domain socket.
1615  *
1616  * Valid for:
1617  * - @ref TransportType::FILE
1618  * - @ref TransportType::UNIX
1619  *
1620  * Payload format: `char[64]` containing a NULL terminated string.
1621  */
1622  FILE_PATH = 8,
1623 };
1624 
1625 /**
1626  * @brief Get a human-friendly string name for the specified @ref ConfigType.
1627  * @ingroup io_interfaces
1628  *
1629  * @param type The desired configuration parameter type.
1630  *
1631  * @return The corresponding string name.
1632  */
1634  switch (type) {
1636  return "Invalid";
1637 
1639  return "Diagnostic Messages Enabled";
1640 
1642  return "Serial Baud Rate";
1643 
1645  return "Remote Network Address";
1646 
1648  return "Network Port";
1649 
1651  return "Interface Enabled";
1652 
1654  return "Transport Direction";
1655 
1657  return "Socket Type";
1658 
1660  return "File Path";
1661  }
1662 
1663  return "Unrecognized Configuration";
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  }
1713 
1714  return "Unrecognized";
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 
1832  return "Unrecognized";
1833 }
1834 
1835 /**
1836  * @brief @ref TransportType stream operator.
1837  * @ingroup io_interfaces
1838  */
1840  stream << to_string(val) << " (" << (int)val << ")";
1841  return stream;
1842 }
1843 
1844 /**
1845  * @brief The direction (client/server) for an individual interface.
1846  * @ingroup io_interfaces
1847  */
1848 enum class TransportDirection : uint8_t {
1849  INVALID = 0,
1850  /** A server listening for one or more incoming remote connections. */
1851  SERVER = 1,
1852  /** A client connecting to a specified remote server. */
1853  CLIENT = 2,
1854 };
1855 
1856 /**
1857  * @brief Get a human-friendly string name for the specified @ref
1858  * TransportDirection.
1859  * @ingroup io_interfaces
1860  *
1861  * @param val The enum to get the string name for.
1862  *
1863  * @return The corresponding string name.
1864  */
1866  switch (val) {
1868  return "INVALID";
1870  return "SERVER";
1872  return "CLIENT";
1873  }
1874 
1875  return "Unrecognized";
1876 }
1877 
1878 /**
1879  * @brief @ref TransportDirection stream operator.
1880  * @ingroup io_interfaces
1881  */
1883  stream << to_string(val) << " (" << (int)val << ")";
1884  return stream;
1885 }
1886 
1887 /**
1888  * @brief The socket type specifying how data is transmitted for UNIX domain
1889  * sockets.
1890  * @ingroup io_interfaces
1891  */
1892 enum class SocketType : uint8_t {
1893  INVALID = 0,
1894  /**
1895  * Operate in connection-oriented streaming mode and do not preserve message
1896  * boundaries (similar to TCP).
1897  */
1898  STREAM = 1,
1899  /**
1900  * Operate in datagram mode, preserving message boundaries but not maintaining
1901  * client connections (similar to UDP).
1902  */
1903  DATAGRAM = 2,
1904  /**
1905  * Operate in sequenced packet mode, which is both connection-oriented and
1906  * preserves message boundaries.
1907  */
1908  SEQPACKET = 3,
1909 };
1910 
1911 /**
1912  * @brief Get a human-friendly string name for the specified @ref SocketType.
1913  * @ingroup io_interfaces
1914  *
1915  * @param val The enum to get the string name for.
1916  *
1917  * @return The corresponding string name.
1918  */
1920  switch (val) {
1921  case SocketType::INVALID:
1922  return "INVALID";
1923  case SocketType::STREAM:
1924  return "STREAM";
1925  case SocketType::DATAGRAM:
1926  return "DATAGRAM";
1927  case SocketType::SEQPACKET:
1928  return "SEQPACKET";
1929  }
1930 
1931  return "Unrecognized";
1932 }
1933 
1934 /**
1935  * @brief @ref SocketType stream operator.
1936  * @ingroup io_interfaces
1937  */
1939  stream << to_string(val) << " (" << (int)val << ")";
1940  return stream;
1941 }
1942 
1943 /**
1944  * @brief Identifier for an I/O interface.
1945  * @ingroup io_interfaces
1946  *
1947  * For example, serial port 1 or TCP server 2.
1948  *
1949  * @note
1950  * On most devices, serial ports (UARTs) use 1-based numbering: the first serial
1951  * port is typically index 1 (UART1).
1952  */
1954  /** The interface's transport type. **/
1956  /** An identifier for the instance of this transport. */
1957  uint8_t index = 0;
1958  uint8_t reserved[2] = {0};
1959 
1961 
1962  P1_CONSTEXPR_FUNC explicit InterfaceID(TransportType type, uint8_t index = 0)
1963  : type(type), index(index) {}
1964 
1965  P1_CONSTEXPR_FUNC bool operator==(const InterfaceID& other) const {
1966  return type == other.type && index == other.index;
1967  }
1968 
1969  P1_CONSTEXPR_FUNC bool operator!=(const InterfaceID& other) const {
1970  return !(*this == other);
1971  }
1972 
1973  P1_CONSTEXPR_FUNC bool operator<(const InterfaceID& other) const {
1974  if (type == other.type) {
1975  return index < other.index;
1976  } else {
1977  return type < other.type;
1978  }
1979  }
1980 
1981  P1_CONSTEXPR_FUNC bool operator>(const InterfaceID& other) const {
1982  return other < *this;
1983  }
1984 
1985  P1_CONSTEXPR_FUNC bool operator>=(const InterfaceID& other) const {
1986  return !(*this < other);
1987  }
1988 
1989  P1_CONSTEXPR_FUNC bool operator<=(const InterfaceID& other) const {
1990  return !(*this > other);
1991  }
1992 };
1993 
1994 /**
1995  * @brief @ref InterfaceID stream operator.
1996  * @ingroup io_interfaces
1997  */
1998 inline p1_ostream& operator<<(p1_ostream& stream, const InterfaceID& val) {
1999  stream << "[type=" << val.type << ", index=" << (int)val.index << "]";
2000  return stream;
2001 }
2002 
2003 /**
2004  * @brief Integer ID for NMEA messages.
2005  * @ingroup io_interfaces
2006  */
2007 enum class NmeaMessageType : uint16_t {
2008  INVALID = 0,
2009 
2010  /**
2011  * @name Standard NMEA Messages
2012  * @{
2013  */
2014  GGA = 1,
2015  GLL = 2,
2016  GSA = 3,
2017  GSV = 4,
2018  RMC = 5,
2019  VTG = 6,
2020  ZDA = 7,
2021  /** @} */
2022 
2023  /**
2024  * @name Point One Proprietary Messages
2025  * @{
2026  */
2027  P1CALSTATUS = 1000,
2028  P1MSG = 1001,
2029  /** @} */
2030 
2031  /**
2032  * @name Quectel Proprietary Messages
2033  * @{
2034  */
2035  PQTMVERNO = 1200,
2036  PQTMVER = 1201,
2037  PQTMGNSS = 1202,
2038  PQTMVERNO_SUB = 1203,
2039  PQTMVER_SUB = 1204,
2040  PQTMTXT = 1205,
2041  /** @} */
2042 };
2043 
2044 /**
2045  * @brief Get a human-friendly string name for the specified @ref
2046  * NmeaMessageType.
2047  * @ingroup io_interfaces
2048  *
2049  * @param value The enum to get the string name for.
2050  *
2051  * @return The corresponding string name.
2052  */
2054  switch (value) {
2056  return "INVALID";
2057  case NmeaMessageType::GGA:
2058  return "GGA";
2059  case NmeaMessageType::GLL:
2060  return "GLL";
2061  case NmeaMessageType::GSA:
2062  return "GSA";
2063  case NmeaMessageType::GSV:
2064  return "GSV";
2065  case NmeaMessageType::RMC:
2066  return "RMC";
2067  case NmeaMessageType::VTG:
2068  return "VTG";
2069  case NmeaMessageType::ZDA:
2070  return "ZDA";
2072  return "P1CALSTATUS";
2074  return "P1MSG";
2076  return "PQTMVERNO";
2078  return "PQTMVER";
2080  return "PQTMGNSS";
2082  return "PQTMVERNO_SUB";
2084  return "PQTMVER_SUB";
2086  return "PQTMTXT";
2087  }
2088 
2089  return "Unrecognized";
2090 }
2091 
2092 /**
2093  * @brief @ref NmeaMessageType stream operator.
2094  * @ingroup io_interfaces
2095  */
2097  stream << to_string(val) << " (" << (int)val << ")";
2098  return stream;
2099 }
2100 
2101 /**
2102  * @brief The output rate for a message type on an interface.
2103  * @ingroup io_interfaces
2104  */
2105 enum class MessageRate : uint8_t {
2106  /**
2107  * Disable output of this message.
2108  */
2109  OFF = 0,
2110  /**
2111  * Output this message each time a new value is available.
2112  */
2113  ON_CHANGE = 1,
2114  /** Alias for @ref MessageRate::ON_CHANGE. */
2115  MAX_RATE = 1,
2116  /**
2117  * Output this message every 10 milliseconds. Not supported for all messages
2118  * or platforms.
2119  */
2120  INTERVAL_10_MS = 2,
2121  /**
2122  * Output this message every 20 milliseconds. Not supported for all messages
2123  * or platforms.
2124  */
2125  INTERVAL_20_MS = 3,
2126  /**
2127  * Output this message every 40 milliseconds. Not supported for all messages
2128  * or platforms.
2129  */
2130  INTERVAL_40_MS = 4,
2131  /**
2132  * Output this message every 50 milliseconds. Not supported for all messages
2133  * or platforms.
2134  */
2135  INTERVAL_50_MS = 5,
2136  /**
2137  * Output this message every 100 milliseconds. Not supported for all messages
2138  * or platforms.
2139  */
2140  INTERVAL_100_MS = 6,
2141  /**
2142  * Output this message every 200 milliseconds. Not supported for all messages
2143  * or platforms.
2144  */
2145  INTERVAL_200_MS = 7,
2146  /**
2147  * Output this message every 500 milliseconds. Not supported for all messages
2148  * or platforms.
2149  */
2150  INTERVAL_500_MS = 8,
2151  /**
2152  * Output this message every second. Not supported for all messages or
2153  * platforms.
2154  */
2155  INTERVAL_1_S = 9,
2156  /**
2157  * Output this message every 2 seconds. Not supported for all messages or
2158  * platforms.
2159  */
2160  INTERVAL_2_S = 10,
2161  /**
2162  * Output this message every 5 seconds. Not supported for all messages or
2163  * platforms.
2164  */
2165  INTERVAL_5_S = 11,
2166  /**
2167  * Output this message every 10 seconds. Not supported for all messages or
2168  * platforms.
2169  */
2170  INTERVAL_10_S = 12,
2171  /**
2172  * Output this message every 30 seconds. Not supported for all messages or
2173  * platforms.
2174  */
2175  INTERVAL_30_S = 13,
2176  /**
2177  * Output this message every 60 seconds. Not supported for all messages or
2178  * platforms.
2179  */
2180  INTERVAL_60_S = 14,
2181  /**
2182  * Restore this message's rate back to its default value.
2183  */
2184  DEFAULT = 255
2185 };
2186 
2187 /**
2188  * @brief Get a human-friendly string name for the specified @ref
2189  * MessageRate.
2190  * @ingroup io_interfaces
2191  *
2192  * @param value The enum to get the string name for.
2193  *
2194  * @return The corresponding string name.
2195  */
2197  switch (value) {
2198  case MessageRate::OFF:
2199  return "OFF";
2201  return "ON_CHANGE";
2203  return "INTERVAL_10_MS";
2205  return "INTERVAL_20_MS";
2207  return "INTERVAL_40_MS";
2209  return "INTERVAL_50_MS";
2211  return "INTERVAL_100_MS";
2213  return "INTERVAL_200_MS";
2215  return "INTERVAL_500_MS";
2217  return "INTERVAL_1_S";
2219  return "INTERVAL_2_S";
2221  return "INTERVAL_5_S";
2223  return "INTERVAL_10_S";
2225  return "INTERVAL_30_S";
2227  return "INTERVAL_60_S";
2228  case MessageRate::DEFAULT:
2229  return "DEFAULT";
2230  }
2231 
2232  return "Unrecognized";
2233 }
2234 
2235 /**
2236  * @brief @ref MessageRate stream operator.
2237  * @ingroup io_interfaces
2238  */
2240  stream << to_string(val) << " (" << (int)val << ")";
2241  return stream;
2242 }
2243 
2244 /**
2245  * @brief I/O interface parameter configuration submessage (used when sending
2246  * a @ref SetConfigMessage or @ref GetConfigMessage for @ref
2247  * ConfigType::INTERFACE_CONFIG).
2248  * @ingroup io_interfaces
2249  *
2250  * In @ref SetConfigMessage, @ref GetConfigMessage, and @ref
2251  * ConfigResponseMessage, this struct can be used to access settings
2252  * associated with a a particular I/O interface. For example, to set the
2253  * baudrate for serial port 1:
2254  *
2255  * ```
2256  * {
2257  * SetConfigMessage(
2258  * config_type=INTERFACE_CONFIG),
2259  * InterfaceConfigSubmessage(
2260  * interface=InterfaceID(TransportType::SERIAL, 1),
2261  * subtype=BAUD_RATE),
2262  * uint32_t 115200
2263  * }
2264  * ```
2265  *
2266  * This message must be followed by the parameter value to be used:
2267  *
2268  * ```
2269  * {MessageHeader, SetConfigMessage, InterfaceConfigSubmessage, Parameter}
2270  * ```
2271  *
2272  * See @ref InterfaceConfigType for a complete list of parameters and their
2273  * data formats.
2274  */
2276  /**
2277  * The ID of the interface to be configured or queried.
2278  *
2279  * @note
2280  * TransportType::ALL is not supported.
2281  */
2283 
2284  /**
2285  * The interface setting to get or set.
2286  */
2288 
2289  uint8_t reserved[3] = {0};
2290 };
2291 
2292 /**
2293  * @brief Set the output rate for the requested message types (@ref
2294  * MessageType::SET_MESSAGE_RATE, version 1.0).
2295  * @ingroup io_interfaces
2296  *
2297  * Multiple message rates can be configured with a single command if wild cards
2298  * are used for the interface, protocol, or message ID. When multiple messages
2299  * are specified, the following behaviors apply:
2300  * - Messages that are currently @ref MessageRate::OFF will not be changed
2301  * unless the @ref FLAG_INCLUDE_DISABLED_MESSAGES bit is set in the @ref flags
2302  * or the new rate is @ref MessageRate::DEFAULT.
2303  * - If the rate is an interval, it will only affect the messages that support
2304  * being rate controlled.
2305  *
2306  * Setting all the messages on an interface to @ref MessageRate::DEFAULT will
2307  * also restore the default `*_OUTPUT_DIAGNOSTICS_MESSAGES` configuration option
2308  * value for that interface. See @ref ConfigType.
2309  *
2310  * @note
2311  * When specifying @ref ProtocolType::ALL, message ID @ref ALL_MESSAGES_ID must
2312  * also be specified. Further, the rate must be set to either
2313  * @ref MessageRate::OFF or @ref MessageRate::DEFAULT.
2314  *
2315  * @section set_rate_examples Typical Use Cases
2316  *
2317  * @subsection set_rate_restore Restore Default Settings For All Messages
2318  *
2319  * To restore the default configuration on UART1 for all message types across all
2320  * supported protocols, specify the following:
2321  * - Interface transport type: @ref TransportType::SERIAL
2322  * - Interface index: 1
2323  * - Protocol: @ref ProtocolType::ALL
2324  * - Message ID: @ref ALL_MESSAGES_ID
2325  * - Rate: @ref MessageRate::DEFAULT
2326  *
2327  * @subsection set_rate_restore_nmea Restore Default Settings For All NMEA
2328  *
2329  * To restore the default configuration on UART1 for all NMEA message types,
2330  * specify the following:
2331  * - Interface transport type: @ref TransportType::SERIAL
2332  * - Interface index: 1
2333  * - Protocol: @ref ProtocolType::NMEA
2334  * - Message ID: @ref ALL_MESSAGES_ID
2335  * - Rate: @ref MessageRate::DEFAULT
2336  *
2337  * @subsection set_rate_change_nmea Change UART1 Output Rate To 1 Hz:
2338  *
2339  * To change the rate of all NMEA message types to 1 Hz on UART1, specify the
2340  * following:
2341  * - Interface transport type: @ref TransportType::SERIAL
2342  * - Interface index: 1
2343  * - Protocol: @ref ProtocolType::NMEA
2344  * - Message ID: @ref ALL_MESSAGES_ID
2345  * - Rate: @ref MessageRate::INTERVAL_1_S
2346  *
2347  * @note
2348  * Note that this will not affect any message types that are not rate controlled
2349  * (e.g., @ref MessageType::EVENT_NOTIFICATION).
2350  *
2351  * @subsection set_rate_off_all Change The Uart1 Output Rates For All Messages To Be Off:
2352  *
2353  * To change the rate of all messages to their max rate on UART1, specify the
2354  * following:
2355  * - Interface transport type: @ref TransportType::SERIAL
2356  * - Interface index: 1
2357  * - Protocol: @ref ProtocolType::ALL
2358  * - flags: @ref FLAG_INCLUDE_DISABLED_MESSAGES
2359  * - Message ID: @ref ALL_MESSAGES_ID
2360  * - Rate: @ref MessageRate::OFF
2361  *
2362  * @note
2363  * This will disable every message.
2364  *
2365  * @subsection set_and_save_rate_off_all Change And Save The UART1 Output Rates For All Messages To Be Off:
2366  *
2367  * To change the rate of all messages to their max rate on UART1, specify the
2368  * following:
2369  * - Interface transport type: @ref TransportType::SERIAL
2370  * - Interface index: 1
2371  * - Protocol: @ref ProtocolType::ALL
2372  * - flags: 0x03 (@ref FLAG_INCLUDE_DISABLED_MESSAGES | @ref FLAG_APPLY_AND_SAVE)
2373  * - Message ID: @ref ALL_MESSAGES_ID
2374  * - Rate: @ref MessageRate::OFF
2375  *
2376  * @note
2377  * Both of the bit flags are set for this message. This will cause the
2378  * configuration to be saved to non-volatile memory.
2379  *
2380  * # Expected Response
2381  * The device will respond with a @ref CommandResponseMessage indicating whether
2382  * or not the request succeeded.
2383  */
2385  static constexpr MessageType MESSAGE_TYPE = MessageType::SET_MESSAGE_RATE;
2386  static constexpr uint8_t MESSAGE_VERSION = 0;
2387 
2388  /** Flag to immediately save the config after applying this setting. */
2389  static constexpr uint8_t FLAG_APPLY_AND_SAVE = 0x01;
2390 
2391  /**
2392  * Flag to apply bulk interval changes to all messages instead of just
2393  * enabled messages.
2394  */
2395  static constexpr uint8_t FLAG_INCLUDE_DISABLED_MESSAGES = 0x02;
2396 
2397  /**
2398  * The output interface to configure. If @ref TransportType::ALL, set rates on
2399  * all supported interfaces.
2400  */
2402 
2403  /**
2404  * The message protocol being configured. If @ref ProtocolType::ALL, set rates
2405  * on all supported protocols.
2406  */
2408 
2409  /** Bitmask of additional flags to modify the command. */
2410  uint8_t flags = 0;
2411 
2412  /**
2413  * The ID of the desired message type (e.g., 10000 for FusionEngine
2414  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
2415  * messages. If @ref ALL_MESSAGES_ID, set the rate for all messages on the
2416  * selected interface and protocol.
2417  */
2418  uint16_t message_id = ALL_MESSAGES_ID;
2419 
2420  /** The desired message rate. */
2422 
2423  uint8_t reserved2[3] = {0};
2424 };
2425 
2426 /**
2427  * @brief Get the configured output rate for the he requested message type on
2428  * the specified interface (@ref MessageType::GET_MESSAGE_RATE,
2429  * version 1.0).
2430  * @ingroup io_interfaces
2431  *
2432  * Multiple message rates can be requested with a single command if wild cards
2433  * are used for the protocol, or message ID.
2434  *
2435  * # Expected Response
2436  * The device will respond with a @ref MessageRateResponse containing the
2437  * requested values or an error @ref Response value if the request did not
2438  * succeed.
2439  */
2441  static constexpr MessageType MESSAGE_TYPE = MessageType::GET_MESSAGE_RATE;
2442  static constexpr uint8_t MESSAGE_VERSION = 0;
2443 
2444  /**
2445  * The output interface to be queried.
2446  *
2447  * @ref TransportType::ALL is not supported. To query for multiple transports,
2448  * send separate requests.
2449  */
2451 
2452  /**
2453  * The desired message protocol. If @ref ProtocolType::ALL, return the current
2454  * settings for all supported protocols.
2455  */
2457 
2458  /** The source of the parameter value (active, saved, etc.). */
2460 
2461  /**
2462  * The ID of the desired message type (e.g., 10000 for FusionEngine
2463  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
2464  * messages. If @ref ALL_MESSAGES_ID, return the current settings for all
2465  * supported messages on the selected interface and protocol.
2466  */
2467  uint16_t message_id = ALL_MESSAGES_ID;
2468 };
2469 
2470 /**
2471  * @brief A list of transport interfaces supported by the device (@ref
2472  * MessageType::SUPPORTED_IO_INTERFACES, version 1.0).
2473  * @ingroup io_interfaces
2474  */
2476  static constexpr MessageType MESSAGE_TYPE =
2478  static constexpr uint8_t MESSAGE_VERSION = 0;
2479 
2480  /** The number of interfaces reported by this message. */
2481  uint8_t num_interfaces = 0;
2482 
2483  uint8_t reserved1[7] = {0};
2484 
2485  /** This is followed `num_interfaces` @ref InterfaceID elements. */
2486  // InterfaceID interfaces[num_interfaces]
2487 };
2488 
2489 /**
2490  * @brief An element of a @ref MessageRateResponse message.
2491  * @ingroup io_interfaces
2492  */
2494  /**
2495  * Flag to indicate the active value for this configuration differs from the
2496  * value saved to persistent memory.
2497  */
2498  static constexpr uint8_t FLAG_ACTIVE_DIFFERS_FROM_SAVED = 0x1;
2499 
2500  /** The protocol of the message being returned. */
2502 
2503  /** Flags that describe the entry. */
2504  uint8_t flags = 0;
2505 
2506  /**
2507  * The ID of the returned message type (e.g., 10000 for FusionEngine
2508  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
2509  * messages.
2510  */
2511  uint16_t message_id = 0;
2512 
2513  /** The current configuration for this message. */
2514  MessageRate configured_rate = MessageRate::OFF;
2515 
2516  /**
2517  * The currently active output rate for this message, factoring in effects of
2518  * additional configuration settings that may override the configured rate
2519  * such as enabling diagnostic output.
2520  */
2521  MessageRate effective_rate = MessageRate::OFF;
2522 
2523  uint8_t reserved1[2] = {0};
2524 };
2525 
2526 /**
2527  * @brief Response to a @ref GetMessageRate request (@ref
2528  * MessageType::MESSAGE_RATE_RESPONSE, version 1.1).
2529  * @ingroup io_interfaces
2530  *
2531  * This message will be followed by @ref num_rates @ref MessageRateResponseEntry
2532  * elements:
2533  *
2534  * ```
2535  * {MessageHeader, MessageRateResponse, MessageRateResponseEntry[num_rates]}
2536  * ```
2537  */
2539  static constexpr MessageType MESSAGE_TYPE =
2541  static constexpr uint8_t MESSAGE_VERSION = 1;
2542 
2543  /** The source of the parameter value (active, saved, etc.). */
2545 
2546  /** The response status (success, error, etc.). */
2548 
2549  /** The number of rates reported by this message. */
2550  uint16_t num_rates = 0;
2551 
2552  /** The output interface corresponding with this response. */
2553  InterfaceID output_interface = {};
2554 };
2555 
2556 /**************************************************************************/ /**
2557  * @defgroup gnss_corrections_control GNSS Corrections Control
2558  * @brief Messages for enabling/disabling GNSS corrections sources.
2559  * @ingroup config_and_ctrl_messages
2560  ******************************************************************************/
2561 
2562 /**
2563  * @brief L-band demodulator configuration parameters.
2564  * @ingroup gnss_corrections_control
2565  */
2567  /**
2568  * The center frequency of the L-band beam (Hz).
2569  */
2570  double center_frequency_hz = 1555492500.0;
2571 
2572  /**
2573  * The size of the signal acquisition search space (in Hz) around the center
2574  * frequency.
2575  *
2576  * For example, a value of 6000 will search +/- 3 kHz around the center
2577  * frequency.
2578  */
2579  float search_window_hz = 2000.0;
2580 
2581  /**
2582  * If `true`, only output data frames with the configured service ID.
2583  * Otherwise, output all decoded frames.
2584  */
2585  bool filter_data_by_service_id = true;
2586 
2587  /** Enable/disable the descrambler. */
2588  bool use_descrambler = true;
2589 
2590  /** Service ID of the provider. */
2591  uint16_t pmp_service_id = 0x5555;
2592 
2593  /** Unique word of the provider. */
2594  uint64_t pmp_unique_word = 0xE15AE893E15AE893ull;
2595 
2596  /** Data rate of the provider (bps). */
2597  uint16_t pmp_data_rate_bps = 4800;
2598 
2599  /** The initialization value for the descrambling vector. */
2600  uint16_t descrambler_init = 0x6969;
2601 };
2602 
2603 #pragma pack(pop)
2604 
2605 } // namespace messages
2606 } // namespace fusion_engine
2607 } // 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 remote network IP address or hostname 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.
@ LEXUS_RX450H
@ 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:685
@ 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
@ FILE_PATH
Configure the path to a local file or UNIX domain socket.
@ 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
@ ISUZU_F_SERIES
@ 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