Macros | Functions
sbgInterfaceSerial.h File Reference

This file implements a serial interface. More...

#include "sbgInterface.h"
Include dependency graph for sbgInterfaceSerial.h:
This graph shows which files directly or indirectly include this file:

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)
 

Detailed Description

This file implements a serial interface.

Author
SBG Systems (Raphael Siryani)
Date
06 February 2013

Copyright Notice

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.

Macro Definition Documentation

#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.

Function Documentation

SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceSerialChangeBaudrate ( SbgInterface pHandle,
uint32_t  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
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceSerialCreate ( SbgInterface pHandle,
const char *  deviceName,
uint32_t  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.
SBG_COMMON_LIB_API 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.

SBG_COMMON_LIB_API 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.

SBG_COMMON_LIB_API 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_t 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.

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.

SBG_COMMON_LIB_API 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): SBG Systems
autogenerated on Thu Oct 22 2020 03:47:22