syncio.h File Reference
`#include <gwenhywfar/gwenhywfarapi.h>`
`#include <gwenhywfar/inherit.h>`
`#include <gwenhywfar/list1.h>`
`#include <gwenhywfar/stringlist.h>`
`#include <gwenhywfar/buffer.h>`

Go to the source code of this file.

## Macros

#define | GWEN_SYNCIO_FLAGS_DONTCLOSE 0x40000000
#define | GWEN_SYNCIO_FLAGS_DOSMODE 0x08000000
#define | GWEN_SYNCIO_FLAGS_PACKET_END 0x10000000
#define | GWEN_SYNCIO_FLAGS_PASSIVE 0x20000000
#define | GWEN_SYNCIO_FLAGS_TRANSPARENT 0x80000000

## Typedefs

typedef struct GWEN_SYNCIO | GWEN_SYNCIO
Declarations for Virtual Functions
typedef GWENHYWFAR_CB int(* | GWEN_SYNCIO_CONNECT_FN) (GWEN_SYNCIO *sio)
typedef GWENHYWFAR_CB int(* | GWEN_SYNCIO_DISCONNECT_FN) (GWEN_SYNCIO *sio)
typedef GWENHYWFAR_CB int(* | GWEN_SYNCIO_FLUSH_FN) (GWEN_SYNCIO *sio)
typedef GWENHYWFAR_CB int(* | GWEN_SYNCIO_READ_FN) (GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)
typedef GWENHYWFAR_CB int(* | GWEN_SYNCIO_WRITE_FN) (GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)

## Enumerations

enum | GWEN_SYNCIO_STATUS { GWEN_SyncIo_Status_Unknown =-1 , GWEN_SyncIo_Status_Unconnected =0 , GWEN_SyncIo_Status_Disconnected , GWEN_SyncIo_Status_Connected , GWEN_SyncIo_Status_Disabled }

## Functions

GWENHYWFAR_API void | GWEN_SyncIo_AddFlags (GWEN_SYNCIO *sio, uint32_t fl)
GWENHYWFAR_API void | GWEN_SyncIo_Attach (GWEN_SYNCIO *sio)
GWENHYWFAR_API int | GWEN_SyncIo_Connect (GWEN_SYNCIO *sio)
GWENHYWFAR_API int | GWEN_SyncIo_Disconnect (GWEN_SYNCIO *sio)
GWENHYWFAR_API int | GWEN_SyncIo_Flush (GWEN_SYNCIO *sio)
GWENHYWFAR_API void | GWEN_SyncIo_free (GWEN_SYNCIO *sio)
GWENHYWFAR_API GWEN_SYNCIO * | GWEN_SyncIo_GetBaseIo (const GWEN_SYNCIO *sio)
GWENHYWFAR_API GWEN_SYNCIO * | GWEN_SyncIo_GetBaseIoByTypeName (const GWEN_SYNCIO *sio, const char *typeName)
GWENHYWFAR_API uint32_t | GWEN_SyncIo_GetFlags (const GWEN_SYNCIO *sio)
GWENHYWFAR_API GWEN_SYNCIO_STATUS | GWEN_SyncIo_GetStatus (const GWEN_SYNCIO *sio)
GWENHYWFAR_API const char * | GWEN_SyncIo_GetTypeName (const GWEN_SYNCIO *sio)
GWENHYWFAR_API int | GWEN_SyncIo_Helper_CopyFile (const char *srcPath, const char *destPath)
GWENHYWFAR_API int | GWEN_SyncIo_Helper_PartiallyReadFile (const char *fName, uint8_t *buffer, uint32_t size)
GWENHYWFAR_API int | GWEN_SyncIo_Helper_ReadFile (const char *fName, GWEN_BUFFER *dbuf)
GWENHYWFAR_API int | GWEN_SyncIo_Helper_ReadFileToStringList (const char *fname, int maxLines, GWEN_STRINGLIST *sl)
GWENHYWFAR_API int | GWEN_SyncIo_Helper_WriteFile (const char *fName, const uint8_t *ptrSource, uint64_t lenSource)
GWENHYWFAR_API GWEN_SYNCIO * | GWEN_SyncIo_new (const char *typeName, GWEN_SYNCIO *baseIo)
GWENHYWFAR_API int | GWEN_SyncIo_Read (GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)
GWENHYWFAR_API int | GWEN_SyncIo_ReadForced (GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)
GWENHYWFAR_API void | GWEN_SyncIo_SetFlags (GWEN_SYNCIO *sio, uint32_t fl)
GWENHYWFAR_API void | GWEN_SyncIo_SetStatus (GWEN_SYNCIO *sio, GWEN_SYNCIO_STATUS st)
GWENHYWFAR_API void | GWEN_SyncIo_SubFlags (GWEN_SYNCIO *sio, uint32_t fl)
GWENHYWFAR_API int | GWEN_SyncIo_Write (GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)
GWENHYWFAR_API int | GWEN_SyncIo_WriteChar (GWEN_SYNCIO *sio, char s)
GWENHYWFAR_API int | GWEN_SyncIo_WriteForced (GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)
GWENHYWFAR_API int | GWEN_SyncIo_WriteLine (GWEN_SYNCIO *sio, const char *s)
GWENHYWFAR_API int | GWEN_SyncIo_WriteString (GWEN_SYNCIO *sio, const char *s)
Setters for Virtual Functions
GWENHYWFAR_API GWEN_SYNCIO_CONNECT_FN | GWEN_SyncIo_SetConnectFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_CONNECT_FN fn)
GWENHYWFAR_API GWEN_SYNCIO_DISCONNECT_FN | GWEN_SyncIo_SetDisconnectFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_DISCONNECT_FN fn)
GWENHYWFAR_API GWEN_SYNCIO_FLUSH_FN | GWEN_SyncIo_SetFlushFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_FLUSH_FN fn)
GWENHYWFAR_API GWEN_SYNCIO_READ_FN | GWEN_SyncIo_SetReadFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_READ_FN fn)
GWENHYWFAR_API GWEN_SYNCIO_WRITE_FN | GWEN_SyncIo_SetWriteFn (GWEN_SYNCIO *sio, GWEN_SYNCIO_WRITE_FN fn)

