MIP SDK  0.0.1
MicroStrain Communications Library for embedded systems
Namespaces | Classes | Typedefs | Enumerations | Functions
mip Namespace Reference

A collection of C++ classes and functions covering the full mip api. More...

Namespaces

 C
 
 commands_3dm
 
 commands_base
 
 commands_filter
 
 commands_gnss
 
 commands_rtk
 
 commands_system
 
 data_filter
 
 data_gnss
 
 data_sensor
 
 data_shared
 
 data_system
 
 platform
 

Classes

struct  CompositeDescriptor
 Convenience struct holding both descriptor set and field descriptor. More...
 
struct  Bitfield
 A dummy struct which is used to mark bitfield objects. More...
 
struct  MipFieldInfo
 
class  Field
 C++ class representing a MIP field. More...
 
class  Packet
 C++ class representing a MIP Packet. More...
 
class  Parser
 C++ class representing a MIP parser. More...
 
struct  Dispatcher
 
struct  CmdQueue
 C++ wrapper around a command queue. More...
 
struct  PendingCmd
 C++ class representing the state of a MIP command. More...
 
class  Connection
 Represents a type of connection to a MIP device. More...
 
class  DeviceInterface
 Represents a connected MIP device. More...
 
struct  CmdResult
 Represents the status of a MIP command. More...
 
class  Serializer
 Serialization class. More...
 

Typedefs

using DescriptorRate = C::mip_descriptor_rate
 
using PacketLength = C::packet_length
 
using DispatchHandler = C::mip_dispatch_handler
 
using RemainingCount = C::remaining_count
 
using Timestamp = C::timestamp_type
 
using Timeout = C::timeout_type
 

Enumerations

enum class  FunctionSelector : uint8_t {
  WRITE = C::MIP_FUNCTION_WRITE , READ = C::MIP_FUNCTION_READ , SAVE = C::MIP_FUNCTION_SAVE , LOAD = C::MIP_FUNCTION_LOAD ,
  RESET = C::MIP_FUNCTION_RESET
}
 

Functions

bool mip_is_valid_descriptor_set (uint8_t descriptor_set)
 Determines if the descriptor set is valid. More...
 
bool mip_is_data_descriptor_set (uint8_t descriptor_set)
 Determines if the descriptor set represents some kind of data. More...
 
bool mip_is_cmd_descriptor_set (uint8_t descriptor_set)
 Determines if the descriptor set contains commands. More...
 
bool mip_is_reserved_descriptor_set (uint8_t descriptor_set)
 Determines if the descriptor is reserved for special purposes. More...
 
bool mip_is_valid_field_descriptor (uint8_t field_descriptor)
 Determines if the field descriptor is valid. More...
 
bool mip_is_cmd_field_descriptor (uint8_t field_descriptor)
 Determines if the field descriptor is a command. More...
 
bool mip_is_reply_field_descriptor (uint8_t field_descriptor)
 Determines if the field descriptor is for an ack/nack reply. More...
 
bool mip_is_response_field_descriptor (uint8_t field_descriptor)
 Determines if the field descriptor contains response data from a command. More...
 
bool mip_is_reserved_cmd_field_descriptor (uint8_t field_descriptor)
 Determines if the field descriptor is reserved. More...
 
bool mip_is_shared_data_field_descriptor (uint8_t field_descriptor)
 Determines if the field descriptor is from the shared data set. More...
 
void insert_mip_function_selector (mip_serializer *serializer, enum mip_function_selector self)
 
void extract_mip_function_selector (mip_serializer *serializer, enum mip_function_selector *self)
 
void insert_mip_descriptor_rate (mip_serializer *serializer, const mip_descriptor_rate *self)
 
void extract_mip_descriptor_rate (mip_serializer *serializer, mip_descriptor_rate *self)
 
template<class Derived >
void insert (Serializer &serializer, const Bitfield< Derived > &bitfield)
 
