Classes | Typedefs | Enumerations | Functions
sbgInterface.h File Reference

This file implements the base interface for all Serial and Ethernet ports. More...

#include <sbgCommon.h>
Include dependency graph for sbgInterface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _SbgInterface
 

Typedefs

typedef struct _SbgInterface SbgInterface
 
typedef void * SbgInterfaceHandle
 
typedef bool(* SbgInterfaceIsValidFunc) (SbgInterface *pHandle)
 
typedef SbgErrorCode(* SbgInterfaceReadFunc) (SbgInterface *pHandle, void *pBuffer, size_t *pReadBytes, size_t bytesToRead)
 
typedef enum _SbgInterfaceType SbgInterfaceType
 
typedef SbgErrorCode(* SbgInterfaceWriteFunc) (SbgInterface *pHandle, const void *pBuffer, size_t bytesToWrite)
 

Enumerations

enum  _SbgInterfaceType {
  SBG_IF_TYPE_UNKNOW, SBG_IF_TYPE_SERIAL, SBG_IF_TYPE_ETH_UDP, SBG_IF_TYPE_ETH_TCP_IP,
  SBG_IF_TYPE_FILE
}
 

Functions

SBG_INLINE bool sbgInterfaceIsValid (SbgInterface *pHandle)
 
SBG_INLINE SbgErrorCode sbgInterfaceRead (SbgInterface *pHandle, void *pBuffer, size_t *pReadBytes, size_t bytesToRead)
 
SBG_INLINE SbgErrorCode sbgInterfaceWrite (SbgInterface *pHandle, const void *pBuffer, size_t bytesToWrite)
 
SBG_INLINE void sbgInterfaceZeroInit (SbgInterface *pHandle)
 

Detailed Description

This file implements the base interface for all Serial and Ethernet ports.

Author
SBG Systems (Raphael Siryani)
Date
10 December 2012

An interface is used to provide a common API for both serial and ethernet ports. An interface can be opened/closed and some data can be written or read from it.

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 sbgInterface.h.

Typedef Documentation

typedef struct _SbgInterface SbgInterface

Interface structure pre-definition.

Definition at line 59 of file sbgInterface.h.

typedef void* SbgInterfaceHandle

Handle that stores the internal interface handle (ie Serial or Ethernet)

Definition at line 64 of file sbgInterface.h.

typedef bool(* SbgInterfaceIsValidFunc) (SbgInterface *pHandle)

Returns true if the interface is working correctly.

Parameters
[in]pHandleValid handle on an initialized interface.
Returns
true if this interface is working correctly.

Definition at line 94 of file sbgInterface.h.

typedef SbgErrorCode(* SbgInterfaceReadFunc) (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 some bytes have been read successfully.

Definition at line 87 of file sbgInterface.h.

Define the interface type.

typedef SbgErrorCode(* SbgInterfaceWriteFunc) (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 some bytes have been written successfully.

Definition at line 77 of file sbgInterface.h.

Enumeration Type Documentation

Define the interface type.

Enumerator
SBG_IF_TYPE_UNKNOW 

The interface type is not defined.

SBG_IF_TYPE_SERIAL 

The interface is a serial com port.

SBG_IF_TYPE_ETH_UDP 

The interface is an UDP one.

SBG_IF_TYPE_ETH_TCP_IP 

The interface is an TCP/IP one.

SBG_IF_TYPE_FILE 

The interface is a file.

Definition at line 43 of file sbgInterface.h.

Function Documentation

SBG_INLINE bool sbgInterfaceIsValid ( SbgInterface pHandle)

Returns true if this interface seems to be up and running.

Parameters
[in]pHandleHandle on an interface to test (if pHandle == NULL, retruns false).
Returns
true if this interface seems to be up and running.

Definition at line 143 of file sbgInterface.h.

SBG_INLINE SbgErrorCode sbgInterfaceRead ( 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 212 of file sbgInterface.h.

SBG_INLINE SbgErrorCode sbgInterfaceWrite ( 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 190 of file sbgInterface.h.

SBG_INLINE void sbgInterfaceZeroInit ( SbgInterface pHandle)

Initialize an interface strcture to zero.

Parameters
[in]pHandleHandle on an allocated interface to initialize to zero.

Definition at line 121 of file sbgInterface.h.



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