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);
45 
49  void * privateDeviceData);
50 
52 
62  bool ( * Connect)(Protocol * self);
63 
73  bool ( * Disconnect)(Protocol * self);
74 
85  bool ( * DecodeDataFrame) (Protocol * self, DataFrame * dataFrame);
86 #if 0
87 
102  DataFrame * ( * CreateDeviceCountRequest) (Protocol * self,
103  Device * device,
104  MessageAction action,
105  uint32_t totalNumberOfDevices,
106  bool HasTotalNumberOfDevices,
107  uint32_t coreDevices,
108  bool HasCoreDevices,
109  uint32_t airDevices,
110  bool HasAirDevices,
111  uint32_t plusDevices,
112  bool HasPlusDevices,
113  uint32_t lightingDevices,
114  bool HasLightingDevices);
115 #endif
116 
137  DataFrame * ( * CreateResolutionRequest) (Protocol * self,
138  Device * device,
139  MessageAction action,
140  uint32_t x,
141  bool hasX,
142  uint32_t y,
143  bool hasY,
144  uint32_t z,
145  bool hasZ);
167  DataFrame * ( * CreateTouchActiveAreaRequest) (Protocol * self,
168  Device * device,
169  MessageAction action,
170  uint32_t lowerBoundaryX,
171  uint32_t upperBoundaryX,
172  bool xIsValid,
173  bool xIsReversed,
174  uint32_t lowerBoundaryY,
175  uint32_t upperBoundaryY,
176  bool yIsValid,
177  bool yIsReversed);
198  DataFrame * ( * CreateEnableRequest) (Protocol * self,
199  Device * device,
200  MessageAction action,
201  bool continuousMode,
202  uint32_t numberOfMessages);
220  DataFrame * ( * CreateOperationModesRequest) (Protocol * self,
221  Device * device,
222  MessageAction action,
223  OperationModes modeMask,
224  OperationModes modeValues);
240  DataFrame * ( * CreateDisableRequest) (Protocol * self,
241  Device * device,
242  MessageAction action);
259  DataFrame * ( * CreateFingerFrequencyRequest) (Protocol * self,
260  Device * device,
261  MessageAction action,
262  uint32_t frequency);
279  DataFrame * ( * CreateIdleFrequencyRequest) (Protocol * self,
280  Device * device,
281  MessageAction action,
282  uint32_t frequency);
302  DataFrame * ( * CreateDetectedObjectSizeRestrictionRequest)
303  (Protocol * self,
304  Device * device,
305  MessageAction action,
306  bool maximumSizeEnabled,
307  uint32_t maximumSize,
308  bool minimumSizeEnabled,
309  uint32_t minimumSize);
310 
327  DataFrame * ( * CreateNumberOfTrackedObjectsRequest)
328  (Protocol * self,
329  Device * device,
330  MessageAction action,
331  uint32_t numberOfTrackedObjects);
332 
333 };
334 
335 // Exported Functions
336 
369 DLLEXTERNAL Protocol * Protocol_GetInstance (Connection * connection,
370  char * protocolString,
371  char * dataFrameType);
372 
394 DLLEXTERNAL bool Protocol_AddProtocol (ProtocolEntry * protocolEntry);
395 
406 DLLINTERNAL bool Protocol_Initialize (void);
407 
416 DLLINTERNAL void Protocol_Uninitialize (void);
417 
418 #endif // PROTOCOL_PROTOCOL_H
419 
bool(* Disconnect)(Protocol *self)
Perform protocol specific processing upon disconnection.
Definition: Protocol.h:73
OperationModes
Enum describing the OperationModes that a sensor can operate in.
Definition: zForceTypes.h:121
DLLEXTERNAL bool Protocol_AddProtocol(ProtocolEntry *protocolEntry)
Add a new protocol to the list of those available.
uint64_t ResponseSerialNumber
Definition: Protocol.h:37
void(* DestroyPrivateDeviceData)(Protocol *self, void *privateDeviceData)
Definition: Protocol.h:48
DLLINTERNAL bool Protocol_Initialize(void)
Initialize the Protocol module.
The main Connection struct.
Definition: Connection.h:56
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:62
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:85
Main struct.
Definition: zForce.h:29
zForce * zForce
A pointer to the global zForce instance.
Definition: Protocol.h:51
Brief Device base class.
Definition: Device.h:24
struct ProtocolEntry ProtocolEntry
Definition: zForceTypes.h:34
MessageAction
Enum describing the action of a message.
Definition: zForceTypes.h:112
uint64_t NotificationSerialNumber
Definition: Protocol.h:41
DLLEXTERNAL Protocol * Protocol_GetInstance(Connection *connection, char *protocolString, char *dataFrameType)
This is the Protocol factory function.