template<class Derived >
void extract (Serializer &serializer, Bitfield< Derived > &bitfield)
 
bool isValidDescriptorSet (uint8_t descriptorSet)
 
bool isDataDescriptorSet (uint8_t descriptorSet)
 
bool isCommandDescriptorSet (uint8_t descriptorSet)
 
bool isReservedDescriptorSet (uint8_t descriptorSet)
 
bool isValidFieldDescriptor (uint8_t fieldDescriptor)
 
bool isCommandFieldDescriptor (uint8_t fieldDescriptor)
 
bool isReplyFieldDescriptor (uint8_t fieldDescriptor)
 
bool isResponseFieldDescriptor (uint8_t fieldDescriptor)
 
bool isReservedFieldDescriptor (uint8_t fieldDescriptor)
 
bool isSharedDataFieldDescriptor (uint8_t fieldDescriptor)
 
void insert (Serializer &serializer, const DescriptorRate &self)
 
void extract (Serializer &serializer, DescriptorRate &self)
 
template<class Function >
bool parseMipDataFromSource (C::mip_parser &parser, Function reader, size_t maxPackets)
 Read data from a source into the internal parsing buffer. More...
 
template<class Cmd >
CmdResult runCommand (C::mip_interface &device, const Cmd &cmd, Timeout additionalTime=0)
 
template<class Cmd >
CmdResult runCommand (C::mip_interface &device, const Cmd &cmd, typename Cmd::Response &response, Timeout additionalTime=0)
 
template<class Cmd , class... Args>
CmdResult runCommand (C::mip_interface &device, const Args &&... args, Timeout additionalTime)
 
template<class Cmd >
bool startCommand (C::mip_interface &device, C::mip_pending_cmd &pending, const Cmd &cmd, Timeout additionalTime)
 
const char * mip_cmd_result_to_string (enum mip_cmd_result result)
 Converts the command result to a string for debugging. More...
 
bool mip_cmd_result_is_finished (enum mip_cmd_result status)
 Determines if the command has completed, timed out, been cancelled, or otherwise is no longer waiting for a response. More...
 
bool mip_cmd_result_is_reply (enum mip_cmd_result result)
 Determines if the result is a reply from the device (i.e. mip_ack). More...
 
bool mip_cmd_result_is_status (enum mip_cmd_result result)
 Determines if the result code was generated by this lib (i.e. mip_cmd_status). More...
 
bool mip_cmd_result_is_ack (enum mip_cmd_result result)
 Determines if the result is an ack (successful response from the device) More...
 
void mip_serializer_init_insertion (mip_serializer *serializer, uint8_t *buffer, size_t buffer_size)
 Initialize a serialization struct for insertion into a buffer. More...
 
void mip_serializer_init_extraction (mip_serializer *serializer, const uint8_t *buffer, size_t buffer_size)
 Initialize a serialization struct for extract from a buffer. More...
 
void mip_serializer_init_from_field (mip_serializer *serializer, const mip_field *field)
 Initialize a serialization struct from a MIP field payload. More...
 
size_t mip_serializer_capacity (const mip_serializer *serializer)
 Determines the total length the buffer. More...
 
size_t mip_serializer_length (const mip_serializer *serializer)
 Determines the length of the data in the buffer. More...
 
remaining_count mip_serializer_remaining (const mip_serializer *serializer)
 Determines the difference between the length and buffer size. More...
 
bool mip_serializer_is_ok (const mip_serializer *serializer)
 Determines if the data read/written is less than the buffer size. More...
 
bool mip_serializer_is_complete (const mip_serializer *serializer)
 Determines if the number of remaining bytes is 0. More...
 
void extract_count (mip_serializer *serializer, uint8_t *count_out, uint8_t max_count)
 Similar to extract_u8 but allows a maximum value to be specified. More...
 
void insert (Serializer &serializer, bool value)
 
void insert (Serializer &serializer, char value)
 
void insert (Serializer &serializer, uint8_t value)
 
