Neonode zForce(TM) SDK

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

Connection.h
Go to the documentation of this file.
1
12 #ifndef CONNECTION_CONNECTION_H
13 #define CONNECTION_CONNECTION_H
14
15 #ifndef ZFORCECOMMON_H
16 #error Please include "zForceCommon.h" before this file.
17 #endif // ZFORCECOMMON_H
18
20 typedef enum ConnectionStatus ConnectionStatus;
22 enum ConnectionStatus
23 {
24 Connected,
25 Disconnected,
26 ConnectionFault
27 };
28
30 typedef struct ConnectionMessage ConnectionMessage;
32 struct ConnectionMessage
33 {
34 ConnectionStatus ConnectionStatus;
35 uint32_t ErrorCode;
36 void ( * Destructor)(ConnectionMessage * self);
37 };
38
50 DLLINTERNAL ConnectionMessage * ConnectionMessage_New (
51 ConnectionStatus connectionStatus, uint32_t errorCode);
52
54 typedef struct Connection Connection;
56 struct Connection
57 {
58 zForce * zForce;
59 Transport * Transport;
60 Protocol * Protocol;
61 Queue * ConnectionQueue;
62 Queue * DeviceQueue;
63 Device ** Devices;
64 uint32_t NumberOfDevices;
65 bool IsConnected;
66 zForceMutex * MessageFilterMutex;
67 Device * FilterDevice;
68 MessageType FilterMessageType;
69 uint64_t LastResponseSerialNumber;
71
89 void ( * Destructor)(Connection * self);
101 bool ( * AddDevice)(Connection * self, Device * device);
140 Device * ( * FindDevice)(Connection * self, DeviceType deviceType,
141 uint32_t deviceIndex);
153 bool ( * ReceiveDataFrame)(Connection * self, DataFrame * dateFrame);
168 bool ( * SendDataFrame)(Connection * self, DataFrame * dataFrame);
185 bool ( * SetMessageFilter)(Connection * self, Device * device,
186 MessageType messageType);
203 void ( * ClearMessageFilter)(Connection * self);
222 bool ( * EnqueueMessage)(Connection * self, Device * device,
223 Message * message);
255 bool ( * Connect)(Connection * self);
280 bool ( * Disconnect)(Connection * self);
301 void ( * Timeout)(Connection * self);
320 void ( * SetTimeout)(Connection * self,
321 uint64_t relativeTimeoutMilliSeconds);
336 void ( * SignalConnectionEstablished)(Connection * self);
337 };
338
388 DLLEXTERNAL Connection * Connection_New (char * connectionString,
389 char * protocolString,
390 char * dataFrameType);
391
392 #endif // CONNECTION_CONNECTION_H
393
ConnectionFault
Connection Fault.
Definition: Connection.h:26
zForceMutex
void zForceMutex
Typecast to underlying (system) type.
Definition: OsAbstractionLayer.h:19
Connection::FilterDevice
Device * FilterDevice
Which Device the filter is set to.
Definition: Connection.h:67
Connection
The main Connection struct.
Definition: Connection.h:56
Connection::IsConnected
bool IsConnected
Connected to unit.
Definition: Connection.h:65
Transport
Transport struct. This structure represents the base class of all Transport definitions.
Definition: Transport.h:47
Connection::Devices
Device ** Devices
List of Devices.
Definition: Connection.h:63
Connection::FilterMessageType
MessageType FilterMessageType
Definition: Connection.h:68
Connection::DeviceQueue
Queue * DeviceQueue
Queue to report Device events.
Definition: Connection.h:62
Queue
The Queue struct.
Definition: Queue.h:26
ConnectionMessage::ErrorCode
uint32_t ErrorCode
Error code if connection error.
Definition: Connection.h:35
Message
The main Message struct.
Definition: Message.h:21
DataFrame
Struct containing the DataFrame information.
Definition: DataFrame.h:27
Connection::ConnectionQueue
Queue * ConnectionQueue
Queue to report Connection events.
Definition: Connection.h:61
Protocol
This structure represents the base class of all protocol definitions.
Definition: Protocol.h:31
MessageType
MessageType
Enum describing the different message types that exists.
Definition: zForceTypes.h:87
Connected
Status changed to Connected.
Definition: Connection.h:24
ConnectionStatus
ConnectionStatus
Connection events.
Definition: Connection.h:22
zForce
Main struct.
Definition: zForce.h:29
DeviceType
DeviceType
Enum describing the different device types that exists.
Definition: zForceTypes.h:73
Connection::zForce
zForce * zForce
Pointer to zForce instance.
Definition: Connection.h:58
Device
Brief Device base class.
Definition: Device.h:24
Connection::MessageFilterMutex
zForceMutex * MessageFilterMutex
Message Filter Mutex.
Definition: Connection.h:66
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:64
ConnectionMessage::ConnectionStatus
ConnectionStatus ConnectionStatus
New status of Connection.
Definition: Connection.h:34
Disconnected
Status changed to Disconnected.
Definition: Connection.h:25
ConnectionMessage
Connection messages struct.
Definition: Connection.h:32
Connection::Protocol
Protocol * Protocol
Protocol this Connection uses.
Definition: Connection.h:60
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:36
Connection::Transport
Transport * Transport
Transport this Connection uses.
Definition: Connection.h:59