rikbeuncode

Dependencies:   mbed-rtos mbed Xbus

Fork of MTi-1_example by Xsens

Files at this revision

API Documentation at this revision

Comitter:
alexandery
Date:
Tue Jun 16 07:57:51 2015 +0000
Parent:
61:b9d3e7e5ba0c
Child:
63:138c196f0b88
Commit message:
Extract Xbus code into a library.

Changed in this revision

xbus.lib Show annotated file Show diff for this revision Revisions of this file
xbus/xbusdef.h Show diff for this revision Revisions of this file
xbus/xbusmessage.c Show diff for this revision Revisions of this file
xbus/xbusmessage.h Show diff for this revision Revisions of this file
xbus/xbusparser.c Show diff for this revision Revisions of this file
xbus/xbusparser.h Show diff for this revision Revisions of this file
xbus/xbusutility.c Show diff for this revision Revisions of this file
xbus/xbusutility.h Show diff for this revision Revisions of this file
xbus/xsdeviceid.c Show diff for this revision Revisions of this file
xbus/xsdeviceid.h Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xbus.lib	Tue Jun 16 07:57:51 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Xsens/code/Xbus/#eb25b1785ee4
--- a/xbus/xbusdef.h	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#ifndef __XBUSDEF_H
-#define __XBUSDEF_H
-
-/*! \brief Xbus message preamble byte. */
-#define XBUS_PREAMBLE (0xFA)
-/*! \brief Xbus message bus ID for master devices. */
-#define XBUS_MASTERDEVICE (0xFF)
-/*! \brief Xbus length byte for messages without payload. */
-#define XBUS_NO_PAYLOAD (0x00)
-/*! \brief Xbus length byte for message with an extended payload. */
-#define XBUS_EXTENDED_LENGTH (0xFF)
-
-#endif // __XBUSDEF_H
--- a/xbus/xbusmessage.c	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#include "xbusmessage.h"
-#include "xbusdef.h"
-#include "xbusutility.h"
-
-/*!
- * \brief Calculate the number of bytes needed for \a message payload.
- */
-static uint16_t messageLength(struct XbusMessage const* message)
-{
-	switch (message->mid)
-	{
-		case XMID_SetOutputConfig:
-			return message->length * 2 * sizeof(uint16_t);
-
-		default:
-			return message->length;
-	}
-}
-
-/*!
- * \brief Format a message with a pointer to an array of OutputConfiguration elements.
- */
-static void formatOutputConfig(uint8_t* raw, struct XbusMessage const* message)
-{
-	struct OutputConfiguration* conf = message->data;
-	for (int i = 0; i < message->length; ++i)
-	{
-		raw = XbusUtility_writeU16(raw, conf->dtype);
-		raw = XbusUtility_writeU16(raw, conf->freq);
-		++conf;
-	}
-}
-
-/*!
- * \brief Format the payload of a message from a native data type to
- * raw bytes.
- */
-static void formatPayload(uint8_t* raw, struct XbusMessage const* message)
-{
-	switch (message->mid)
-	{
-		case XMID_SetOutputConfig:
-			formatOutputConfig(raw, message);
-			break;
-
-		default:
-			for (int i = 0; i < message->length; ++i)
-			{
-				*raw++ = ((uint8_t*)message->data)[i];
-			}
-			break;
-	}
-}
-
-/*!
- * \brief Format a message into the raw Xbus format ready for transmission to
- * a motion tracker.
- */
-size_t XbusMessage_format(uint8_t* raw, struct XbusMessage const* message)
-{
-	uint8_t* dptr = raw;
-	*dptr++ = XBUS_PREAMBLE;
-
-	*dptr = XBUS_MASTERDEVICE;
-	uint8_t checksum = 0;
-	checksum -= *dptr++;
-
-	*dptr = message->mid;
-	checksum -= *dptr++;
-
-	uint16_t length = messageLength(message);
-
-	if (length < XBUS_EXTENDED_LENGTH)
-	{
-		*dptr = length;
-		checksum -= *dptr++;
-	}
-	else
-	{
-		*dptr = XBUS_EXTENDED_LENGTH;
-		checksum -= *dptr++;
-		*dptr = length >> 8;
-		checksum -= *dptr++;
-		*dptr = length & 0xFF;
-		checksum -= *dptr++;
-	}
-
-	formatPayload(dptr, message);
-	for (int i = 0; i < length; ++i)
-	{
-		checksum -= *dptr++;
-	}
-	*dptr++ = checksum;
-
-	return dptr - raw;
-}
-
-/*!
- * \brief Get a pointer to the data corresponding to \a id.
- * \param id The data identifier to find in the message.
- * \param data Pointer to the raw message payload.
- * \param dataLength The length of the payload in bytes.
- * \returns Pointer to data item, or NULL if the identifier is not present in
- * the message.
- */
-static uint8_t const* getPointerToData(enum XsDataIdentifier id, uint8_t const* data, uint16_t dataLength)
-{
-	uint8_t const* dptr = data;
-	while (dptr < data + dataLength)
-	{
-		uint16_t itemId;
-		uint8_t itemSize;
-		dptr = XbusUtility_readU16(&itemId, dptr);
-		dptr = XbusUtility_readU8(&itemSize, dptr);
-
-		if (id == itemId)
-			return dptr;
-
-		dptr += itemSize;
-	}
-	return NULL;
-}
-
-/*!
- * \brief Read a number of floats from a message payload.
- * \param out Pointer to where to output data.
- * \param raw Pointer to the start of the raw float data.
- * \param floats The number of floats to read.
- */
-static void readFloats(float* out, uint8_t const* raw, uint8_t floats)
-{
-	for (int i = 0; i < floats; ++i)
-	{
-		raw = XbusUtility_readU32((uint32_t*)&out[i], raw);
-	}
-}
-
-/*!
- * \brief Get a data item from an XMID_MtData2 Xbus message.
- * \param item Pointer to where to store the data.
- * \param id The data identifier to get.
- * \param message The message to read the data item from.
- * \returns true if the data item is found in the message, else false.
- */
-bool XbusMessage_getDataItem(void* item, enum XsDataIdentifier id, struct XbusMessage const* message)
-{
-	uint8_t const* raw = getPointerToData(id, message->data, message->length);
-	if (raw)
-	{
-		switch (id)
-		{
-			case XDI_PacketCounter:
-				raw = XbusUtility_readU16(item, raw);
-				break;
-
-			case XDI_SampleTimeFine:
-			case XDI_StatusWord:
-				raw = XbusUtility_readU32(item, raw);
-				break;
-
-			case XDI_Quaternion:
-			case XDI_DeltaQ:
-				readFloats(item, raw, 4);
-				break;
-
-			case XDI_DeltaV:
-			case XDI_Acceleration:
-			case XDI_RateOfTurn:
-			case XDI_MagneticField:
-				readFloats(item, raw, 3);
-				break;
-
-			default:
-				return false;
-		}
-		return true;
-	}
-	else
-	{
-		return false;
-	}
-}
-
-/*!
- * \brief Get a string description for the passed data identifier.
- */
-char const* XbusMessage_dataDescription(enum XsDataIdentifier id)
-{
-	switch (id)
-	{
-		case XDI_PacketCounter:
-			return "Packet counter";
-
-		case XDI_SampleTimeFine:
-			return "Sample time fine";
-
-		case XDI_Quaternion:
-			return "Quaternion";
-
-		case XDI_DeltaV:
-			return "Velocity increment";
-
-		case XDI_Acceleration:
-			return "Acceleration";
-
-		case XDI_RateOfTurn:
-			return "Rate of turn";
-
-		case XDI_DeltaQ:
-			return "Orientation increment";
-
-		case XDI_MagneticField:
-			return "Magnetic field";
-
-		case XDI_StatusWord:
-			return "Status word";
-
-		default:
-			return "Unknown data type";
-	}
-}
--- a/xbus/xbusmessage.h	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#ifndef __XBUSMESSAGE_H
-#define __XBUSMESSAGE_H
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*! \brief Xbus message IDs. */
-enum XsMessageId
-{
-	XMID_Wakeup             = 0x3E,
-	XMID_WakeupAck          = 0x3F,
-	XMID_ReqDid             = 0x00,
-	XMID_DeviceId           = 0x01,
-	XMID_GotoConfig         = 0x30,
-	XMID_GotoConfigAck      = 0x31,
-	XMID_GotoMeasurement    = 0x10,
-	XMID_GotoMeasurementAck = 0x11,
-	XMID_MtData2            = 0x36,
-	XMID_ReqOutputConfig    = 0xC0,
-	XMID_SetOutputConfig    = 0xC0,
-	XMID_OutputConfig       = 0xC1,
-	XMID_Reset              = 0x40,
-	XMID_ResetAck           = 0x41,
-	XMID_Error              = 0x42,
-};
-
-/*! \brief Xbus data message type IDs. */
-enum XsDataIdentifier
-{
-	XDI_PacketCounter  = 0x1020,
-	XDI_SampleTimeFine = 0x1060,
-	XDI_Quaternion     = 0x2010,
-	XDI_DeltaV         = 0x4010,
-	XDI_Acceleration   = 0x4020,
-	XDI_RateOfTurn     = 0x8020,
-	XDI_DeltaQ         = 0x8030,
-	XDI_MagneticField  = 0xC020,
-	XDI_StatusWord     = 0xE020,
-};
-
-/*!
- * \brief An Xbus message structure with optional payload.
- */
-struct XbusMessage
-{
-	/*! \brief The message ID of the message. */
-	enum XsMessageId mid;
-	/*!
-	 * \brief The length of the payload.
-	 *
-	 * \note The meaning of the length is message dependent. For example,
-	 * for XMID_OutputConfig messages it is the number of OutputConfiguration
-	 * elements in the configuration array.
-	 */
-	uint16_t length;
-	/*! \brief Pointer to the payload data. */
-	void* data;
-};
-
-/*!
- * \brief Output configuration structure.
- */
-struct OutputConfiguration
-{
-	/*! \brief Data type of the output. */
-	enum XsDataIdentifier dtype;
-	/*!
-	 * \brief The output frequency in Hz, or 65535 if the value should be
-	 * included in every data message.
-	 */
-	uint16_t freq;
-};
-
-size_t XbusMessage_format(uint8_t* raw, struct XbusMessage const* message);
-bool XbusMessage_getDataItem(void* item, enum XsDataIdentifier id, struct XbusMessage const* message);
-char const* XbusMessage_dataDescription(enum XsDataIdentifier id);
-
-#ifdef __cplusplus
-}
-#endif // extern "C"
-
-#endif // __XBUSMESSAGE_H
--- a/xbus/xbusparser.c	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#include "xbusparser.h"
-#include "xbusdef.h"
-#include "xbusutility.h"
-#include <stdlib.h>
-#include <string.h>
-
-/*! \brief XbusParser states. */
-enum XbusParserState
-{
-	XBPS_Preamble,          /*!< \brief Looking for preamble. */
-	XBPS_BusId,             /*!< \brief Waiting for bus ID. */
-	XBPS_MessageId,         /*!< \brief Waiting for message ID. */
-	XBPS_Length,            /*!< \brief Waiting for length. */
-	XBPS_ExtendedLengthMsb, /*!< \brief Waiting for extended length MSB*/
-	XBPS_ExtendedLengthLsb, /*!< \brief Waiting for extended length LSB*/
-	XBPS_Payload,           /*!< \brief Reading payload. */
-	XBPS_Checksum           /*!< \brief Waiting for checksum. */
-};
-
-/*!
- * \brief Xbus Parser state structure.
- */
-struct XbusParser
-{
-	/*! \brief Callbacks for memory management, and message handling. */
-	struct XbusParserCallback callbacks;
-	/*! \brief Storage for the current message being received. */
-	struct XbusMessage currentMessage;
-	/*! \brief The number of bytes of payload received for the current message. */
-	uint16_t payloadReceived;
-	/*! \brief The calculated checksum for the current message. */
-	uint8_t checksum;
-	/*! \brief The state of the parser. */
-	enum XbusParserState state;
-};
-
-/*!
- * \brief Get the amount of memory needed for the XbusParser structure.
- */
-size_t XbusParser_mem(void)
-{
-	return sizeof(struct XbusParser);
-}
-
-/*!
- * \brief Create a new XbusParser object.
- * \param callback Pointer to callback structure containing callback functions
- * for memory management and handling received messages.
- * \returns Pointer the new XbusParser structure.
- *
- * Uses malloc to allocate the memory required for the parser.
- */
-struct XbusParser* XbusParser_create(struct XbusParserCallback const* callback)
-{
-	void* mem = malloc(XbusParser_mem());
-	if (mem)
-	{
-		return XbusParser_init(mem, callback);
-	}
-	return NULL;
-}
-
-/*!
- * \brief Frees an XbusParser structure allocated by XbusParser_create().
- */
-void XbusParser_destroy(struct XbusParser* parser)
-{
-	free(parser);
-}
-
-/*!
- * \brief Initializes an XbusParser in the passed memory location.
- * \param parserMem Pointer to memory to use for storing parser state. Should
- * be at least as big as the value returned by XbusParser_mem().
- * \param callback Pointer to callback structure containing callback functions
- * for memory management and handling received messages.
- * \returns Initialized XbusParser structure.
- */
-struct XbusParser* XbusParser_init(void* parserMem, struct XbusParserCallback const* callback)
-{
-	struct XbusParser* parser = (struct XbusParser*)parserMem;
-	parser->state = XBPS_Preamble;
-	parser->callbacks.allocateBuffer = callback->allocateBuffer;
-	parser->callbacks.deallocateBuffer = callback->deallocateBuffer;
-	parser->callbacks.handleMessage = callback->handleMessage;
-	return parser;
-}
-
-/*!
- * \brief Parse an XMID_DeviceId message to extract the device ID value.
-
- * Replaces the raw Xbus message data with the device ID.
- */
-static void parseDeviceId(struct XbusParser* parser, uint8_t const* rawData)
-{
-	uint32_t* deviceId = parser->callbacks.allocateBuffer(sizeof(uint32_t));
-	if (deviceId)
-	{
-		XbusUtility_readU32(deviceId, rawData);
-		parser->currentMessage.data = deviceId;
-		parser->currentMessage.length = 1;
-	}
-	else
-	{
-		parser->currentMessage.data = NULL;
-	}
-}
-
-/*!
- * \brief Parse an XMID_OutputConfig message.
- *
- * Replaces the raw Xbus message data with an array of OutputConfiguration
- * structures.
- */
-static void parseOutputConfig(struct XbusParser* parser, uint8_t const* rawData)
-{
-	uint8_t fields = parser->currentMessage.length / 4;
-	struct OutputConfiguration* conf = parser->callbacks.allocateBuffer(fields * sizeof(struct OutputConfiguration));
-	if (conf)
-	{
-		parser->currentMessage.data = conf;
-		parser->currentMessage.length = fields;
-
-		for (int i = 0; i < fields; ++i)
-		{
-			rawData = XbusUtility_readU16((uint16_t*)&conf->dtype, rawData);
-			rawData = XbusUtility_readU16(&conf->freq, rawData);
-			++conf;
-		}
-	}
-	else
-	{
-		parser->currentMessage.data = NULL;
-	}
-}
-
-/*!
- * \brief Converts raw Xbus payload data to native structures if possible.
- *
- * Raw data payloads are converted to native data structures and the
- * message data pointer is changed to point to the native structure.
- * The raw data is automatically deallocated.
- */
-static void parseMessagePayload(struct XbusParser* parser)
-{
-	uint8_t const* const rawData = parser->currentMessage.data;
-	switch (parser->currentMessage.mid)
-	{
-		default:
-			// Leave parsing and memory management to user code
-			return;
-
-		case XMID_DeviceId:
-			parseDeviceId(parser, rawData);
-			break;
-
-		case XMID_OutputConfig:
-			parseOutputConfig(parser, rawData);
-			break;
-	}
-
-	if (rawData)
-		parser->callbacks.deallocateBuffer(rawData);
-}
-
-/*!
- * \brief Prepare for receiving a message payload.
- *
- * Requests a memory area to store the received data to using the
- * registered callbacks.
- */
-void prepareForPayload(struct XbusParser* parser)
-{
-	parser->payloadReceived = 0;
-	parser->currentMessage.data = parser->callbacks.allocateBuffer(parser->currentMessage.length);
-}
-
-/*!
- * \brief Parse a byte of data from a motion tracker.
- *
- * When a complete message is received the user will be notified by a call
- * to the handleMessage() callback function.
- */
-void XbusParser_parseByte(struct XbusParser* parser, const uint8_t byte)
-{
-	switch (parser->state)
-	{
-		case XBPS_Preamble:
-			if (byte == XBUS_PREAMBLE)
-			{
-				parser->checksum = 0;
-				parser->state = XBPS_BusId;
-			}
-			break;
-
-		case XBPS_BusId:
-			parser->checksum += byte;
-			parser->state = XBPS_MessageId;
-			break;
-
-		case XBPS_MessageId:
-			parser->checksum += byte;
-			parser->currentMessage.mid = (enum XsMessageId)byte;
-			parser->state = XBPS_Length;
-			break;
-
-		case XBPS_Length:
-			parser->checksum += byte;
-			if (byte == XBUS_NO_PAYLOAD)
-			{
-				parser->currentMessage.length = byte;
-				parser->currentMessage.data = NULL;
-				parser->state = XBPS_Checksum;
-			}
-			else if (byte < XBUS_EXTENDED_LENGTH)
-			{
-				parser->currentMessage.length = byte;
-				prepareForPayload(parser);
-				parser->state = XBPS_Payload;
-			}
-			else
-			{
-				parser->state = XBPS_ExtendedLengthMsb;
-			}
-			break;
-
-		case XBPS_ExtendedLengthMsb:
-			parser->checksum += byte;
-			parser->currentMessage.length = ((uint16_t)byte) << 8;
-			parser->state = XBPS_ExtendedLengthLsb;
-			break;
-
-		case XBPS_ExtendedLengthLsb:
-			parser->checksum += byte;
-			parser->currentMessage.length |= byte;
-			prepareForPayload(parser);
-			parser->state = XBPS_Payload;
-			break;
-
-		case XBPS_Payload:
-			parser->checksum += byte;
-			if (parser->currentMessage.data)
-			{
-				((uint8_t*)parser->currentMessage.data)[parser->payloadReceived] = byte;
-			}
-			if (++parser->payloadReceived == parser->currentMessage.length)
-			{
-				parser->state = XBPS_Checksum;
-			}
-			break;
-
-		case XBPS_Checksum:
-			parser->checksum += byte;
-			if ((parser->checksum == 0) &&
-					((parser->currentMessage.length == 0) ||
-					 parser->currentMessage.data))
-			{
-				parseMessagePayload(parser);
-				parser->callbacks.handleMessage(&parser->currentMessage);
-			}
-			else if (parser->currentMessage.data)
-			{
-				parser->callbacks.deallocateBuffer(parser->currentMessage.data);
-			}
-			parser->state = XBPS_Preamble;
-			break;
-	}
-}
-
-/*!
- * \brief Parse a buffer of data received from a motion tracker.
- */
-void XbusParser_parseBuffer(struct XbusParser* parser, uint8_t const* buf, size_t bufSize)
-{
-	for (size_t i = 0; i < bufSize; ++i)
-	{
-		XbusParser_parseByte(parser, buf[i]);
-	}
-}
-
--- a/xbus/xbusparser.h	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#ifndef __XBUSPARSER_H
-#define __XBUSPARSER_H
-
-#include <stddef.h>
-#include <stdint.h>
-#include "xbusmessage.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct XbusParser;
-
-/*!
- * \brief Callback function structure for use with the XbusParser.
- */
-struct XbusParserCallback
-{
-	/*!
-	 * \brief Allocate a buffer for message reception.
-	 * \param bufSize The size of the buffer to allocate.
-	 * \returns Pointer to buffer to use for message reception, or NULL if
-	 * a buffer cannot be allocated.
-	 *
-	 * \note It is the resposibility of the user to deallocate the message
-	 * data buffers pointed to by XbusMessage structures passed to the
-	 * handleMessage() callback function.
-	 */
-	void* (*allocateBuffer)(size_t bufSize);
-
-	/*!
-	 * \brief Deallocate a buffer that was previously allocated by a call to
-	 * allocateBuffer.
-	 */
-	void (*deallocateBuffer)(void const* buffer);
-
-	/*!
-	 * \brief Handle a received message.
-	 *
-	 * \note If the passed XbusMessage structure has a non-null data pointer
-	 * then it is the responsibility of the user to free this once handling
-	 * of the message is complete.
-	 */
-	void (*handleMessage)(struct XbusMessage const* message);
-};
-
-size_t XbusParser_mem(void);
-struct XbusParser* XbusParser_create(struct XbusParserCallback const* callback);
-void XbusParser_destroy(struct XbusParser* parser);
-struct XbusParser* XbusParser_init(void* parserMem, struct XbusParserCallback const* callback);
-
-void XbusParser_parseByte(struct XbusParser* parser, uint8_t byte);
-void XbusParser_parseBuffer(struct XbusParser* parser, uint8_t const* buf, size_t bufSize);
-
-#ifdef __cplusplus
-}
-#endif // extern "C"
-
-#endif // __XBUSPARSER_H
--- a/xbus/xbusutility.c	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#include "xbusutility.h"
-
-/*!
- * \name Xbus message reading utility functions.
- * Xbus messages use big-endian representations for multibyte data.
- * These functions help in reading data from an Xbus message and converting
- * it to a native type.
- *
- * The functions are intended to scan over a message as follows:
- * \code
- * void readValues(XbusMessage const* message)
- * {
- *     uint16_t v1;
- *     uint8_t v2;
- *     uint32_t v3;
- *     uint8_t* dptr = message->data;
- *     dptr = XbusUtility_readU16(&v1, dptr);
- *     dptr = XbusUtility_readU8(&v2, dptr);
- *     dptr = XbusUtility_readU32(&v3, dptr);
- * }
- * \endcode
- * \{
- */
-/*!
- * \brief Read a uint8_t value from an Xbus message.
- */
-uint8_t const* XbusUtility_readU8(uint8_t* out, uint8_t const* in)
-{
-	*out = *in;
-	return ++in;
-}
-
-/*! \brief Read a uint16_t value from an Xbus message. */
-uint8_t const* XbusUtility_readU16(uint16_t* out, uint8_t const* in)
-{
-	*out = (in[0] << 8) | in[1];
-	return in + sizeof(uint16_t);
-}
-
-/*! \brief Read a uint32_t value from an Xbus message. */
-uint8_t const* XbusUtility_readU32(uint32_t* out, uint8_t const* in)
-{
-	*out = (in[0] << 24) | (in[1] << 16) | (in[2] << 8) | in[3];
-	return in + sizeof(uint32_t);
-}
-/*! \} */
-
-/*!
- * \name Xbus message writing utility functions.
- * These functions aid in writing native values to big-endian xbus message
- * payloads. See corresponding reading functions for further details.
- * \{
- */
-/*! \brief Write a uint8_t value to an Xbus message. */
-uint8_t* XbusUtility_writeU8(uint8_t* out, uint8_t in)
-{
-	*out++ = in;
-	return out;
-}
-
-/*! \brief Write a uint16_t value to an Xbus message. */
-uint8_t* XbusUtility_writeU16(uint8_t* out, uint16_t in)
-{
-	*out++ = (in >> 8) & 0xFF;
-	*out++ = in & 0xFF;
-	return out;
-}
-
-/*! \brief Write a uint32_t value to an Xbus message. */
-uint8_t* XbusUtility_writeU32(uint8_t* out, uint32_t in)
-{
-	*out++ = (in >> 24) & 0xFF;
-	*out++ = (in >> 16) & 0xFF;
-	*out++ = (in >> 8) & 0xFF;
-	*out++ = in & 0xFF;
-	return out;
-}
-/*! \}  */
--- a/xbus/xbusutility.h	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#ifndef __XBUSUTILITY_H
-#define __XBUSUTILITY_H
-
-#include <stdint.h>
-
-uint8_t const* XbusUtility_readU8(uint8_t* out, uint8_t const* in);
-uint8_t const* XbusUtility_readU16(uint16_t* out, uint8_t const* in);
-uint8_t const* XbusUtility_readU32(uint32_t* out, uint8_t const* in);
-
-uint8_t* XbusUtility_writeU8(uint8_t* out, uint8_t in);
-uint8_t* XbusUtility_writeU16(uint8_t* out, uint16_t in);
-uint8_t* XbusUtility_writeU32(uint8_t* out, uint32_t in);
-
-#endif // __XBUSUTILITY_H
--- a/xbus/xsdeviceid.c	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#include "xsdeviceid.h"
-
-/*!
- * \brief Return true if device ID corresponds to a MTi-1 series device.
- */
-bool XsDeviceId_isMtMk4_X(uint32_t deviceId)
-{
-	uint8_t deviceSeries = (deviceId >> 20) & 0xF;
-	return ((deviceSeries == 0x8) || (deviceSeries == 0xC));
-}
-
-/*!
- * \brief Get a string describing the function of the MTi device.
- */
-char const* XsDeviceId_functionDescription(enum DeviceFunction function)
-{
-	switch (function)
-	{
-		case DF_IMU:
-			return "Inertial Measurement Unit";
-
-		case DF_VRU:
-			return "Vertical Reference Unit";
-
-		case DF_AHRS:
-			return "Attitude Heading Reference System";
-	}
-
-	return "Unknown device function";
-}
-
--- a/xbus/xsdeviceid.h	Fri Jun 12 13:23:26 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*!
- * \file
- * \copyright 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.
- */
-
-#ifndef __XSDEVICEID_H
-#define __XSDEVICEID_H
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-bool XsDeviceId_isMtMk4_X(uint32_t deviceId);
-
-enum DeviceFunction
-{
-	/*! \brief Inertial Measurement Unit. */
-	DF_IMU  = 1,
-	/*! \brief Vertical Reference Unit. */
-	DF_VRU  = 2,
-	/*! \brief Attitude Heading Reference System. */
-	DF_AHRS = 3
-};
-
-/*!
- * \brief Get the function of the MTi device.
- */
-static inline enum DeviceFunction XsDeviceId_getFunction(uint32_t deviceId)
-{
-	return (enum DeviceFunction)((deviceId >> 24) & 0xF);
-}
-
-char const* XsDeviceId_functionDescription(enum DeviceFunction function);
-
-#ifdef __cplusplus
-}
-#endif // extern "C"
-
-#endif // __XSDEVICEID_H