Basic implementation of Xbus message parsing and generation for embedded processors. The code has no dependencies and should also work for other MCU architectures than ARM provided a C99 compiler is available.
Dependents: MTi-1_example_LPC1768 MTi-1_rikbeun MTi-1_example MTi-1_example ... more
xbusmessage.c File Reference
Go to the source code of this file.
Functions | |
static uint16_t | messageLength (struct XbusMessage const *message) |
Calculate the number of bytes needed for message payload. | |
static void | formatOutputConfig (uint8_t *raw, struct XbusMessage const *message) |
Format a message with a pointer to an array of OutputConfiguration elements. | |
static void | formatPayload (uint8_t *raw, struct XbusMessage const *message) |
Format the payload of a message from a native data type to raw bytes. | |
size_t | XbusMessage_format (uint8_t *raw, struct XbusMessage const *message, enum XbusLowLevelFormat format) |
Format a message into the raw Xbus format ready for transmission to a motion tracker. | |
static uint8_t const * | getPointerToData (enum XsDataIdentifier id, uint8_t const *data, uint16_t dataLength) |
Get a pointer to the data corresponding to id. | |
static void | readFloats (float *out, uint8_t const *raw, uint8_t floats) |
Read a number of floats from a message payload. | |
bool | XbusMessage_getDataItem (void *item, enum XsDataIdentifier id, struct XbusMessage const *message) |
Get a data item from an XMID_MtData2 Xbus message. | |
char const * | XbusMessage_dataDescription (enum XsDataIdentifier id) |
Get a string description for the passed data identifier. |
Detailed Description
Copyright (C) Xsens Technologies B.V., 2015.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file xbusmessage.c.
Function Documentation
static void formatOutputConfig | ( | uint8_t * | raw, |
struct XbusMessage const * | message | ||
) | [static] |
Format a message with a pointer to an array of OutputConfiguration elements.
Definition at line 40 of file xbusmessage.c.
static void formatPayload | ( | uint8_t * | raw, |
struct XbusMessage const * | message | ||
) | [static] |
Format the payload of a message from a native data type to raw bytes.
Definition at line 55 of file xbusmessage.c.
static uint8_t const* getPointerToData | ( | enum XsDataIdentifier | id, |
uint8_t const * | data, | ||
uint16_t | dataLength | ||
) | [static] |
Get a pointer to the data corresponding to id.
- Parameters:
-
id The data identifier to find in the message. data Pointer to the raw message payload. dataLength The length of the payload in bytes.
- Returns:
- Pointer to data item, or NULL if the identifier is not present in the message.
Definition at line 145 of file xbusmessage.c.
static uint16_t messageLength | ( | struct XbusMessage const * | message ) | [static] |
Calculate the number of bytes needed for message payload.
Definition at line 25 of file xbusmessage.c.
static void readFloats | ( | float * | out, |
uint8_t const * | raw, | ||
uint8_t | floats | ||
) | [static] |
Read a number of floats from a message payload.
- Parameters:
-
out Pointer to where to output data. raw Pointer to the start of the raw float data. floats The number of floats to read.
Definition at line 169 of file xbusmessage.c.
char const* XbusMessage_dataDescription | ( | enum XsDataIdentifier | id ) |
Get a string description for the passed data identifier.
Definition at line 226 of file xbusmessage.c.
size_t XbusMessage_format | ( | uint8_t * | raw, |
struct XbusMessage const * | message, | ||
enum XbusLowLevelFormat | format | ||
) |
Format a message into the raw Xbus format ready for transmission to a motion tracker.
Definition at line 76 of file xbusmessage.c.
bool XbusMessage_getDataItem | ( | void * | item, |
enum XsDataIdentifier | id, | ||
struct XbusMessage const * | message | ||
) |
Get a data item from an XMID_MtData2 Xbus message.
- Parameters:
-
item Pointer to where to store the data. id The data identifier to get. message The message to read the data item from.
- Returns:
- true if the data item is found in the message, else false.
Definition at line 184 of file xbusmessage.c.
Generated on Thu Jul 14 2022 08:57:02 by 1.7.2