MIP SDK  0.0.1
MicroStrain Communications Library for embedded systems
commands_system.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "descriptors.h"
4 #include "../mip_result.h"
5 
6 #include <stdint.h>
7 #include <stddef.h>
8 #include <stdbool.h>
9 
10 namespace mip {
11 class Serializer;
12 
13 namespace C {
14 struct mip_interface;
15 } // namespace C
16 
17 namespace commands_system {
18 
25 
27 // Descriptors
29 
30 enum
31 {
33 
34  CMD_ENUMERATE = 0x01,
35  CMD_COM_MODE = 0x10,
38 
42 };
43 
45 // Shared Type Definitions
47 
48 static const uint8_t MIP_SYSTEM_COMMAND_COMM_MODE_PASSTHRU = 0x00;
49 static const uint8_t MIP_SYSTEM_COMMAND_COMM_MODE_NORMAL = 0x01;
50 static const uint8_t MIP_SYSTEM_COMMAND_COMM_MODE_IMU = 0x02;
51 static const uint8_t MIP_SYSTEM_COMMAND_COMM_MODE_GPS = 0x03;
52 
54 // Mip Fields
56 
70 
71 struct CommMode
72 {
75 
76  static const bool HAS_WRITE_FUNCTION = true;
77  static const bool HAS_READ_FUNCTION = true;
78  static const bool HAS_SAVE_FUNCTION = false;
79  static const bool HAS_LOAD_FUNCTION = false;
80  static const bool HAS_RESET_FUNCTION = true;
81 
82  FunctionSelector function = static_cast<FunctionSelector>(0);
83  uint8_t mode = 0;
84 
85  struct Response
86  {
89 
90  uint8_t mode = 0;
91 
92  };
93 };
94 void insert(Serializer& serializer, const CommMode& self);
95 void extract(Serializer& serializer, CommMode& self);
96 
97 void insert(Serializer& serializer, const CommMode::Response& self);
98 void extract(Serializer& serializer, CommMode::Response& self);
99 
100 CmdResult writeCommMode(C::mip_interface& device, uint8_t mode);
101 CmdResult readCommMode(C::mip_interface& device, uint8_t* modeOut);
105 
110 } // namespace commands_system
111 } // namespace mip
112 
Serialization class.
Definition: serialization.h:145
CmdResult readCommMode(C::mip_interface &device, uint8_t *modeOut)
Definition: commands_system.cpp:76
void extract(Serializer &serializer, CommMode &self)
Definition: commands_system.cpp:42
CmdResult defaultCommMode(C::mip_interface &device)
Definition: commands_system.cpp:99
void insert(Serializer &serializer, const CommMode &self)
Definition: commands_system.cpp:32
CmdResult writeCommMode(C::mip_interface &device, uint8_t mode)
Definition: commands_system.cpp:64
struct mip::C::mip_interface mip_interface
State of the interface for communicating with a MIP device.
@ CMD_HARDWARE_CONTROL_2
Definition: commands_system.hpp:37
@ REPLY_COM_MODE
Definition: commands_system.hpp:39
@ REPLY_HARDWARE_CONTROL_2
Definition: commands_system.hpp:41
@ CMD_ENUMERATE
Definition: commands_system.hpp:34
@ CMD_COM_MODE
Definition: commands_system.hpp:35
@ REPLY_HARDWARE_CONTROL
Definition: commands_system.hpp:40
@ DESCRIPTOR_SET
Definition: commands_system.hpp:32
@ CMD_HARDWARE_CONTROL
Definition: commands_system.hpp:36
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
FunctionSelector
Definition: descriptors.h:102
State of the interface for communicating with a MIP device.
Definition: mip_interface.h:52
Represents the status of a MIP command.
Definition: mip_result.h:67
Definition: commands_system.hpp:86
static const uint8_t DESCRIPTOR_SET
Definition: commands_system.hpp:87
static const uint8_t FIELD_DESCRIPTOR
Definition: commands_system.hpp:88
uint8_t mode
Definition: commands_system.hpp:90
Definition: commands_system.hpp:72
static const bool HAS_RESET_FUNCTION
Definition: commands_system.hpp:80
static const uint8_t FIELD_DESCRIPTOR
Definition: commands_system.hpp:74
static const bool HAS_LOAD_FUNCTION
Definition: commands_system.hpp:79
uint8_t mode
Definition: commands_system.hpp:83
static const bool HAS_SAVE_FUNCTION
Definition: commands_system.hpp:78
static const bool HAS_READ_FUNCTION
Definition: commands_system.hpp:77
static const bool HAS_WRITE_FUNCTION
Definition: commands_system.hpp:76
static const uint8_t DESCRIPTOR_SET
Definition: commands_system.hpp:73