Neonode zForce(TM) SDK
Connection.h
Go to the documentation of this file.
1 
12 #if !defined(CONNECTION_CONNECTION_H) && !defined(CONTAINS_CONNECTION)
13 
14 #ifndef ZFORCECOMMON_H
15  #error Please include "zForceCommon.h" before this file.
16 #endif // ZFORCECOMMON_H
17 
20 {
24 };
27 
32 {
34  uint32_t ErrorCode;
35  void ( * Destructor)(ConnectionMessage * self);
36 };
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif // __cplusplus
42 
55  ConnectionStatus connectionStatus, uint32_t errorCode);
56 
57 #ifdef __cplusplus
58 }
59 #endif // __cplusplus
60 
62 typedef struct Connection Connection;
64 struct Connection
65 {
66 #endif // !defined(CONNECTION_CONNECTION_H) && !defined(CONTAINS_CONNECTION)
67 #if !defined(CONNECTION_CONNECTION_H) || defined(CONTAINS_CONNECTION)
74  uint32_t NumberOfDevices;
75  bool IsConnected;
80 
98  void ( * Destructor)(Connection * self);
110  bool ( * AddDevice)(Connection * self, Device * device);
149  Device * ( * FindDevice)(Connection * self, DeviceType deviceType, uint32_t deviceIndex);
161  bool ( * ReceiveDataFrame)(Connection * self, DataFrame * dateFrame);
176  bool ( * SendDataFrame)(Connection * self, DataFrame * dataFrame);
193  bool ( * SetMessageFilter)(Connection * self, Device * device, MessageType messageType);
210  void ( * ClearMessageFilter)(Connection * self);
229  bool ( * EnqueueMessage)(Connection * self, Device * device, Message * message);
261  bool ( * Connect)(Connection * self);
286  bool ( * Disconnect)(Connection * self);
307  void ( * UnknownCommand)(Connection * self);
328  void ( * Timeout)(Connection * self);
347  void ( * SetTimeout)(Connection * self, uint64_t relativeTimeoutMilliSeconds);
362  void ( * SignalConnectionEstablished)(Connection * self);
377  void ( * SignalConnectionFault)(Connection * self);
378 
381 #endif // !defined(CONNECTION_CONNECTION_H) || defined(CONTAINS_CONNECTION)
382 #if !defined(CONNECTION_CONNECTION_H) && !defined(CONTAINS_CONNECTION)
383 };
384 
385 #ifdef __cplusplus
386 extern "C"
387 {
388 #endif // __cplusplus
389 
439 DLLEXTERNAL Connection * Connection_New (char * connectionString,
440  char * protocolString,
441  char * dataFrameType);
442 
443 #ifdef __cplusplus
444 }
445 #endif // __cplusplus
446 
447 #define CONNECTION_CONNECTION_H
448 #endif // !defined(CONNECTION_CONNECTION_H) && !defined(CONTAINS_CONNECTION)
449 
ConnectionStatus Status
The status of the connection.
Definition: Connection.h:380
Connection Fault. Only set internally.
Definition: Connection.h:23
void zForceMutex
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:18
Device * FilterDevice
Which Device the filter is set to.
Definition: Connection.h:77
The main Connection struct.
Definition: Connection.h:64
bool IsConnected
Connected to unit.
Definition: Connection.h:75
Transport struct. This structure represents the base class of all Transport definitions.
Definition: Transport.h:46
Device ** Devices
List of Devices.
Definition: Connection.h:73
MessageType FilterMessageType
Which Message the filter is set to.
Definition: Connection.h:78
Queue * DeviceQueue
Queue to report Device events.
Definition: Connection.h:72
The Queue struct.
Definition: Queue.h:25
uint32_t ErrorCode
Error code if connection error.
Definition: Connection.h:34
The main Message struct.
Definition: Message.h:20
Struct containing the DataFrame information.
Definition: DataFrame.h:26
Queue * ConnectionQueue
Queue to report Connection events.
Definition: Connection.h:71
This structure represents the base class of all protocol definitions.
Definition: Protocol.h:30
MessageType
Enum describing the different message types that exists.
Definition: zForceTypes.h:100
Status changed to Connected.
Definition: Connection.h:21
ConnectionStatus
Connection events.
Definition: Connection.h:19
Main struct.
Definition: zForce.h:28
DeviceType
Enum describing the different device types that exists.
Definition: zForceTypes.h:86
zForce * zForce
Pointer to zForce instance.
Definition: Connection.h:68
Brief Device base class.
Definition: Device.h:23
zForceMutex * MessageFilterMutex
Message Filter Mutex.
Definition: Connection.h:76
DLLEXTERNAL Connection * Connection_New(char *connectionString, char *protocolString, char *dataFrameType)
Create a new Connection.
uint32_t NumberOfDevices
Number of Devices detected.
Definition: Connection.h:74
ConnectionStatus ConnectionStatus
New status of Connection.
Definition: Connection.h:33
Status changed to Disconnected.
Definition: Connection.h:22
Connection messages struct.
Definition: Connection.h:31
Protocol * Protocol
Protocol this Connection uses.
Definition: Connection.h:70
uint64_t LastResponseSerialNumber
Serial number of last processed response message.
Definition: Connection.h:79
DLLINTERNAL ConnectionMessage * ConnectionMessage_New(ConnectionStatus connectionStatus, uint32_t errorCode)
Internal call used to create a new ConnectionMessage.
void(* Destructor)(ConnectionMessage *self)
Destructor.
Definition: Connection.h:35
Transport * Transport
Transport this Connection uses.
Definition: Connection.h:69