Example for updating the MTi-1's firmware. Uses a platform independent, retargetable pure C implementation of the firmware updater protocol.
MtInterface Class Reference
Abstract interface for communicating with an Xsens Motion Tracker (MT) on an mbed platform. More...
Inherited by MtInterfaceMtssp, and MtInterfaceUart.
Public Member Functions | |
MtInterface () | |
Constructs an MtInterface. | |
virtual | ~MtInterface () |
Destructor. | |
virtual void | process ()=0 |
This function must be periodically called from the main loop. Classes which inherid from MtInterface can place functionality which must run periodically in this function. | |
virtual void | sendXbusMessage (XbusMessage const *xbusMessage)=0 |
Interface for sending xbus messages to the module. | |
virtual XbusBusFormat | busFormat ()=0 |
Interface for requesting the low level format used by an MtInterface instance. | |
XbusMessage * | getXbusMessage () |
Returns the next message from the rx queue or NULL if the queue is empty. | |
void | releaseXbusMessage (XbusMessage *xbusMessage) |
Releases an xbus message previously obtained by a call to getXbusMessage() | |
XbusMessage * | sendAndWait (XbusMessage const *xbusMessage) |
Sends an Xbus message and waits for the related acknowledge. | |
Protected Member Functions | |
void * | allocateMessageData (size_t bufferSize) |
Callback function for XbusParserCallback to allocate a block of memory. | |
void | deallocateMessageData (void const *buffer) |
Callback function for XbusParserCallback to deallocate a block of memory. | |
void | xbusParserCallbackFunction (struct XbusMessage const *message) |
Callback function for XbusParserCallback that handles a completely received xbus message from the motion tracker. | |
Friends | |
void * | allocateMessageDataWrapper (size_t bufferSize) |
Callback function for XbusParserCallback for allocating a block of memory. | |
void | deallocateMessageDataWrapper (void const *buffer) |
Callback function for XbusParserCallback for deallocating a block of memory. | |
void | xbusParserCallbackFunctionWrapper (struct XbusMessage const *message) |
Callback function for XbusParserCallback that handles completely received xbus messages from the motion tracker. |
Detailed Description
Abstract interface for communicating with an Xsens Motion Tracker (MT) on an mbed platform.
MtInterface defines an abstract interface for communicating with a Motion Tracker (MT) via xbus messages. Depending on the type of communication interface a specific implementation must be made which inherits from MtInterface.
Definition at line 25 of file mtinterface.h.
Constructor & Destructor Documentation
MtInterface | ( | ) |
Constructs an MtInterface.
- Note:
- Only a single instance of MtInterface is allowed
Definition at line 64 of file mtinterface.cpp.
~MtInterface | ( | ) | [virtual] |
Destructor.
Definition at line 80 of file mtinterface.cpp.
Member Function Documentation
void * allocateMessageData | ( | size_t | bufferSize ) | [protected] |
Callback function for XbusParserCallback to allocate a block of memory.
- Parameters:
-
bufferSize buffer size
Definition at line 117 of file mtinterface.cpp.
virtual XbusBusFormat busFormat | ( | ) | [pure virtual] |
Interface for requesting the low level format used by an MtInterface instance.
Implemented in MtInterfaceMtssp, and MtInterfaceUart.
void deallocateMessageData | ( | void const * | buffer ) | [protected] |
Callback function for XbusParserCallback to deallocate a block of memory.
- Parameters:
-
buffer Pointer to the buffer that should be deallocated
Definition at line 129 of file mtinterface.cpp.
XbusMessage * getXbusMessage | ( | ) |
Returns the next message from the rx queue or NULL if the queue is empty.
- Note:
- The caller must dealocate the message with releaseXbusMessage() after use.
Definition at line 89 of file mtinterface.cpp.
virtual void process | ( | ) | [pure virtual] |
This function must be periodically called from the main loop. Classes which inherid from MtInterface can place functionality which must run periodically in this function.
Implemented in MtInterfaceMtssp, and MtInterfaceUart.
void releaseXbusMessage | ( | XbusMessage * | xbusMessage ) |
Releases an xbus message previously obtained by a call to getXbusMessage()
- Parameters:
-
xbusMessage that should be released
Definition at line 104 of file mtinterface.cpp.
XbusMessage * sendAndWait | ( | XbusMessage const * | xbusMessage ) |
Sends an Xbus message and waits for the related acknowledge.
- Returns:
- 0 if no related message was received. Pointer to the message otherwise. This message can also be an error message.
Definition at line 149 of file mtinterface.cpp.
virtual void sendXbusMessage | ( | XbusMessage const * | xbusMessage ) | [pure virtual] |
Interface for sending xbus messages to the module.
Implemented in MtInterfaceMtssp, and MtInterfaceUart.
void xbusParserCallbackFunction | ( | struct XbusMessage const * | message ) | [protected] |
Callback function for XbusParserCallback that handles a completely received xbus message from the motion tracker.
- Parameters:
-
message Pointer to the received xbus message
Definition at line 138 of file mtinterface.cpp.
Friends And Related Function Documentation
void* allocateMessageDataWrapper | ( | size_t | bufferSize ) | [friend] |
Callback function for XbusParserCallback for allocating a block of memory.
- Parameters:
-
bufferSize buffer size
Definition at line 37 of file mtinterface.cpp.
void deallocateMessageDataWrapper | ( | void const * | buffer ) | [friend] |
Callback function for XbusParserCallback for deallocating a block of memory.
- Parameters:
-
buffer Pointer to the buffer that should be deallocated
Definition at line 46 of file mtinterface.cpp.
void xbusParserCallbackFunctionWrapper | ( | struct XbusMessage const * | message ) | [friend] |
Callback function for XbusParserCallback that handles completely received xbus messages from the motion tracker.
- Parameters:
-
Pointer to the received xbus message
Definition at line 55 of file mtinterface.cpp.
Generated on Wed Jul 13 2022 07:56:16 by 1.7.2