void insert (Serializer &serializer, uint16_t value)
 
void insert (Serializer &serializer, uint32_t value)
 
void insert (Serializer &serializer, uint64_t value)
 
void insert (Serializer &serializer, int8_t value)
 
void insert (Serializer &serializer, int16_t value)
 
void insert (Serializer &serializer, int32_t value)
 
void insert (Serializer &serializer, int64_t value)
 
void insert (Serializer &serializer, float value)
 
void insert (Serializer &serializer, double value)
 
template<typename Enum >
std::enable_if< std::is_enum< Enum >::value, void >::type insert (Serializer &serializer, Enum value)
 Inserts an enum into the buffer. More...
 
template<typename T >
bool insert (const T &value, uint8_t *buffer, size_t bufferSize)
 Insert the given value into the buffer. More...
 
void extract (Serializer &serializer, bool &value)
 
void extract (Serializer &serializer, char &value)
 
void extract (Serializer &serializer, uint8_t &value)
 
void extract (Serializer &serializer, uint16_t &value)
 
void extract (Serializer &serializer, uint32_t &value)
 
void extract (Serializer &serializer, uint64_t &value)
 
void extract (Serializer &serializer, int8_t &value)
 
void extract (Serializer &serializer, int16_t &value)
 
void extract (Serializer &serializer, int32_t &value)
 
void extract (Serializer &serializer, int64_t &value)
 
void extract (Serializer &serializer, float &value)
 
void extract (Serializer &serializer, double &value)
 
template<typename Enum >
std::enable_if< std::is_enum< Enum >::value, void >::type extract (Serializer &serializer, Enum &value)
 Extract an enum from the buffer. More...
 
template<typename T >
bool extract (T &value_out, const uint8_t *buffer, size_t bufferSize, size_t offset=0, bool exact_size=false)
 Extract the value given a buffer, size, and starting offset. More...
 

Detailed Description

A collection of C++ classes and functions covering the full mip api.

See also
MIP C++ API

Typedef Documentation

◆ DescriptorRate

◆ PacketLength

◆ RemainingCount

◆ Timeout

using mip::Timeout = typedef C::timeout_type

◆ Timestamp

Enumeration Type Documentation

◆ FunctionSelector

enum mip::FunctionSelector : uint8_t
strong
Enumerator
WRITE 
READ 
SAVE 
LOAD 
RESET 

Function Documentation

◆ extract() [1/2]

template<class Derived >
void mip::extract ( Serializer serializer,
Bitfield< Derived > &  bitfield 
)

◆ extract() [2/2]

void mip::extract ( Serializer serializer,
DescriptorRate self 
)
inline

◆ extract_count()

void mip::extract_count ( mip_serializer *  serializer,
uint8_t *  count_out,
uint8_t  max_count 
)

Similar to extract_u8 but allows a maximum value to be specified.

If the maximum count would be exceeded, an error is generated which causes further extraction to fail.

Parameters
serializer
count_outThe counter value read from the buffer.
max_countThe maximum value of the counter. If the count exceeds this, it is set to 0 and the serializer is put into an error state.

◆ extract_mip_descriptor_rate()

void mip::extract_mip_descriptor_rate ( mip_serializer *  serializer,
mip_descriptor_rate *  self 
)

◆ extract_mip_function_selector()

void mip::extract_mip_function_selector ( mip_serializer *  serializer,
enum mip_function_selector *  self 
)

◆ insert() [1/2]

template<class Derived >
void mip::insert ( Serializer serializer,
const Bitfield< Derived > &  bitfield 
)

◆ insert() [2/2]

void mip::insert ( Serializer serializer,
const DescriptorRate self 
)
inline

◆ insert_mip_descriptor_rate()

void mip::insert_mip_descriptor_rate ( mip_serializer *  serializer,
const mip_descriptor_rate *  self 
)

◆ insert_mip_function_selector()

void mip::insert_mip_function_selector ( mip_serializer *  serializer,
enum mip_function_selector  self 
)

