Go to the source code of this file.
Functions | |
SbgErrorCode | sbgEComFinalizeFrameGeneration (SbgStreamBuffer *pOutputStream, size_t streamCursor) |
SbgErrorCode | sbgEComProtocolClose (SbgEComProtocol *pHandle) |
SbgErrorCode | sbgEComProtocolInit (SbgEComProtocol *pHandle, SbgInterface *pInterface) |
SbgErrorCode | sbgEComProtocolReceive (SbgEComProtocol *pHandle, uint8_t *pMsgClass, uint8_t *pMsg, void *pData, size_t *pSize, size_t maxSize) |
SbgErrorCode | sbgEComProtocolSend (SbgEComProtocol *pHandle, uint8_t msgClass, uint8_t msg, const void *pData, size_t size) |
SbgErrorCode | sbgEComStartFrameGeneration (SbgStreamBuffer *pOutputStream, uint8_t msgClass, uint8_t msg, size_t *pStreamCursor) |
SbgErrorCode sbgEComFinalizeFrameGeneration | ( | SbgStreamBuffer * | pOutputStream, |
size_t | streamCursor | ||
) |
Finalize an output stream that has been initialized with sbgEComStartFrameGeneration. At return, the output stream buffer should point at the end of the generated message. You can thus easily create consecutive SBG_ECOM_LOGS with these methods.
[in] | pOutputStream | Pointer to an allocated and initialized output stream. |
[in] | streamCursor | Position in the stream buffer of the generated message first byte. This value is returned by sbgEComStartFrameGeneration and is mandatory for correct operations. |
Definition at line 499 of file sbgEComProtocol.c.
SbgErrorCode sbgEComProtocolClose | ( | SbgEComProtocol * | pHandle | ) |
Close the protocol system.
[in] | pHandle | A valid protocol handle to close. |
Definition at line 35 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.
[in] | pHandle | Pointer on an allocated protocol structure to initialize. |
[in] | pInterface | Interface to use for read/write operations. |
Definition at line 14 of file sbgEComProtocol.c.
SbgErrorCode sbgEComProtocolReceive | ( | SbgEComProtocol * | pHandle, |
uint8_t * | pMsgClass, | ||
uint8_t * | 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.
[in] | pHandle | A valid protocol handle. |
[out] | pMsgClass | Pointer to hold the returned message class |
[out] | pMsg | Pointer to hold the returned message id |
[out] | pData | Allocated buffer used to hold received data field. |
[out] | pSize | Pointer used to hold the received data field size. |
[in] | maxSize | Max number of bytes that can be stored in the pData buffer. |
Definition at line 143 of file sbgEComProtocol.c.
SbgErrorCode sbgEComProtocolSend | ( | SbgEComProtocol * | pHandle, |
uint8_t | msgClass, | ||
uint8_t | msg, | ||
const void * | pData, | ||
size_t | size | ||
) |
Send a frame to the device (size should be less than 4086 bytes).
[in] | pHandle | A valid protocol handle. |
[in] | msgClass | Message class (0-255) |
[in] | msg | Message id (0-255) |
[in] | pData | Pointer on the data payload to send or NULL if no payload. |
[in] | size | Size in bytes of the data payload (less than 4086). |
Definition at line 60 of file sbgEComProtocol.c.
SbgErrorCode sbgEComStartFrameGeneration | ( | SbgStreamBuffer * | pOutputStream, |
uint8_t | msgClass, | ||
uint8_t | msg, | ||
size_t * | pStreamCursor | ||
) |
Initialize an output stream for an sbgECom frame generation. This method is helpful to avoid memory copy compared to sbgEComProtocolSend one.
[in] | pOutputStream | Pointer to an allocated and initialized output stream. |
[in] | msgClass | Message class (0-255) |
[in] | msg | Message id (0-255) |
[out] | pStreamCursor | The initial output stream cursor that thus points to the begining of the generated message. This value should be passed to sbgEComFinalizeFrameGeneration for correct operations. |
Definition at line 461 of file sbgEComProtocol.c.