36 #ifndef SBG_INTERFACE_H
37 #define SBG_INTERFACE_H
53 #define SBG_IF_NAME_MAX_SIZE (48)
58 #define SBG_IF_TYPE_UNKNOW (0)
59 #define SBG_IF_TYPE_SERIAL (1)
60 #define SBG_IF_TYPE_ETH_UDP (2)
61 #define SBG_IF_TYPE_ETH_TCP_IP (3)
62 #define SBG_IF_TYPE_FILE (4)
63 #define SBG_IF_TYPE_LAST_RESERVED (999)
68 #define SBG_IF_FLUSH_INPUT ((uint32_t)1 << 0)
69 #define SBG_IF_FLUSH_OUTPUT ((uint32_t)1 << 1)
70 #define SBG_IF_FLUSH_ALL (SBG_IF_FLUSH_INPUT | SBG_IF_FLUSH_OUTPUT)
238 return pInterface->
type;
259 return pInterface->
name;
297 errorCode = pInterface->
pWriteFunc(pInterface, pBuffer, bytesToWrite);
331 errorCode = pInterface->
pReadFunc(pInterface, pBuffer, pReadBytes, bytesToRead);
363 errorCode = pInterface->
pFlushFunc(pInterface, flags);
440 return pInterface->
pDelayFunc(pInterface, numBytes);
Main header for the SBG Systems common C library.
#define SBG_INLINE
Definition: sbgDefines.h:227
#define SBG_COMMON_LIB_API
Definition: sbgDefines.h:79
enum _SbgErrorCode SbgErrorCode
@ SBG_NO_ERROR
Definition: sbgErrorCodes.h:48
@ SBG_INVALID_PARAMETER
Definition: sbgErrorCodes.h:60
SBG_INLINE SbgErrorCode sbgInterfaceRead(SbgInterface *pInterface, void *pBuffer, size_t *pReadBytes, size_t bytesToRead)
Definition: sbgInterface.h:321
SBG_INLINE const char * sbgInterfaceNameGet(const SbgInterface *pInterface)
Definition: sbgInterface.h:255
SbgErrorCode(* SbgInterfaceWriteFunc)(SbgInterface *pInterface, const void *pBuffer, size_t bytesToWrite)
Definition: sbgInterface.h:109
SBG_INLINE uint32_t sbgInterfaceTypeGet(const SbgInterface *pInterface)
Definition: sbgInterface.h:234
SbgErrorCode(* SbgInterfaceFlushFunc)(SbgInterface *pInterface, uint32_t flags)
Definition: sbgInterface.h:138
SBG_INLINE SbgErrorCode sbgInterfaceSetSpeed(SbgInterface *pInterface, uint32_t speed)
Definition: sbgInterface.h:388
void * SbgInterfaceHandle
Definition: sbgInterface.h:84
SBG_COMMON_LIB_API SbgErrorCode sbgInterfaceDestroy(SbgInterface *pInterface)
SbgErrorCode(* SbgInterfaceDestroyFunc)(SbgInterface *pInterface)
Definition: sbgInterface.h:96
SBG_INLINE uint32_t sbgInterfaceGetSpeed(const SbgInterface *pInterface)
Definition: sbgInterface.h:411
SBG_COMMON_LIB_API const char * sbgInterfaceTypeGetAsString(const SbgInterface *pInterface)
#define SBG_IF_NAME_MAX_SIZE
Definition: sbgInterface.h:53
uint32_t(* SbgInterfaceGetDelayFunc)(const SbgInterface *pInterface, size_t numBytes)
Definition: sbgInterface.h:176
#define SBG_IF_FLUSH_ALL
Definition: sbgInterface.h:70
SBG_INLINE SbgErrorCode sbgInterfaceFlush(SbgInterface *pInterface, uint32_t flags)
Definition: sbgInterface.h:354
uint32_t(* SbgInterfaceGetSpeed)(const SbgInterface *pInterface)
Definition: sbgInterface.h:165
SBG_INLINE uint32_t sbgInterfaceGetDelay(const SbgInterface *pInterface, size_t numBytes)
Definition: sbgInterface.h:434
SbgErrorCode(* SbgInterfaceReadFunc)(SbgInterface *pInterface, void *pBuffer, size_t *pReadBytes, size_t bytesToRead)
Definition: sbgInterface.h:124
SBG_COMMON_LIB_API void sbgInterfaceNameSet(SbgInterface *pInterface, const char *pName)
SBG_COMMON_LIB_API void sbgInterfaceZeroInit(SbgInterface *pInterface)
SbgErrorCode(* SbgInterfaceSetSpeed)(SbgInterface *pInterface, uint32_t speed)
Definition: sbgInterface.h:155
SBG_INLINE SbgErrorCode sbgInterfaceWrite(SbgInterface *pInterface, const void *pBuffer, size_t bytesToWrite)
Definition: sbgInterface.h:288
Definition: sbgInterface.h:193
SbgInterfaceDestroyFunc pDestroyFunc
Definition: sbgInterface.h:198
char name[SBG_IF_NAME_MAX_SIZE]
Definition: sbgInterface.h:196
uint32_t type
Definition: sbgInterface.h:195
SbgInterfaceGetSpeed pGetSpeedFunc
Definition: sbgInterface.h:203
SbgInterfaceSetSpeed pSetSpeedFunc
Definition: sbgInterface.h:202
SbgInterfaceFlushFunc pFlushFunc
Definition: sbgInterface.h:201
SbgInterfaceGetDelayFunc pDelayFunc
Definition: sbgInterface.h:204
SbgInterfaceWriteFunc pWriteFunc
Definition: sbgInterface.h:199
SbgInterfaceHandle handle
Definition: sbgInterface.h:194
SbgInterfaceReadFunc pReadFunc
Definition: sbgInterface.h:200