Functions
sbgInterfaceSerialWin.c File Reference
#include "sbgInterfaceSerial.h"
#include <windows.h>
Include dependency graph for sbgInterfaceSerialWin.c:

Go to the source code of this file.

Functions

uint32 sbgGetWindowsErrorMsg (char outErrorMsg[256])
 
SbgErrorCode sbgInterfaceSerialChangeBaudrate (SbgInterface *pHandle, uint32 baudRate)
 
SbgErrorCode sbgInterfaceSerialCreate (SbgInterface *pHandle, const char *deviceName, uint32 baudRate)
 
SbgErrorCode sbgInterfaceSerialDestroy (SbgInterface *pHandle)
 
SbgErrorCode sbgInterfaceSerialFlush (SbgInterface *pHandle)
 
SbgErrorCode sbgInterfaceSerialRead (SbgInterface *pHandle, void *pBuffer, size_t *pReadBytes, size_t bytesToRead)
 
SbgErrorCode sbgInterfaceSerialWrite (SbgInterface *pHandle, const void *pBuffer, size_t bytesToWrite)
 

Function Documentation

uint32 sbgGetWindowsErrorMsg ( char  outErrorMsg[256])

Returns the last error message for windows api calls.

Parameters
[out]outErrorMsgPointer on an allocated string that can stores the windows error message.
Returns
The last error number.

Definition at line 13 of file sbgInterfaceSerialWin.c.

SbgErrorCode sbgInterfaceSerialChangeBaudrate ( SbgInterface pHandle,
uint32  baudRate 
)

Change the serial interface baud rate immediatly.

Parameters
[in]handleValid handle on an initialized interface.
[in]baudRateThe new baudrate to apply in bps.
Returns
SBG_NO_ERROR if everything is OK

Definition at line 293 of file sbgInterfaceSerialWin.c.

SbgErrorCode sbgInterfaceSerialCreate ( SbgInterface pHandle,
const char *  deviceName,
uint32  baudRate 
)

Initialize a serial interface for read and write operations.

Parameters
[in]pHandlePointer on an allocated interface instance to initialize.
[in]deviceNameSerial interface location (COM21 , /dev/ttys0, depending on platform).
[in]baudRateSerial interface baud rate in bps.
Returns
SBG_NO_ERROR if the interface has been created.

Definition at line 59 of file sbgInterfaceSerialWin.c.

SbgErrorCode sbgInterfaceSerialDestroy ( SbgInterface pHandle)

Destroy an interface initialized using sbgInterfaceSerialCreate.

Parameters
[in]pInterfaceValid handle on an initialized interface.
Returns
SBG_NO_ERROR if the interface has been closed and released.

Definition at line 205 of file sbgInterfaceSerialWin.c.

SbgErrorCode sbgInterfaceSerialFlush ( SbgInterface pHandle)

Flush the RX and TX buffers (remove all old data)

Parameters
[in]handleValid handle on an initialized interface.
Returns
SBG_NO_ERROR if everything is OK

Definition at line 233 of file sbgInterfaceSerialWin.c.

SbgErrorCode sbgInterfaceSerialRead ( SbgInterface pHandle,
void *  pBuffer,
size_t *  pReadBytes,
size_t  bytesToRead 
)

Try to read some data from an interface.

Parameters
[in]pHandleValid handle on an initialized interface.
[in]pBufferPointer on an allocated buffer that can hold at least bytesToRead bytes of data.
[out]pReadBytesPointer on an uint32 used to return the number of read bytes.
[in]bytesToReadNumber of bytes we would like to read.
Returns
SBG_NO_ERROR if no error occurs, please check the number of received bytes.

Definition at line 416 of file sbgInterfaceSerialWin.c.

SbgErrorCode sbgInterfaceSerialWrite ( SbgInterface pHandle,
const void *  pBuffer,
size_t  bytesToWrite 
)

Try to write some data to an interface.

Parameters
[in]pHandleValid handle on an initialized interface.
[in]pBufferPointer on an allocated buffer that contains the data to write
[in]bytesToWriteNumber of bytes we would like to write.
Returns
SBG_NO_ERROR if all bytes have been written successfully.

Definition at line 361 of file sbgInterfaceSerialWin.c.



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