## Macro Definition Documentation

## GWEN_SYNCIO_FLAGS_DONTCLOSE

#define GWEN_SYNCIO_FLAGS_DONTCLOSE 0x40000000

Definition at line 56 of file syncio.h.

## GWEN_SYNCIO_FLAGS_DOSMODE

#define GWEN_SYNCIO_FLAGS_DOSMODE 0x08000000

Definition at line 59 of file syncio.h.

## GWEN_SYNCIO_FLAGS_PACKET_END

#define GWEN_SYNCIO_FLAGS_PACKET_END 0x10000000

Definition at line 58 of file syncio.h.

## GWEN_SYNCIO_FLAGS_PASSIVE

#define GWEN_SYNCIO_FLAGS_PASSIVE 0x20000000

Definition at line 57 of file syncio.h.

## GWEN_SYNCIO_FLAGS_TRANSPARENT

#define GWEN_SYNCIO_FLAGS_TRANSPARENT 0x80000000

Definition at line 55 of file syncio.h.

## Typedef Documentation

## GWEN_SYNCIO

typedef struct GWEN_SYNCIO GWEN_SYNCIO

Definition at line 40 of file syncio.h.

## GWEN_SYNCIO_CONNECT_FN

typedef GWENHYWFAR_CB int(* GWEN_SYNCIO_CONNECT_FN) (GWEN_SYNCIO *sio)

Definition at line 232 of file syncio.h.

## GWEN_SYNCIO_DISCONNECT_FN

typedef GWENHYWFAR_CB int(* GWEN_SYNCIO_DISCONNECT_FN) (GWEN_SYNCIO *sio)

Definition at line 233 of file syncio.h.

## GWEN_SYNCIO_FLUSH_FN

typedef GWENHYWFAR_CB int(* GWEN_SYNCIO_FLUSH_FN) (GWEN_SYNCIO *sio)

Definition at line 234 of file syncio.h.

## GWEN_SYNCIO_READ_FN

typedef GWENHYWFAR_CB int(* GWEN_SYNCIO_READ_FN) (GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)

Definition at line 237 of file syncio.h.

## GWEN_SYNCIO_WRITE_FN

typedef GWENHYWFAR_CB int(* GWEN_SYNCIO_WRITE_FN) (GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)

Definition at line 243 of file syncio.h.

## Enumeration Type Documentation

## GWEN_SYNCIO_STATUS

enum GWEN_SYNCIO_STATUS

