27 if ( (pInterface) && (pHandle) )
92 uint8 receivedMsgClass;
315 strcpy(errorMsg,
"SBG_NO_ERROR: No error.");
318 strcpy(errorMsg,
"SBG_ERROR: Generic error.");
321 strcpy(errorMsg,
"SBG_NULL_POINTER: A pointer is null.");
324 strcpy(errorMsg,
"SBG_INVALID_CRC: The received frame has an invalid CRC.");
327 strcpy(errorMsg,
"SBG_INVALID_FRAME: The received frame is invalid.");
330 strcpy(errorMsg,
"SBG_TIME_OUT: We have a time out during frame reception.");
333 strcpy(errorMsg,
"SBG_WRITE_ERROR: All bytes hasn't been written.");
336 strcpy(errorMsg,
"SBG_READ_ERROR: All bytes hasn't been read.");
339 strcpy(errorMsg,
"SBG_BUFFER_OVERFLOW: A buffer is too small to contain so much data.");
342 strcpy(errorMsg,
"SBG_INVALID_PARAMETER: An invalid parameter has been founded.");
345 strcpy(errorMsg,
"SBG_NOT_READY: A device isn't ready (Rx isn't ready for example).");
348 strcpy(errorMsg,
"SBG_MALLOC_FAILED: Failed to allocate a buffer.");
351 strcpy(errorMsg,
"SGB_CALIB_MAG_NOT_ENOUGH_POINTS: Not enough points were available to perform magnetometers calibration.");
354 strcpy(errorMsg,
"SBG_CALIB_MAG_INVALID_TAKE: The calibration procedure could not be properly executed due to insufficient precision.");
357 strcpy(errorMsg,
"SBG_CALIB_MAG_SATURATION: Saturation were detected when attempt to calibrate magnetos.");
360 strcpy(errorMsg,
"SBG_CALIB_MAG_POINTS_NOT_IN_A_PLANE: 2D calibration procedure could not be performed.");
363 strcpy(errorMsg,
"SBG_DEVICE_NOT_FOUND: A device couldn't be founded or opened.");
366 strcpy(errorMsg,
"SBG_OPERATION_CANCELLED: An operation has been cancelled by a user.");
369 strcpy(errorMsg,
"SBG_NOT_CONTINUOUS_FRAME: We have received a frame that isn't a continuous one.");
372 strcpy(errorMsg,
"SBG_INCOMPATIBLE_HARDWARE: Hence valid, the configuration cannot be executed because of incompatible hardware.");
375 sprintf(errorMsg,
"Undefined error code: %u", errorCode);
Contains main sbgECom methods.
This file groups all common definitions required by all commands.
SbgErrorCode sbgEComHandleOneLog(SbgEComHandle *pHandle)
Used to read/write data from/to a memory buffer stream.
SbgErrorCode(* SbgEComReceiveLogFunc)(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg)
SbgEComReceiveFunc pReceiveCallback
SbgEComProtocol protocolHandle
SbgErrorCode sbgEComProtocolInit(SbgEComProtocol *pHandle, SbgInterface *pInterface)
uint32 sbgEComGetVersion(void)
SbgErrorCode sbgEComHandle(SbgEComHandle *pHandle)
#define SBG_ECOM_BUILD_ID(classId, logId)
SbgErrorCode sbgEComProtocolReceive(SbgEComProtocol *pHandle, uint8 *pMsgClass, uint8 *pMsg, void *pData, size_t *pSize, size_t maxSize)
SbgErrorCode(* SbgEComReceiveFunc)(SbgEComHandle *pHandle, SbgEComCmdId logCmd, const SbgBinaryLogData *pLogData, void *pUserArg)
SbgEComReceiveLogFunc pReceiveLogCallback
void sbgEComSetCmdTrialsAndTimeOut(SbgEComHandle *pHandle, uint32 numTrials, uint32 cmdDefaultTimeOut)
const char * sbgEComGetVersionAsString(void)
#define SBG_ECOM_DEFAULT_CMD_TIME_OUT
SbgErrorCode sbgEComSetReceiveLogCallback(SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg)
#define SBG_LOG_WARNING(errorCode, format,...)
#define SBG_E_COM_VERSION
SbgErrorCode sbgEComSetReceiveCallback(SbgEComHandle *pHandle, SbgEComReceiveFunc pReceiveCallback, void *pUserArg)
#define SBG_ASSERT(expression)
enum _SbgEComClass SbgEComClass
SBG_INLINE bool sbgEComMsgClassIsALog(SbgEComClass msgClass)
void sbgEComErrorToString(SbgErrorCode errorCode, char errorMsg[256])
SbgErrorCode sbgEComProtocolClose(SbgEComProtocol *pHandle)
Header file that contains all versions related information such as change log.
#define SBG_E_COM_VERSION_STR
SbgErrorCode sbgEComInit(SbgEComHandle *pHandle, SbgInterface *pInterface)
#define SBG_ECOM_MAX_PAYLOAD_SIZE
enum _SbgErrorCode SbgErrorCode
SbgErrorCode sbgEComClose(SbgEComHandle *pHandle)
SbgErrorCode sbgEComBinaryLogParse(SbgEComClass msgClass, SbgEComMsgId msg, const void *pPayload, size_t payloadSize, SbgBinaryLogData *pOutputData)