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 
215  DataFrame * ( * CreateMcuUniqueIdentifierRequest) (Protocol * self, Device * device, MessageAction action,
216  uint8_t * identifier, uint32_t bufferSize);
217 
238  DataFrame * ( * CreateEnableRequest) (Protocol * self,
239  Device * device,
240  MessageAction action,
241  bool continuousMode,
242  uint32_t numberOfMessages);
260  DataFrame * ( * CreateOperationModesRequest) (Protocol * self,
261  Device * device,
262  MessageAction action,
263  OperationModes modeMask,
264  OperationModes modeValues);
280  DataFrame * ( * CreateDisableRequest) (Protocol * self,
281  Device * device,
282  MessageAction action);
299  DataFrame * ( * CreateFingerFrequencyRequest) (Protocol * self,
300  Device * device,
301  MessageAction action,
302  uint32_t frequency);
319  DataFrame * ( * CreateIdleFrequencyRequest) (Protocol * self,
320  Device * device,
321  MessageAction action,
322  uint32_t frequency);
342  DataFrame * ( * CreateDetectedObjectSizeRestrictionRequest)
343  (Protocol * self,
344  Device * device,
345  MessageAction action,
346  bool maximumSizeEnabled,
347  uint32_t maximumSize,
348  bool minimumSizeEnabled,
349  uint32_t minimumSize);
350 
367  DataFrame * ( * CreateNumberOfTrackedObjectsRequest)
368  (Protocol * self,
369  Device * device,
370  MessageAction action,
371  uint32_t numberOfTrackedObjects);
372 
392  DataFrame * ( * CreateOffsetRequest) (Protocol * self, Device * device, MessageAction action,
393  uint32_t offsetX, bool offsetXIsValid,
394  uint32_t offsetY, bool offsetYIsValid);
395 
415  DataFrame * ( * CreateHidDisplaySizeRequest) (Protocol * self, Device * device, MessageAction action,
416  uint32_t sizeX, bool sizeXIsValid,
417  uint32_t sizeY, bool sizeYIsValid);
418 
419 };
420 
421 // Exported Functions
422 
455 DLLEXTERNAL Protocol * Protocol_GetInstance (Connection * connection,
456  char * protocolString,
457  char * dataFrameType);
458 
480 DLLEXTERNAL bool Protocol_AddProtocol (ProtocolEntry * protocolEntry);
481 
492 DLLINTERNAL bool Protocol_Initialize (void);
493 
502 DLLINTERNAL void Protocol_Uninitialize (void);
503 
504 #endif // PROTOCOL_PROTOCOL_H
505 
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:133
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:124
uint64_t NotificationSerialNumber
Definition: Protocol.h:41
DLLEXTERNAL Protocol * Protocol_GetInstance(Connection *connection, char *protocolString, char *dataFrameType)
This is the Protocol factory function.