26 if ( (pInterface) && (pHandle) )
90 uint8_t receivedMsgClass;
230 assert(numTrials > 0);
231 assert(cmdDefaultTimeOut > 0);
255 strcpy(errorMsg,
"SBG_NO_ERROR: No error.");
258 strcpy(errorMsg,
"SBG_ERROR: Generic error.");
261 strcpy(errorMsg,
"SBG_NULL_POINTER: A pointer is null.");
264 strcpy(errorMsg,
"SBG_INVALID_CRC: The received frame has an invalid CRC.");
267 strcpy(errorMsg,
"SBG_INVALID_FRAME: The received frame is invalid.");
270 strcpy(errorMsg,
"SBG_TIME_OUT: We have a time out during frame reception.");
273 strcpy(errorMsg,
"SBG_WRITE_ERROR: All bytes hasn't been written.");
276 strcpy(errorMsg,
"SBG_READ_ERROR: All bytes hasn't been read.");
279 strcpy(errorMsg,
"SBG_BUFFER_OVERFLOW: A buffer is too small to contain so much data.");
282 strcpy(errorMsg,
"SBG_INVALID_PARAMETER: An invalid parameter has been founded.");
285 strcpy(errorMsg,
"SBG_NOT_READY: A device isn't ready (Rx isn't ready for example).");
288 strcpy(errorMsg,
"SBG_MALLOC_FAILED: Failed to allocate a buffer.");
291 strcpy(errorMsg,
"SGB_CALIB_MAG_NOT_ENOUGH_POINTS: Not enough points were available to perform magnetometers calibration.");
294 strcpy(errorMsg,
"SBG_CALIB_MAG_INVALID_TAKE: The calibration procedure could not be properly executed due to insufficient precision.");
297 strcpy(errorMsg,
"SBG_CALIB_MAG_SATURATION: Saturation were detected when attempt to calibrate magnetos.");
300 strcpy(errorMsg,
"SBG_CALIB_MAG_POINTS_NOT_IN_A_PLANE: 2D calibration procedure could not be performed.");
303 strcpy(errorMsg,
"SBG_DEVICE_NOT_FOUND: A device couldn't be founded or opened.");
306 strcpy(errorMsg,
"SBG_OPERATION_CANCELLED: An operation has been cancelled by a user.");
309 strcpy(errorMsg,
"SBG_NOT_CONTINUOUS_FRAME: We have received a frame that isn't a continuous one.");
312 strcpy(errorMsg,
"SBG_INCOMPATIBLE_HARDWARE: Hence valid, the configuration cannot be executed because of incompatible hardware.");
315 sprintf(errorMsg,
"Undefined error code: %u", errorCode);
Contains main sbgECom methods.
This file groups all common definitions required by all commands.
SbgErrorCode sbgEComProtocolReceive(SbgEComProtocol *pHandle, uint8_t *pMsgClass, uint8_t *pMsg, void *pData, size_t *pSize, size_t maxSize)
SbgErrorCode sbgEComHandleOneLog(SbgEComHandle *pHandle)
#define SBG_LOG_WARNING(format,...)
Used to read/write data from/to a memory buffer stream.
SbgErrorCode(* SbgEComReceiveLogFunc)(SbgEComHandle *pHandle, SbgEComClass msgClass, SbgEComMsgId msg, const SbgBinaryLogData *pLogData, void *pUserArg)
void sbgEComSetCmdTrialsAndTimeOut(SbgEComHandle *pHandle, uint32_t numTrials, uint32_t cmdDefaultTimeOut)
SbgEComProtocol protocolHandle
SbgErrorCode sbgEComProtocolInit(SbgEComProtocol *pHandle, SbgInterface *pInterface)
uint32_t cmdDefaultTimeOut
SbgErrorCode sbgEComHandle(SbgEComHandle *pHandle)
SbgEComReceiveLogFunc pReceiveLogCallback
#define SBG_ECOM_DEFAULT_CMD_TIME_OUT
SbgErrorCode sbgEComSetReceiveLogCallback(SbgEComHandle *pHandle, SbgEComReceiveLogFunc pReceiveLogCallback, void *pUserArg)
enum _SbgEComClass SbgEComClass
SBG_INLINE bool sbgEComMsgClassIsALog(SbgEComClass msgClass)
void sbgEComErrorToString(SbgErrorCode errorCode, char errorMsg[256])
SbgErrorCode sbgEComProtocolClose(SbgEComProtocol *pHandle)
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)