◆ isCommandDescriptorSet()

bool mip::isCommandDescriptorSet ( uint8_t  descriptorSet)
inline

◆ isCommandFieldDescriptor()

bool mip::isCommandFieldDescriptor ( uint8_t  fieldDescriptor)
inline

◆ isDataDescriptorSet()

bool mip::isDataDescriptorSet ( uint8_t  descriptorSet)
inline

◆ isReplyFieldDescriptor()

bool mip::isReplyFieldDescriptor ( uint8_t  fieldDescriptor)
inline

◆ isReservedDescriptorSet()

bool mip::isReservedDescriptorSet ( uint8_t  descriptorSet)
inline

◆ isReservedFieldDescriptor()

bool mip::isReservedFieldDescriptor ( uint8_t  fieldDescriptor)
inline

◆ isResponseFieldDescriptor()

bool mip::isResponseFieldDescriptor ( uint8_t  fieldDescriptor)
inline

◆ isSharedDataFieldDescriptor()

bool mip::isSharedDataFieldDescriptor ( uint8_t  fieldDescriptor)
inline

◆ isValidDescriptorSet()

bool mip::isValidDescriptorSet ( uint8_t  descriptorSet)
inline

◆ isValidFieldDescriptor()

bool mip::isValidFieldDescriptor ( uint8_t  fieldDescriptor)
inline

◆ mip_cmd_result_is_ack()

bool mip::mip_cmd_result_is_ack ( enum mip_cmd_result  result)

Determines if the result is an ack (successful response from the device)

◆ mip_cmd_result_is_finished()

bool mip::mip_cmd_result_is_finished ( enum mip_cmd_result  status)

Determines if the command has completed, timed out, been cancelled, or otherwise is no longer waiting for a response.

◆ mip_cmd_result_is_reply()

bool mip::mip_cmd_result_is_reply ( enum mip_cmd_result  result)

Determines if the result is a reply from the device (i.e. mip_ack).

◆ mip_cmd_result_is_status()

bool mip::mip_cmd_result_is_status ( enum mip_cmd_result  result)

Determines if the result code was generated by this lib (i.e. mip_cmd_status).

◆ mip_cmd_result_to_string()

const char* mip::mip_cmd_result_to_string ( enum mip_cmd_result  result)

Converts the command result to a string for debugging.

Parameters
resultAny value.
Returns
A constant string.

◆ mip_is_cmd_descriptor_set()

bool mip::mip_is_cmd_descriptor_set ( uint8_t  descriptor_set)

Determines if the descriptor set contains commands.

Parameters
descriptor_set
Returns
true if the descriptor set contains commands.

◆ mip_is_cmd_field_descriptor()

bool mip::mip_is_cmd_field_descriptor ( uint8_t  field_descriptor)

Determines if the field descriptor is a command.

Parameters
field_descriptor
Returns
true if the field descriptor represents a command.

◆ mip_is_data_descriptor_set()

bool mip::mip_is_data_descriptor_set ( uint8_t  descriptor_set)

Determines if the descriptor set represents some kind of data.

Parameters
descriptor_set
Returns
true if the descriptor set represents data.

◆ mip_is_reply_field_descriptor()

bool mip::mip_is_reply_field_descriptor ( uint8_t  field_descriptor)

Determines if the field descriptor is for an ack/nack reply.

Parameters
field_descriptor
Returns
true if the field descriptor represents an ack/nack reply code.

◆ mip_is_reserved_cmd_field_descriptor()

bool mip::mip_is_reserved_cmd_field_descriptor ( uint8_t  field_descriptor)

Determines if the field descriptor is reserved.

The descriptor set is assumed to be a command set.

Parameters
field_descriptor
Returns
true if the associated field is neither a command nor response.

◆ mip_is_reserved_descriptor_set()

bool mip::mip_is_reserved_descriptor_set ( uint8_t  descriptor_set)

Determines if the descriptor is reserved for special purposes.

