Neonode zForce(TM) SDK

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

Transport.h
Go to the documentation of this file.
1
12 #if !defined(TRANSPORT_TRANSPORT_H) && !defined(CONTAINS_TRANSPORT)
13
14 #ifndef ZFORCECOMMON_H
15 #error Please include "zForceCommon.h" before this file.
16 #endif // ZFORCECOMMON_H
17
19 typedef enum ReadWriteThreadStatus ReadWriteThreadStatus;
21 enum ReadWriteThreadStatus
22 {
23 ThreadIsNotRunning,
24 ThreadIsInitializing,
25 ThreadIsRunning,
26 ThreadIsTerminating
27 };
28
29 /*
30 * Forward declaration required in order to break the cycle where
31 * Transport needs TransportEntry, and
32 * TransportEntry needs Transport.
33 */
35 typedef struct TransportEntry TransportEntry;
36
40 typedef struct Transport Transport;
46 struct Transport
47 {
48 #endif // !defined(TRANSPORT_TRANSPORT_H) && !defined(CONTAINS_TRANSPORT)
49 #if !defined(TRANSPORT_TRANSPORT_H) || defined(CONTAINS_TRANSPORT)
50
56 Transport * Base;
60 Connection * Connection;
62 zForce * zForce;
69 char ConnectionString [TRANSPORTPROTOCOL_MaxOptionParameterLength + 1];
74 bool Terminate;
78 Queue * WriteQueue;
82 bool IsOpen;
83 bool Opening;
84 zForceThread * WriteThread;
85 zForceThread * ReadThread;
86 volatile ReadWriteThreadStatus WriteThreadStatus;
87 volatile ReadWriteThreadStatus ReadThreadStatus;
88
109 bool ( * Open)(Transport * self);
122 bool ( * Close)(Transport * self);
137 DataFrame * ( * Read)(Transport * self);
151 bool ( * Write)(Transport * self, DataFrame * payload);
159 uint64_t ( * GetTimeOutValue)(Transport * self);
174 bool ( * EnqueueDataFrame)(Transport * self, DataFrame * dataFrame);
175
180 void ( * Destructor )(Transport * self);
181 #endif // !defined(TRANSPORT_TRANSPORT_H) || defined(CONTAINS_TRANSPORT)
182 #if !defined(TRANSPORT_TRANSPORT_H) && !defined(CONTAINS_TRANSPORT)
183 };
184
185 // Exported Functions (prefixed with module name and underscore)
186
187 #ifdef __cplusplus
188 extern "C"
189 {
190 #endif // __cplusplus
191
224 DLLEXTERNAL Transport * Transport_GetInstance (Connection * connection, char * connectionString, char * dataFrameType);
225
250 DLLEXTERNAL bool Transport_AddTransport(TransportEntry * transportEntry);
251
272 DLLINTERNAL bool Transport_Initialize (void);
273
287 DLLINTERNAL void Transport_Uninitialize (void);
288
289 #ifdef USE_SERIALTRANSPORT
290 DLLINTERNAL bool SerialTransport_AddSerialTransportEntry (void);
291 #endif // USE_SERIALTRANSPORT
292
293 #ifdef USE_HIDPIPETRANSPORT
294 DLLINTERNAL bool HidPipeTransport_AddHidPipeTransportEntry (void);
295 #endif // USE_HIDPIPETRANSPORT
296
297 #ifdef __cplusplus
298 }
299 #endif // __cplusplus
300
301 #define TRANSPORT_TRANSPORT_H
302 #endif // !defined(TRANSPORT_TRANSPORT_H) && !defined(CONTAINS_TRANSPORT)
303
Transport_Uninitialize
DLLINTERNAL void Transport_Uninitialize(void)
Uninitialize the Transport module.
Transport::Write
bool(* Write)(Transport *self, DataFrame *payload)
Function pointer to Transport&#39;s Write.
Definition: Transport.h:151
Connection
The main Connection struct.
Definition: Connection.h:64
Transport::Open
bool(* Open)(Transport *self)
Open the generic Transport.
Definition: Transport.h:109
Transport::ReadThreadStatus
volatile ReadWriteThreadStatus ReadThreadStatus
Thread is active.
Definition: Transport.h:87
SerialTransport_AddSerialTransportEntry
DLLINTERNAL bool SerialTransport_AddSerialTransportEntry(void)
Internal call to add a SerialTransport to the list of available transports.
Transport
Transport struct. This structure represents the base class of all Transport definitions.
Definition: Transport.h:46
Transport::Terminate
bool Terminate
A flag indicating if the Transport Read and Write threads should terminate (true) or not (false)...
Definition: Transport.h:74
Transport::zForce
zForce * zForce
A pointer to the global zForce instance.
Definition: Transport.h:62
Transport::IsOpen
bool IsOpen
A flag indicating if the Transport is open (true) or not (false).
Definition: Transport.h:82
ThreadIsInitializing
Thread is Initializing.
Definition: Transport.h:24
Transport::Destructor
void(* Destructor)(Transport *self)
Destructor frees all the resources that have been allocated.
Definition: Transport.h:180
Transport::WriteThreadStatus
volatile ReadWriteThreadStatus WriteThreadStatus
Thread is active.
Definition: Transport.h:86
Transport_AddTransport
DLLEXTERNAL bool Transport_AddTransport(TransportEntry *transportEntry)
Add a new Transport to the list of those available.
ThreadIsTerminating
Thread is Terminating.
Definition: Transport.h:26
ThreadIsNotRunning
Thread is not running.
Definition: Transport.h:23
Transport::Base
Transport * Base
Base pointer to the immediate base Transport class. The inheritance is nested so for example WinSerTr...
Definition: Transport.h:56
Queue
The Queue struct.
Definition: Queue.h:25
Transport::Opening
bool Opening
Transport is in Opening phase.
Definition: Transport.h:83
DataFrame
Struct containing the DataFrame information.
Definition: DataFrame.h:26
HidPipeTransport_AddHidPipeTransportEntry
DLLINTERNAL bool HidPipeTransport_AddHidPipeTransportEntry(void)
Internal call to add a HidPipeTransport to the list of available transports.
TransportEntry
struct TransportEntry TransportEntry
Definition: Transport.h:35
Transport::GetTimeOutValue
uint64_t(* GetTimeOutValue)(Transport *self)
Function pointer to Transport&#39;s GetTimeOutValue.
Definition: Transport.h:159
zForceThread
void zForceThread
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:20
Transport_Initialize
DLLINTERNAL bool Transport_Initialize(void)
Initialize the Transport module.
zForce
Main struct.
Definition: zForce.h:28
Transport_GetInstance
DLLEXTERNAL Transport * Transport_GetInstance(Connection *connection, char *connectionString, char *dataFrameType)
This is the Transport factory function.
Transport::WriteThread
zForceThread * WriteThread
Write Thread pointer.
Definition: Transport.h:84
Transport::ConnectionString
char ConnectionString[TRANSPORTPROTOCOL_MaxOptionParameterLength+1]
Connection string. This string contain the type of transport and the option parameters on the followi...
Definition: Transport.h:69
Transport::WriteQueue
Queue * WriteQueue
A pointer to the Write queue used by EnqueueDataFrame.
Definition: Transport.h:78
Transport::Close
bool(* Close)(Transport *self)
Close the generic Transport.
Definition: Transport.h:122
Transport::Connection
Connection * Connection
Each Transport is linked to one Connection.
Definition: Transport.h:60
ThreadIsRunning
Thread is Running.
Definition: Transport.h:25
ReadWriteThreadStatus
ReadWriteThreadStatus
Enum describing the current status of a Read or Write thread.
Definition: Transport.h:21
Transport::ReadThread
zForceThread * ReadThread
Read Thread pointer.
Definition: Transport.h:85
Transport::EnqueueDataFrame
bool(* EnqueueDataFrame)(Transport *self, DataFrame *dataFrame)
Enqueue given dataframe.
Definition: Transport.h:174