Enumerator
GWEN_SyncIo_Status_Unknown |
GWEN_SyncIo_Status_Unconnected |
GWEN_SyncIo_Status_Disconnected |
GWEN_SyncIo_Status_Connected |
GWEN_SyncIo_Status_Disabled |

Definition at line 45 of file syncio.h.

## Function Documentation

## GWEN_SyncIo_AddFlags()

GWENHYWFAR_API void GWEN_SyncIo_AddFlags | ( | GWEN_SYNCIO * | sio,
|  | uint32_t | fl )

References GWENHYWFAR_API.

## GWEN_SyncIo_Attach()

GWENHYWFAR_API void GWEN_SyncIo_Attach | ( | GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_Connect()

GWENHYWFAR_API int GWEN_SyncIo_Connect | ( | GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_Disconnect()

GWENHYWFAR_API int GWEN_SyncIo_Disconnect | ( | GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_Flush()

GWENHYWFAR_API int GWEN_SyncIo_Flush | ( | GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_free()

GWENHYWFAR_API void GWEN_SyncIo_free | ( | GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_GetBaseIo()

GWENHYWFAR_API GWEN_SYNCIO * GWEN_SyncIo_GetBaseIo | ( | const GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_GetBaseIoByTypeName()

GWENHYWFAR_API GWEN_SYNCIO * GWEN_SyncIo_GetBaseIoByTypeName | ( | const GWEN_SYNCIO * | sio,
|  | const char * | typeName )

References GWENHYWFAR_API.

## GWEN_SyncIo_GetFlags()

GWENHYWFAR_API uint32_t GWEN_SyncIo_GetFlags | ( | const GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_GetStatus()

GWENHYWFAR_API GWEN_SYNCIO_STATUS GWEN_SyncIo_GetStatus | ( | const GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_GetTypeName()

GWENHYWFAR_API const char * GWEN_SyncIo_GetTypeName | ( | const GWEN_SYNCIO * | sio | ) |

References GWENHYWFAR_API.

## GWEN_SyncIo_Helper_CopyFile()

GWENHYWFAR_API int GWEN_SyncIo_Helper_CopyFile | ( | const char * | srcPath,
|  | const char * | destPath )

Copy source file to destination file. Destination file is overwritten if it exists.

Returns
  number of bytes actually copied (or error code if negative value)

Parameters

  srcPath | path and name of the file to read
  destPath | path and name of the file to write

## GWEN_SyncIo_Helper_PartiallyReadFile()

GWENHYWFAR_API int GWEN_SyncIo_Helper_PartiallyReadFile | ( | const char * | fName,
|  | uint8_t * | buffer,
|  | uint32_t | size )

Read SIZE bytes from the given file. Returns the number of bytes actually read or an error code (negative value).

Returns
  number of bytes actually read (or error code if negative value)

Parameters

  fName | name of the file to load
  buffer | pointer to a fixed buffer to receive the bytes read
  size | number of bytes to read

References GWENHYWFAR_API.

## GWEN_SyncIo_Helper_ReadFile()

GWENHYWFAR_API int GWEN_SyncIo_Helper_ReadFile | ( | const char * | fName,
|  | GWEN_BUFFER * | dbuf )

Read a whole file into the given buffer

Returns
  number of bytes actually read (or error code if negative value)

Parameters

  fName | name of the file to load
  dbuf | GWEN_BUFFER to receive the bytes read

References GWENHYWFAR_API.

## GWEN_SyncIo_Helper_ReadFileToStringList()

GWENHYWFAR_API int GWEN_SyncIo_Helper_ReadFileToStringList | ( | const char * | fname,
|  | int | maxLines,
|  | GWEN_STRINGLIST * | sl )

References GWENHYWFAR_API.

## GWEN_SyncIo_Helper_WriteFile()

GWENHYWFAR_API int GWEN_SyncIo_Helper_WriteFile | ( | const char * | fName,
|  | const uint8_t * | ptrSource,
|  | uint64_t | lenSource )

Writes a whole file from the given buffer

Returns
  number of bytes actually written (or error code if negative value)

Parameters

  fName | name of the file to load
  ptrSource | pointer to the data to write
  lenSource | size of the data to write

References GWENHYWFAR_API.

## GWEN_SyncIo_new()

GWENHYWFAR_API GWEN_SYNCIO * GWEN_SyncIo_new | ( | const char * | typeName,
|  | GWEN_SYNCIO * | baseIo )

References GWENHYWFAR_API.

## GWEN_SyncIo_Read()

GWENHYWFAR_API int GWEN_SyncIo_Read | ( | GWEN_SYNCIO * | sio,
|  | uint8_t * | buffer,
|  | uint32_t | size )

References GWENHYWFAR_API.

## GWEN_SyncIo_ReadForced()

GWENHYWFAR_API int GWEN_SyncIo_ReadForced | ( | GWEN_SYNCIO * | sio,
|  | uint8_t * | buffer,
|  | uint32_t | size )

References GWENHYWFAR_API.

## GWEN_SyncIo_SetConnectFn()

GWENHYWFAR_API GWEN_SYNCIO_CONNECT_FN GWEN_SyncIo_SetConnectFn | ( | GWEN_SYNCIO * | sio,
|  | GWEN_SYNCIO_CONNECT_FN | fn )

References GWENHYWFAR_API.

## GWEN_SyncIo_SetDisconnectFn()

GWENHYWFAR_API GWEN_SYNCIO_DISCONNECT_FN GWEN_SyncIo_SetDisconnectFn | ( | GWEN_SYNCIO * | sio,
|  | GWEN_SYNCIO_DISCONNECT_FN | fn )

References GWENHYWFAR_API.

## GWEN_SyncIo_SetFlags()

GWENHYWFAR_API void GWEN_SyncIo_SetFlags | ( | GWEN_SYNCIO * | sio,
|  | uint32_t | fl )

References GWENHYWFAR_API.

## GWEN_SyncIo_SetFlushFn()

GWENHYWFAR_API GWEN_SYNCIO_FLUSH_FN GWEN_SyncIo_SetFlushFn | ( | GWEN_SYNCIO * | sio,
|  | GWEN_SYNCIO_FLUSH_FN | fn )

References GWENHYWFAR_API.

## GWEN_SyncIo_SetReadFn()

GWENHYWFAR_API GWEN_SYNCIO_READ_FN GWEN_SyncIo_SetReadFn | ( | GWEN_SYNCIO * | sio,
|  | GWEN_SYNCIO_READ_FN | fn )

References GWENHYWFAR_API.

## GWEN_SyncIo_SetStatus()

GWENHYWFAR_API void GWEN_SyncIo_SetStatus | ( | GWEN_SYNCIO * | sio,
|  | GWEN_SYNCIO_STATUS | st )

References GWENHYWFAR_API.

## GWEN_SyncIo_SetWriteFn()

GWENHYWFAR_API GWEN_SYNCIO_WRITE_FN GWEN_SyncIo_SetWriteFn | ( | GWEN_SYNCIO * | sio,
|  | GWEN_SYNCIO_WRITE_FN | fn )

## GWEN_SyncIo_SubFlags()

GWENHYWFAR_API void GWEN_SyncIo_SubFlags | ( | GWEN_SYNCIO * | sio,
|  | uint32_t | fl )

References GWENHYWFAR_API.

## GWEN_SyncIo_Write()

GWENHYWFAR_API int GWEN_SyncIo_Write | ( | GWEN_SYNCIO * | sio,
|  | const uint8_t * | buffer,
|  | uint32_t | size )

References GWENHYWFAR_API.

## GWEN_SyncIo_WriteChar()

GWENHYWFAR_API int GWEN_SyncIo_WriteChar | ( | GWEN_SYNCIO * | sio,
|  | char | s )

References GWENHYWFAR_API.

## GWEN_SyncIo_WriteForced()

GWENHYWFAR_API int GWEN_SyncIo_WriteForced | ( | GWEN_SYNCIO * | sio,
|  | const uint8_t * | buffer,
|  | uint32_t | size )

References GWENHYWFAR_API.

## GWEN_SyncIo_WriteLine()

GWENHYWFAR_API int GWEN_SyncIo_WriteLine | ( | GWEN_SYNCIO * | sio,
|  | const char * | s )

References GWENHYWFAR_API.

## GWEN_SyncIo_WriteString()

GWENHYWFAR_API int GWEN_SyncIo_WriteString | ( | GWEN_SYNCIO * | sio,
|  | const char * | s )

This is just a convenience function to easily replace a function from the deprecated module GWEN_BUFFEREDIO.

References GWENHYWFAR_API.