sbgECom Library
4.0.1987-stable
C library to interface SBG Systems IMU/AHRS/INS
|
Contains main sbgECom methods. More...
#include <sbgCommon.h>
#include <interfaces/sbgInterface.h>
#include "sbgECanId.h"
#include "sbgEComIds.h"
#include "logs/sbgEComLog.h"
#include "protocol/sbgEComProtocol.h"
Go to the source code of this file.
Data Structures | |
struct | _SbgEComHandle |
Typedefs | |
typedef struct _SbgEComHandle | SbgEComHandle |
typedef SbgErrorCode(* | SbgEComReceiveLogFunc) (SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgEComLogUnion *pLogData, void *pUserArg) |
Functions | |
SbgErrorCode | sbgEComInit (SbgEComHandle *pHandle, SbgInterface *pInterface) |
SbgErrorCode | sbgEComClose (SbgEComHandle *pHandle) |
SbgErrorCode | sbgEComHandleOneLog (SbgEComHandle *pHandle) |
SbgErrorCode | sbgEComHandle (SbgEComHandle *pHandle) |
SbgErrorCode | sbgEComPurgeIncoming (SbgEComHandle *pHandle) |
void | sbgEComSetReceiveLogCallback (SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg) |
void | sbgEComSetCmdTrialsAndTimeOut (SbgEComHandle *pHandle, uint32_t numTrials, uint32_t cmdDefaultTimeOut) |
void | sbgEComErrorToString (SbgErrorCode errorCode, char errorMsg[256]) |
Contains main sbgECom methods.
The MIT license
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
typedef struct _SbgEComHandle SbgEComHandle |
Interface structure pre-definition.
typedef SbgErrorCode(* SbgEComReceiveLogFunc) (SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgEComLogUnion *pLogData, void *pUserArg) |
Callback definition called each time a new log is received.
[in] | pHandle | Valid handle on the sbgECom instance that has called this callback. |
[in] | msgClass | Class of the message we have received |
[in] | msg | Message ID of the log received. |
[in] | pLogData | Contains the received log data as an union. |
[in] | pUserArg | Optional user supplied argument. |
SbgErrorCode sbgEComInit | ( | SbgEComHandle * | pHandle, |
SbgInterface * | pInterface | ||
) |
Initialize the protocol system used to communicate with the product and return the created handle.
[out] | pHandle | Pointer used to store the allocated and initialized sbgECom handle. |
[in] | pInterface | Interface to use for read/write operations. |
SbgErrorCode sbgEComClose | ( | SbgEComHandle * | pHandle | ) |
Close the protocol system and release associated memory.
[in] | pHandle | A valid sbgECom handle to close. |
SbgErrorCode sbgEComHandleOneLog | ( | SbgEComHandle * | pHandle | ) |
Try to parse one log from the input interface and then return.
[in] | pHandle | A valid sbgECom handle. |
SbgErrorCode sbgEComHandle | ( | SbgEComHandle * | pHandle | ) |
Handle all incoming logs until no more log are available in the input interface.
[in] | pHandle | A valid sbgECom handle. |
SbgErrorCode sbgEComPurgeIncoming | ( | SbgEComHandle * | pHandle | ) |
Purge the interface rx buffer as well as the sbgECom rx work buffer.
For example, if the program flow has been interrupted, this method can be helpful to discard all trash received data.
WARNING: This method is blocking for 100ms and actively tries to read incoming data.
[in] | pHandle | A valid sbgECom handle. |
void sbgEComSetReceiveLogCallback | ( | SbgEComHandle * | pHandle, |
SbgEComReceiveLogFunc | pReceiveLogCallback, | ||
void * | pUserArg | ||
) |
Define the callback that should be called each time a new binary log is received.
[in] | pHandle | A valid sbgECom handle. |
[in] | pReceiveLogCallback | Pointer on the callback to call when a new log is received. |
[in] | pUserArg | Optional user argument that will be passed to the callback method. |
void sbgEComSetCmdTrialsAndTimeOut | ( | SbgEComHandle * | pHandle, |
uint32_t | numTrials, | ||
uint32_t | cmdDefaultTimeOut | ||
) |
Define the default number of trials that should be done when a command is send to the device as well as the time out.
[in] | pHandle | A valid sbgECom handle. |
[in] | numTrials | Number of trials when a command is sent (starting at 1). |
[in] | cmdDefaultTimeOut | Default time out in milliseconds to wait to receive an answer from the device. |
void sbgEComErrorToString | ( | SbgErrorCode | errorCode, |
char | errorMsg[256] | ||
) |
Convert an error code into a human readable string.
[in] | errorCode | The errorCode to convert into a string. |
[out] | errorMsg | String buffer used to hold the error string. |