text: #ifndef __SBG_ECOM_CMD_COMMON_H__
  #define __SBG_ECOM_CMD_COMMON_H__
  
  #include "../common/sbgECom.h"
  
  #define SBG_ECOM_DEFAULT_CMD_TIME_OUT	(500)
  
  typedef enum _SbgEComRejectionMode
  {
  	SBG_ECOM_NEVER_ACCEPT_MODE		= 0,		/*!< Measurement is not taken into account. */
  	SBG_ECOM_AUTOMATIC_MODE			= 1,		/*!< Measurement is accepted and rejected automatically depending on consistency checks */
  	SBG_ECOM_ALWAYS_ACCEPT_MODE		= 2			/*!< Measurement is always accepted. Should be used with caution */
  } SbgEComRejectionMode;
  
  /*!
   * List of all axis directions for modules/sensor alignment.
   */
  typedef enum _SbgEComAxisDirection
  {
  	SBG_ECOM_ALIGNMENT_FORWARD		= 0,		/*!< IMU/module Axis is turned in vehicle's forward direction. */
  	SBG_ECOM_ALIGNMENT_BACKWARD		= 1,		/*!< IMU/module Axis is turned in vehicle's backward direction. */
  	SBG_ECOM_ALIGNMENT_LEFT			= 2,		/*!< IMU/module Axis is turned in vehicle's left direction. */
  	SBG_ECOM_ALIGNMENT_RIGHT		= 3,		/*!< IMU/module Axis is turned in vehicle's right direction. */
  	SBG_ECOM_ALIGNMENT_UP			= 4,		/*!< IMU/module Axis is turned in vehicle's up direction. */
  	SBG_ECOM_ALIGNMENT_DOWN			= 5			/*!< IMU/module Axis is turned in vehicle's down direction. */
  } SbgEComAxisDirection;
  
  /*!
   * Common model information structure.
   * This is used for motion profile or Magnetometer,Gps, or other aiding sensor error model.
   */
  typedef struct _SbgEComModelInfo
  {
  	uint32	id;									/*!< Identifier of the model */
  	uint32	revision;							/*!< Revision of the model */
  } SbgEComModelInfo;
  
  //----------------------------------------------------------------------//
  //- Common command reception operations                                -//
  //----------------------------------------------------------------------//
  
  /*!
   *	Wait until any command that is not a output log is recevied during a specific time out.
   *	All binary logs received during this time are handled trough the standard callback system.
   *	\param[in]	pHandle					A valid sbgECom handle.
   *	\param[out]	pMsgClass				Pointer used to hold the received command class.
   *	\param[out]	pMsg					Pointer used to hold the received command ID.
   *	\param[out]	pData					Allocated buffer used to hold received data field.
   *	\param[out]	pSize					Pointer used to hold the received data field size.
   *	\param[in]	maxSize					Max number of bytes that can be stored in the pData buffer.
   *	\param[in]	timeOut					Time out in ms during which we can receive the command.
   *	\return								SBG_NO_ERROR if we have received a valid frame.<br>
   *										SBG_NOT_READY if we haven't received a valid frame or if the serial buffer is empty.<br>
   *										SBG_INVALID_CRC if the received frame has an invalid CRC.<br>
   *										SBG_NULL_POINTER if an input parameter is NULL.<br>
   *										SBG_BUFFER_OVERFLOW if the received frame payload couldn't fit into the pData buffer.
   *										SBG_TIME_OUT if the command hasn't been received withint the specified time out.
   */
  SbgErrorCode sbgEComReceiveAnyCmd(SbgEComHandle *pHandle, uint8 *pMsgClass, uint8 *pMsg, void *pData, size_t *pSize, size_t maxSize, uint32 timeOut);
  
  /*!
   *	Wait for a specific command to be received given a time out.
   *	All binary logs received during this time are handled trough the standard callback system.
   *	\param[in]	pHandle					A valid sbgECom handle.
   *	\param[out]	msgClass				Command class we expect to receive
   *	\param[out]	msg						Message id we expect to receive
   *	\param[out]	pData					Allocated buffer used to hold received data field.
   *	\param[out]	pSize					Pointer used to hold the received data field size.
   *	\param[in]	maxSize					Max number of bytes that can be stored in the pData buffer.
   *	\param[in]	timeOut					Time out in ms during which we can receive the command.
   *	\return								SBG_NO_ERROR if we have received a valid frame.<br>
   *										SBG_NOT_READY if we haven't received a valid frame or if the serial buffer is empty.<br>
   *										SBG_INVALID_CRC if the received frame has an invalid CRC.<br>
   *										SBG_NULL_POINTER if an input parameter is NULL.<br>
   *										SBG_BUFFER_OVERFLOW if the received frame payload couldn't fit into the pData buffer.
   *										SBG_TIME_OUT if the command hasn't been received withint the specified time out.
   */
  SbgErrorCode sbgEComReceiveCmd(SbgEComHandle *pHandle, uint8 msgClass, uint8 msg, void *pData, size_t *pSize, size_t maxSize, uint32 timeOut);
  
  //----------------------------------------------------------------------//
  //- ACK related commands  operations                                   -//
  //----------------------------------------------------------------------//
  
  /*!
   * Wait for an ACK for a specified amount of time.
   * \param[in]	pHandle						A valid sbgECom handle.
   * \param[in]	msgClass					The message class that we want to check
   * \param[in]	msg							The message ID that we want to check
   * \param[in]	timeOut						Time out in ms during which we can receive the ACK.
   * \return									SBG_NO_ERROR if the ACK has been received.
   */
  SbgErrorCode sbgEComWaitForAck(SbgEComHandle *pHandle, uint8 msgClass, uint8 msg, uint32 timeOut);
  
  /*!
   * Send an ACK for a specific command with an associated error code.
   * \param[in]	pHandle						A valid sbgECom handle.
   * \param[in]	msgClass					The message class that we want to send
   * \param[in]	msg							The message ID that we want to send.
   * \param[in]	cmdError					The associated error code.
   * \return									SBG_NO_ERROR if the ACK has been sent.
   */
  SbgErrorCode sbgEComSendAck(SbgEComHandle *pHandle, uint8 msgClass, uint8 msg, SbgErrorCode cmdError);
  
  //----------------------------------------------------------------------//
  //- Generic command definitions                                        -//
  //----------------------------------------------------------------------//
  
  /*!
   *	Generic function to set an error model ID
   *	\param[in]	pHandle						A valid sbgECom handle.
   *	\param[in]	msgClass					Original message class
  *	\param[in]	msg							Original message ID
   *	\param[out]	modelId						Model ID to use
   *	\return									SBG_NO_ERR
   OR if the command has been executed successfully.
   */
  SbgErrorCode sbgEComCmdGenericSetModelId(SbgEComHandle *pHandle, uint8 msgClass, uint8 msg, uint32 modelId);
  
  /*!
   *	Generic function to retrieve error model information.
   *	\param[in]	pHandle						A valid sbgECom handle.
   *	\param[in]	msgClass					Original message class
  *	\param[in]	msg							Original message ID
   *	\param[out]	pMotionProfileInfo			Pointer to a SbgEComModelInfo to contain model info.
   *	\return									SBG_NO_ERROR if the command has been executed successfully.
   */
  SbgErrorCode sbgEComCmdGenericGetModelInfo(SbgEComHandle *pHandle, uint8 msgClass, uint8 msg, SbgEComModelInfo *pModelInfo);
  
  #endif