#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>
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) |
| SbgErrorCode sbgInterfaceSerialChangeBaudrate | ( | SbgInterface * | pHandle, |
| uint32 | baudRate | ||
| ) |
Change the serial interface baud rate immediatly.
| [in] | handle | Valid handle on an initialized interface. |
| [in] | baudRate | The new baudrate to apply in bps. |
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.
| [in] | pHandle | Pointer on an allocated interface instance to initialize. |
| [in] | deviceName | Serial interface location (COM21 , /dev/ttys0, depending on platform). |
| [in] | baudRate | Serial interface baud rate in bps. |
Definition at line 83 of file sbgInterfaceSerialUnix.c.
| SbgErrorCode sbgInterfaceSerialDestroy | ( | SbgInterface * | pHandle | ) |
Destroy an interface initialized using sbgInterfaceSerialCreate.
| [in] | pInterface | Valid handle on an initialized interface. |
Definition at line 228 of file sbgInterfaceSerialUnix.c.
| SbgErrorCode sbgInterfaceSerialFlush | ( | SbgInterface * | pHandle | ) |
Flush the RX and TX buffers (remove all old data)
| [in] | handle | Valid handle on an initialized interface. |
Definition at line 262 of file sbgInterfaceSerialUnix.c.
Returns the right unix baud rate const according to a baud rate value.
| [in] | baudRate | The baud rate value (ie 115200). |
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.
| [in] | pHandle | Valid handle on an initialized interface. |
| [in] | pBuffer | Pointer on an allocated buffer that can hold at least bytesToRead bytes of data. |
| [out] | pReadBytes | Pointer on an uint32 used to return the number of read bytes. |
| [in] | bytesToRead | Number of bytes we would like to read. |
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.
| [in] | pHandle | Valid handle on an initialized interface. |
| [in] | pBuffer | Pointer on an allocated buffer that contains the data to write |
| [in] | bytesToWrite | Number of bytes we would like to write. |
Definition at line 371 of file sbgInterfaceSerialUnix.c.