Parameters
descriptor_set
Returns
true if the descriptor set is reserved.

◆ mip_is_response_field_descriptor()

bool mip::mip_is_response_field_descriptor ( uint8_t  field_descriptor)

Determines if the field descriptor contains response data from a command.

The descriptor set is assumed to be a command set.

Parameters
field_descriptor
Returns
true if the associated field contains response data.

◆ mip_is_shared_data_field_descriptor()

bool mip::mip_is_shared_data_field_descriptor ( uint8_t  field_descriptor)

Determines if the field descriptor is from the shared data set.

The descriptor set is assumed to be a data set.

Parameters
field_descriptor
Returns
true if the associated field is from the shared data set.

◆ mip_is_valid_descriptor_set()

bool mip::mip_is_valid_descriptor_set ( uint8_t  descriptor_set)

Determines if the descriptor set is valid.

Parameters
descriptor_set
Returns
true if the descriptor set is valid.

◆ mip_is_valid_field_descriptor()

bool mip::mip_is_valid_field_descriptor ( uint8_t  field_descriptor)

Determines if the field descriptor is valid.

Parameters
field_descriptor
Returns
true if the field descriptor is valid.

◆ mip_serializer_capacity()

size_t mip::mip_serializer_capacity ( const mip_serializer *  serializer)

Determines the total length the buffer.

Parameters
serializer
Returns
The buffer size.

◆ mip_serializer_init_extraction()

void mip::mip_serializer_init_extraction ( mip_serializer *  serializer,
const uint8_t *  buffer,
size_t  buffer_size 
)

Initialize a serialization struct for extract from a buffer.

Parameters
serializer
bufferA pointer from which data will be read.
buffer_sizeMaximum number of bytes to be read from the buffer.

◆ mip_serializer_init_from_field()

void mip::mip_serializer_init_from_field ( mip_serializer *  serializer,
const mip_field *  field 
)

Initialize a serialization struct from a MIP field payload.

Parameters
serializer
field

◆ mip_serializer_init_insertion()

void mip::mip_serializer_init_insertion ( mip_serializer *  serializer,
uint8_t *  buffer,
size_t  buffer_size 
)

Initialize a serialization struct for insertion into a buffer.

Parameters
serializer
bufferBuffer into which data will be written. Can be NULL if buffer_size==0.
buffer_sizeSize of the buffer. Data will not be written beyond this size.

◆ mip_serializer_is_complete()

bool mip::mip_serializer_is_complete ( const mip_serializer *  serializer)

Determines if the number of remaining bytes is 0.

Use this to determine if the entire buffer has been extracted. It is not particularly useful for insertion.

Parameters
serializer
Returns
true if mip_serializer_remaining() == 0.

◆ mip_serializer_is_ok()

bool mip::mip_serializer_is_ok ( const mip_serializer *  serializer)

Determines if the data read/written is less than the buffer size.

If the application attempts to read or write beyond the end of the buffer (as defined by the buffer_size passed to the init function), the read or write will be a no-op but the offset will still be advanced. This allows the condition to be detected.

Parameters
serializer
Returns
true if mip_serializer_remaining() >= 0.

◆ mip_serializer_length()

size_t mip::mip_serializer_length ( const mip_serializer *  serializer)

Determines the length of the data in the buffer.

Parameters
serializerFor insertion, returns how many bytes have been written. For extraction, returns how many bytes have been read.
Note
This may exceed the buffer size. Check mip_serializer_is_ok() before using the data.

◆ mip_serializer_remaining()

remaining_count mip::mip_serializer_remaining ( const mip_serializer *  serializer)

Determines the difference between the length and buffer size.

Parameters
serializerFor insertion, returns how many unwritten bytes remain in the buffer. For extraction, returns how many bytes have not been read.
Note
This can be a negative number if the application attempted to write or read more data than contained in the buffer. This is not a bug and it can be detected with the mip_serializer_is_ok() function.