Neonode zForce(TM) SDK
Protocol.h
Go to the documentation of this file.
1 
12 #ifndef PROTOCOL_PROTOCOL_H
13 #define PROTOCOL_PROTOCOL_H
14 
15 #ifndef ZFORCECOMMON_H
16  #error Please include "zForceCommon.h" before this file.
17 #endif // ZFORCECOMMON_H
18 
22 typedef struct Protocol Protocol;
31 struct Protocol
32 {
35  uint64_t ResponseSerialNumber;
38 
42 
44  void ( * Destructor)(Protocol * self);
46 
56  bool ( * Connect)(Protocol * self);
57 
67  bool ( * Disconnect)(Protocol * self);
68 
79  bool ( * DecodeDataFrame) (Protocol * self, DataFrame * dataFrame);
80 #if 0
81 
96  DataFrame * ( * CreateDeviceCountRequest) (Protocol * self,
97  Device * device,
98  MessageAction action,
99  uint32_t totalNumberOfDevices,
100  bool HasTotalNumberOfDevices,
101  uint32_t coreDevices,
102  bool HasCoreDevices,
103  uint32_t airDevices,
104  bool HasAirDevices,
105  uint32_t plusDevices,
106  bool HasPlusDevices,
107  uint32_t lightingDevices,
108  bool HasLightingDevices);
109 #endif
110 
131  DataFrame * ( * CreateResolutionRequest) (Protocol * self,
132  Device * device,
133  MessageAction action,
134  uint32_t x,
135  bool hasX,
136  uint32_t y,
137  bool hasY,
138  uint32_t z,
139  bool hasZ);
161  DataFrame * ( * CreateTouchActiveAreaRequest) (Protocol * self,
162  Device * device,
163  MessageAction action,
164  uint32_t lowerBoundaryX,
165  uint32_t upperBoundaryX,
166  bool xIsValid,
167  bool xIsReversed,
168  uint32_t lowerBoundaryY,
169  uint32_t upperBoundaryY,
170  bool yIsValid,
171  bool yIsReversed);
192  DataFrame * ( * CreateEnableRequest) (Protocol * self,
193  Device * device,
194  MessageAction action,
195  bool continuousMode,
196  uint32_t numberOfMessages);
214  DataFrame * ( * CreateOperationModesRequest) (Protocol * self,
215  Device * device,
216  MessageAction action,
217  OperationModes modeMask,
218  OperationModes modeValues);
234  DataFrame * ( * CreateDisableRequest) (Protocol * self,
235  Device * device,
236  MessageAction action);
253  DataFrame * ( * CreateFingerFrequencyRequest) (Protocol * self,
254  Device * device,
255  MessageAction action,
256  uint32_t frequency);
273  DataFrame * ( * CreateIdleFrequencyRequest) (Protocol * self,
274  Device * device,
275  MessageAction action,
276  uint32_t frequency);
296  DataFrame * ( * CreateDetectedObjectSizeRestrictionRequest)
297  (Protocol * self,
298  Device * device,
299  MessageAction action,
300  bool maximumSizeEnabled,
301  uint32_t maximumSize,
302  bool minimumSizeEnabled,
303  uint32_t minimumSize);
304 
321  DataFrame * ( * CreateNumberOfTrackedObjectsRequest)
322  (Protocol * self,
323  Device * device,
324  MessageAction action,
325  uint32_t numberOfTrackedObjects);
326 
327 };
328 
329 // Exported Functions
330 
363 DLLEXTERNAL Protocol * Protocol_GetInstance (Connection * connection,
364  char * protocolString,
365  char * dataFrameType);
366 
388 DLLEXTERNAL bool Protocol_AddProtocol (ProtocolEntry * protcolEntry);
389 
400 DLLINTERNAL bool Protocol_Initialize (void);
401 
410 DLLINTERNAL void Protocol_Uninitialize (void);
411 
412 #endif // PROTOCOL_PROTOCOL_H
413 
bool(* Disconnect)(Protocol *self)
Perform protocol specific processing upon disconnection.
Definition: Protocol.h:67
OperationModes
Definition: zForceTypes.h:87
uint64_t ResponseSerialNumber
Definition: Protocol.h:37
DLLEXTERNAL bool Protocol_AddProtocol(ProtocolEntry *protcolEntry)
Add a new protocol to the list of those available.
DLLINTERNAL bool Protocol_Initialize(void)
Initialize the Protocol module.
The main Connection struct.
Definition: Connection.h:43
Protocol * Base
The immediate base class of this Protocol class.
Definition: Protocol.h:33
bool(* Connect)(Protocol *self)
Perform protocol specific processing upon connection.
Definition: Protocol.h:56
Connection * Connection
Definition: Protocol.h:34
void(* Destructor)(Protocol *self)
The destructor for this class.
Definition: Protocol.h:44
DLLINTERNAL void Protocol_Uninitialize(void)
Unitialize the Protocol module.
Struct containing the DataFrame information.
Definition: DataFrame.h:27
This structure represents the base class of all protocol definitions.
Definition: Protocol.h:31
bool(* DecodeDataFrame)(Protocol *self, DataFrame *dataFrame)
Give a data frame to Protocol for processing.
Definition: Protocol.h:79
Main struct.
Definition: zForce.h:29
zForce * zForce
A pointer to the global zForce instance.
Definition: Protocol.h:45
Brief Device base class.
Definition: Device.h:24
MessageAction
Definition: zForceTypes.h:80
uint64_t NotificationSerialNumber
Definition: Protocol.h:41
DLLEXTERNAL Protocol * Protocol_GetInstance(Connection *connection, char *protocolString, char *dataFrameType)
This is the Protocol factory function.