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);
165  DataFrame * ( * CreateTouchActiveAreaRequest) (Protocol * self,
166  Device * device,
167  MessageAction action,
168  uint32_t lowerBoundaryX,
169  uint32_t upperBoundaryX,
170  bool xIsValid,
171  uint32_t lowerBoundaryY,
172  uint32_t upperBoundaryY,
173  bool yIsValid);
174 
192  DataFrame * ( * CreateReverseTouchActiveAreaRequest) (Protocol * self,
193  Device * device,
194  MessageAction action,
195  bool xIsReversed,
196  bool yIsReversed);
197 
218  DataFrame * ( * CreateEnableRequest) (Protocol * self,
219  Device * device,
220  MessageAction action,
221  bool continuousMode,
222  uint32_t numberOfMessages);
240  DataFrame * ( * CreateOperationModesRequest) (Protocol * self,
241  Device * device,
242  MessageAction action,
243  OperationModes modeMask,
244  OperationModes modeValues);
260  DataFrame * ( * CreateDisableRequest) (Protocol * self,
261  Device * device,
262  MessageAction action);
279  DataFrame * ( * CreateFingerFrequencyRequest) (Protocol * self,
280  Device * device,
281  MessageAction action,
282  uint32_t frequency);
299  DataFrame * ( * CreateIdleFrequencyRequest) (Protocol * self,
300  Device * device,
301  MessageAction action,
302  uint32_t frequency);
322  DataFrame * ( * CreateDetectedObjectSizeRestrictionRequest)
323  (Protocol * self,
324  Device * device,
325  MessageAction action,
326  bool maximumSizeEnabled,
327  uint32_t maximumSize,
328  bool minimumSizeEnabled,
329  uint32_t minimumSize);
330 
347  DataFrame * ( * CreateNumberOfTrackedObjectsRequest)
348  (Protocol * self,
349  Device * device,
350  MessageAction action,
351  uint32_t numberOfTrackedObjects);
352 
353 };
354 
355 // Exported Functions
356 
389 DLLEXTERNAL Protocol * Protocol_GetInstance (Connection * connection,
390  char * protocolString,
391  char * dataFrameType);
392 
414 DLLEXTERNAL bool Protocol_AddProtocol (ProtocolEntry * protocolEntry);
415 
426 DLLINTERNAL bool Protocol_Initialize (void);
427 
436 DLLINTERNAL void Protocol_Uninitialize (void);
437 
438 #endif // PROTOCOL_PROTOCOL_H
439 
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:124
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:115
uint64_t NotificationSerialNumber
Definition: Protocol.h:41
DLLEXTERNAL Protocol * Protocol_GetInstance(Connection *connection, char *protocolString, char *dataFrameType)
This is the Protocol factory function.