Neonode zForce(TM) SDK

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

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
19 enum ConnectionStatus
20 {
21 Connected,
22 Disconnected,
23 ConnectionFault
24 };
26 typedef enum ConnectionStatus ConnectionStatus;
27
29 typedef struct ConnectionMessage ConnectionMessage;
31 struct ConnectionMessage
32 {
33 ConnectionStatus ConnectionStatus;
34 uint32_t ErrorCode;
35 void ( * Destructor)(ConnectionMessage * self);
36 };
37
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif // __cplusplus
42
54 DLLINTERNAL ConnectionMessage * ConnectionMessage_New (
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)
68 zForce * zForce;
69 Transport * Transport;
70 Protocol * Protocol;
71 Queue * ConnectionQueue;
72 Queue * DeviceQueue;
73 Device ** Devices;
74 uint32_t NumberOfDevices;
75 bool IsConnected;
76 zForceMutex * MessageFilterMutex;
77 Device * FilterDevice;
78 MessageType FilterMessageType;
79 uint64_t LastResponseSerialNumber;
81
99 void ( * Destructor)(Connection * self);
111 bool ( * AddDevice)(Connection * self, Device * device);
150 Device * ( * FindDevice)(Connection * self, DeviceType deviceType,
151 uint32_t deviceIndex);
163 bool ( * ReceiveDataFrame)(Connection * self, DataFrame * dateFrame);
178 bool ( * SendDataFrame)(Connection * self, DataFrame * dataFrame);
195 bool ( * SetMessageFilter)(Connection * self, Device * device,
196 MessageType messageType);
213 void ( * ClearMessageFilter)(Connection * self);
232 bool ( * EnqueueMessage)(Connection * self, Device * device,
233 Message * message);
265 bool ( * Connect)(Connection * self);
290 bool ( * Disconnect)(Connection * self);
311 void ( * Timeout)(Connection * self);
330 void ( * SetTimeout)(Connection * self,
331 uint64_t relativeTimeoutMilliSeconds);
346 void ( * SignalConnectionEstablished)(Connection * self);
347 #endif // !defined(CONNECTION_CONNECTION_H) || defined(CONTAINS_CONNECTION)
348 #if !defined(CONNECTION_CONNECTION_H) && !defined(CONTAINS_CONNECTION)
349 };
350
351 #ifdef __cplusplus
352 extern "C"
353 {
354 #endif // __cplusplus
355
405 DLLEXTERNAL Connection * Connection_New (char * connectionString,
406 char * protocolString,
407 char * dataFrameType);
408
409 #ifdef __cplusplus
410 }
411 #endif // __cplusplus
412
413 #define CONNECTION_CONNECTION_H
414 #endif // !defined(CONNECTION_CONNECTION_H) && !defined(CONTAINS_CONNECTION)
415
ConnectionFault
Connection Fault.
Definition: Connection.h:23
zForceMutex
void zForceMutex
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:18
Connection::FilterDevice
Device * FilterDevice
Which Device the filter is set to.
Definition: Connection.h:77
Connection
The main Connection struct.
Definition: Connection.h:64
Connection::IsConnected
bool IsConnected
Connected to unit.
Definition: Connection.h:75
Transport
Transport struct. This structure represents the base class of all Transport definitions.
Definition: Transport.h:46
Connection::Devices
Device ** Devices
List of Devices.
Definition: Connection.h:73
Connection::FilterMessageType
MessageType FilterMessageType
Definition: Connection.h:78
Connection::DeviceQueue
Queue * DeviceQueue
Queue to report Device events.
Definition: Connection.h:72
Queue
The Queue struct.
Definition: Queue.h:25
ConnectionMessage::ErrorCode
uint32_t ErrorCode
Error code if connection error.
Definition: Connection.h:34
Message
The main Message struct.
Definition: Message.h:20
DataFrame
Struct containing the DataFrame information.
Definition: DataFrame.h:26
Connection::ConnectionQueue
Queue * ConnectionQueue
Queue to report Connection events.
Definition: Connection.h:71
Protocol
This structure represents the base class of all protocol definitions.
Definition: Protocol.h:30
MessageType
MessageType
Enum describing the different message types that exists.
Definition: zForceTypes.h:96
Connected
Status changed to Connected.
Definition: Connection.h:21
ConnectionStatus
ConnectionStatus
Connection events.
Definition: Connection.h:19
zForce
Main struct.
Definition: zForce.h:28
DeviceType
DeviceType
Enum describing the different device types that exists.
Definition: zForceTypes.h:82
Connection::zForce
zForce * zForce
Pointer to zForce instance.
Definition: Connection.h:68
Device
Brief Device base class.
Definition: Device.h:23
Connection::MessageFilterMutex
zForceMutex * MessageFilterMutex
Message Filter Mutex.
Definition: Connection.h:76
Connection_New
DLLEXTERNAL Connection * Connection_New(char *connectionString, char *protocolString, char *dataFrameType)
Create a new Connection.
Connection::NumberOfDevices
uint32_t NumberOfDevices
Number of Devices detected.
Definition: Connection.h:74
ConnectionMessage::ConnectionStatus
ConnectionStatus ConnectionStatus
New status of Connection.
Definition: Connection.h:33
Disconnected
Status changed to Disconnected.
Definition: Connection.h:22
ConnectionMessage
Connection messages struct.
Definition: Connection.h:31
Connection::Protocol
Protocol * Protocol
Protocol this Connection uses.
Definition: Connection.h:70
ConnectionMessage_New
DLLINTERNAL ConnectionMessage * ConnectionMessage_New(ConnectionStatus connectionStatus, uint32_t errorCode)
Internal call used to create a new ConnectionMessage.
ConnectionMessage::Destructor
void(* Destructor)(ConnectionMessage *self)
Destructor.
Definition: Connection.h:35
Connection::Transport
Transport * Transport
Transport this Connection uses.
Definition: Connection.h:69