Functions
sbgEComProtocol.c File Reference
#include "sbgEComProtocol.h"
#include <crc/sbgCrc.h>
Include dependency graph for sbgEComProtocol.c:

Go to the source code of this file.

Functions

SbgErrorCode sbgEComFinalizeFrameGeneration (SbgStreamBuffer *pOutputStream)
 
SbgErrorCode sbgEComProtocolClose (SbgEComProtocol *pHandle)
 
SbgErrorCode sbgEComProtocolInit (SbgEComProtocol *pHandle, SbgInterface *pInterface)
 
SbgErrorCode sbgEComProtocolReceive (SbgEComProtocol *pHandle, uint8 *pMsgClass, uint8 *pMsg, void *pData, size_t *pSize, size_t maxSize)
 
SbgErrorCode sbgEComProtocolSend (SbgEComProtocol *pHandle, uint8 msgClass, uint8 msg, const void *pData, size_t size)
 
SbgErrorCode sbgEComStartFrameGeneration (SbgStreamBuffer *pOutputStream, uint8 msgClass, uint8 msg)
 

Function Documentation

SbgErrorCode sbgEComFinalizeFrameGeneration ( SbgStreamBuffer pOutputStream)

Finalize an output stream that has been initialized with sbgEComStartFrameGeneration.

Parameters
[in]pOutputStreamPointer to an allocated and initialized output stream.
Returns
SBG_NO_ERROR in case of good operation.

Definition at line 507 of file sbgEComProtocol.c.

SbgErrorCode sbgEComProtocolClose ( SbgEComProtocol pHandle)

Close the protocol system.

Parameters
[in]pHandleA valid protocol handle to close.
Returns
SBG_NO_ERROR if we have closed and released the protocol system.

Definition at line 38 of file sbgEComProtocol.c.

SbgErrorCode sbgEComProtocolInit ( SbgEComProtocol pHandle,
SbgInterface pInterface 
)

Initialize the protocol system used to communicate with the product and return the created handle.

Parameters
[in]pHandlePointer on an allocated protocol structure to initialize.
[in]pInterfaceInterface to use for read/write operations.
Returns
SBG_NO_ERROR if we have initialised the protocol system.

Definition at line 14 of file sbgEComProtocol.c.

SbgErrorCode sbgEComProtocolReceive ( SbgEComProtocol pHandle,
uint8 pMsgClass,
uint8 pMsg,
void *  pData,
size_t *  pSize,
size_t  maxSize 
)

Try to receive a frame from the device and returns the cmd, data and size of data field.

Parameters
[in]pHandleA valid protocol handle.
[out]pMsgClassPointer to hold the returned message class
[out]pMsgPointer to hold the returned message id
[out]pDataAllocated buffer used to hold received data field.
[out]pSizePointer used to hold the received data field size.
[in]maxSizeMax number of bytes that can be stored in the pData buffer.
Returns
SBG_NO_ERROR if we have received a valid frame.
SBG_NOT_READY if we haven't received a valid frame or if the serial buffer is empty.
SBG_INVALID_CRC if the received frame has an invalid CRC.
SBG_NULL_POINTER if an input parameter is NULL.
SBG_BUFFER_OVERFLOW if the received frame payload couldn't fit into the pData buffer.

Definition at line 152 of file sbgEComProtocol.c.

SbgErrorCode sbgEComProtocolSend ( SbgEComProtocol pHandle,
uint8  msgClass,
uint8  msg,
const void *  pData,
size_t  size 
)

Send a frame to the device (size should be less than 4086 bytes).

Parameters
[in]pHandleA valid protocol handle.
[in]msgClassMessage class (0-255)
[in]msgMessage id (0-255)
[in]pDataPointer on the data payload to send or NULL if no payload.
[in]sizeSize in bytes of the data payload (less than 4086).
Returns
SBG_NO_ERROR if the frame has been sent.

Definition at line 66 of file sbgEComProtocol.c.

SbgErrorCode sbgEComStartFrameGeneration ( SbgStreamBuffer pOutputStream,
uint8  msgClass,
uint8  msg 
)

Initialize an output stream for an sbgECom frame generation. This method is helpful to avoid memory copy compared to sbgEComProtocolSend one.

Warning, the stream will be seek to the beginning!

Parameters
[in]pOutputStreamPointer to an allocated and initialized output stream.
[in]msgClassMessage class (0-255)
[in]msgMessage id (0-255)
Returns
SBG_NO_ERROR in case of good operation.

Definition at line 472 of file sbgEComProtocol.c.



sbg_driver
Author(s):
autogenerated on Sun Jan 27 2019 03:42:20