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

Embed: (wiki syntax)

« Back to documentation index

xbusparser.h File Reference

xbusparser.h File Reference

Go to the source code of this file.

Data Structures

struct  XbusParserCallback
 Callback function structure for use with the XbusParser. More...

Functions

size_t XbusParser_mem (void)
 Get the amount of memory needed for the XbusParser structure.
struct XbusParser * XbusParser_create (struct XbusParserCallback const *callback)
 Create a new XbusParser object.
void XbusParser_destroy (struct XbusParser *parser)
 Frees an XbusParser structure allocated by XbusParser_create().
struct XbusParser * XbusParser_init (void *parserMem, struct XbusParserCallback const *callback)
 Initializes an XbusParser in the passed memory location.
void XbusParser_parseByte (struct XbusParser *parser, uint8_t byte)
 Parse a byte of data from a motion tracker.
void XbusParser_parseBuffer (struct XbusParser *parser, uint8_t const *buf, size_t bufSize)
 Parse a buffer of data received from a motion tracker.

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 xbusparser.h.


Function Documentation

struct XbusParser* XbusParser_create ( struct XbusParserCallback const *  callback ) [read]

Create a new XbusParser object.

Parameters:
callbackPointer 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.

Definition at line 70 of file xbusparser.c.

void XbusParser_destroy ( struct XbusParser *  parser )

Frees an XbusParser structure allocated by XbusParser_create().

Definition at line 83 of file xbusparser.c.

struct XbusParser* XbusParser_init ( void *  parserMem,
struct XbusParserCallback const *  callback 
) [read]

Initializes an XbusParser in the passed memory location.

Parameters:
parserMemPointer to memory to use for storing parser state. Should be at least as big as the value returned by XbusParser_mem().
callbackPointer to callback structure containing callback functions for memory management and handling received messages.
Returns:
Initialized XbusParser structure.

Definition at line 96 of file xbusparser.c.

size_t XbusParser_mem ( void   )

Get the amount of memory needed for the XbusParser structure.

Definition at line 57 of file xbusparser.c.

void XbusParser_parseBuffer ( struct XbusParser *  parser,
uint8_t const *  buf,
size_t  bufSize 
)

Parse a buffer of data received from a motion tracker.

Definition at line 290 of file xbusparser.c.

void XbusParser_parseByte ( struct XbusParser *  parser,
const uint8_t  byte 
)

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.

Definition at line 201 of file xbusparser.c.