Functions
sbgInterfaceSerialUnix.c File Reference
#include "sbgInterfaceSerial.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
#include <sys/ioctl.h>
Include dependency graph for sbgInterfaceSerialUnix.c:

Go to the source code of this file.

Functions

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

Function Documentation

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 300 of file sbgInterfaceSerialUnix.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 83 of file sbgInterfaceSerialUnix.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 228 of file sbgInterfaceSerialUnix.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 262 of file sbgInterfaceSerialUnix.c.

uint32 sbgInterfaceSerialGetBaudRateConst ( uint32  baudRate)

Returns the right unix baud rate const according to a baud rate value.

Parameters
[in]baudRateThe baud rate value (ie 115200).
Returns
The Unix baud rate constant.

Definition at line 20 of file sbgInterfaceSerialUnix.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 433 of file sbgInterfaceSerialUnix.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 371 of file sbgInterfaceSerialUnix.c.



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