This file implements a serial interface. More...
#include "sbgInterface.h"
Go to the source code of this file.
Macros | |
#define | SBG_IF_SERIAL_RX_BUFFER_SIZE (4096u) |
#define | SBG_IF_SERIAL_TX_BUFFER_SIZE (4096u) |
Functions | |
SBG_COMMON_LIB_API SbgErrorCode | sbgInterfaceSerialChangeBaudrate (SbgInterface *pHandle, uint32_t baudRate) |
SBG_COMMON_LIB_API SbgErrorCode | sbgInterfaceSerialCreate (SbgInterface *pHandle, const char *deviceName, uint32_t baudRate) |
SBG_COMMON_LIB_API SbgErrorCode | sbgInterfaceSerialDestroy (SbgInterface *pHandle) |
SBG_COMMON_LIB_API SbgErrorCode | sbgInterfaceSerialFlush (SbgInterface *pHandle) |
SBG_COMMON_LIB_API SbgErrorCode | sbgInterfaceSerialRead (SbgInterface *pHandle, void *pBuffer, size_t *pReadBytes, size_t bytesToRead) |
SBG_COMMON_LIB_API SbgErrorCode | sbgInterfaceSerialWrite (SbgInterface *pHandle, const void *pBuffer, size_t bytesToWrite) |
This file implements a serial interface.
Copyright (C) 2007-2013, SBG Systems SAS. All rights reserved.
This source code is intended for use only by SBG Systems SAS and those that have explicit written permission to use it from SBG Systems SAS.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Definition in file sbgInterfaceSerial.h.
#define SBG_IF_SERIAL_RX_BUFFER_SIZE (4096u) |
Define the reception buffer size for the serial port.
Definition at line 37 of file sbgInterfaceSerial.h.
#define SBG_IF_SERIAL_TX_BUFFER_SIZE (4096u) |
Define the transmission buffer size for the serial port.
Definition at line 36 of file sbgInterfaceSerial.h.
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceSerialChangeBaudrate | ( | SbgInterface * | pHandle, |
uint32_t | 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. |
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceSerialCreate | ( | SbgInterface * | pHandle, |
const char * | deviceName, | ||
uint32_t | 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. |
SBG_COMMON_LIB_API 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.
SBG_COMMON_LIB_API 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.
SBG_COMMON_LIB_API 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_t used to return the number of read bytes. |
[in] | bytesToRead | Number of bytes we would like to read. |
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.
SBG_COMMON_LIB_API 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.