Neonode zForce(TM) SDK
Protocol.h
Go to the documentation of this file.
1 
12 #if !defined(PROTOCOL_PROTOCOL_H) && !defined(CONTAINS_PROTOCOL)
13 
14 #ifndef ZFORCECOMMON_H
15  #error Please include "zForceCommon.h" before this file.
16 #endif // ZFORCECOMMON_H
17 
21 typedef struct Protocol Protocol;
30 struct Protocol
31 {
32 #endif // !defined(PROTOCOL_PROTOCOL_H) && !defined(CONTAINS_PROTOCOL)
33 #if !defined(PROTOCOL_PROTOCOL_H) || defined(CONTAINS_PROTOCOL)
36  uint64_t ResponseSerialNumber;
39 
43 
45  void ( * Destructor)(Protocol * self);
46 
50  void * privateDeviceData);
51 
53 
63  bool ( * Connect)(Protocol * self);
64 
74  bool ( * Disconnect)(Protocol * self);
75 
86  bool ( * DecodeDataFrame) (Protocol * self, DataFrame * dataFrame);
87 #if 0
88 
103  DataFrame * ( * CreateDeviceCountRequest) (Protocol * self,
104  Device * device,
105  MessageAction action,
106  uint32_t totalNumberOfDevices,
107  bool HasTotalNumberOfDevices,
108  uint32_t coreDevices,
109  bool HasCoreDevices,
110  uint32_t airDevices,
111  bool HasAirDevices,
112  uint32_t plusDevices,
113  bool HasPlusDevices,
114  uint32_t lightingDevices,
115  bool HasLightingDevices);
116 #endif // 0
117 
138  DataFrame * ( * CreateResolutionRequest) (Protocol * self,
139  Device * device,
140  MessageAction action,
141  uint32_t x,
142  bool hasX,
143  uint32_t y,
144  bool hasY,
145  uint32_t z,
146  bool hasZ);
166  DataFrame * ( * CreateTouchActiveAreaRequest) (Protocol * self,
167  Device * device,
168  MessageAction action,
169  uint32_t lowerBoundaryX,
170  uint32_t upperBoundaryX,
171  bool xIsValid,
172  uint32_t lowerBoundaryY,
173  uint32_t upperBoundaryY,
174  bool yIsValid);
175 
193  DataFrame * ( * CreateReverseTouchActiveAreaRequest) (Protocol * self,
194  Device * device,
195  MessageAction action,
196  bool xIsReversed,
197  bool yIsReversed);
198 
215  DataFrame * ( * CreateFlipXYRequest) (Protocol * self, Device * device, MessageAction action, bool axesAreFlipped);
216 
232  DataFrame * ( * CreateReflectiveEdgeFilterRequest) (Protocol * self, Device * device, MessageAction action,
233  bool isFilterOn);
234 
251  DataFrame * ( * CreateMergeTouchesRequest) (Protocol * self, Device * device, MessageAction action,
252  bool areTouchesMerged);
253 
269  DataFrame * ( * CreateDetectionModeRequest) (Protocol * self, Device * device, MessageAction action);
270 
288  DataFrame * ( * CreateMcuUniqueIdentifierRequest) (Protocol * self, Device * device, MessageAction action,
289  uint8_t * identifier, uint32_t bufferSize);
290 
311  DataFrame * ( * CreateEnableRequest) (Protocol * self,
312  Device * device,
313  MessageAction action,
314  bool continuousMode,
315  uint32_t numberOfMessages);
333  DataFrame * ( * CreateOperationModesRequest) (Protocol * self,
334  Device * device,
335  MessageAction action,
336  OperationModes modeMask,
337  OperationModes modeValues);
353  DataFrame * ( * CreateDisableRequest) (Protocol * self,
354  Device * device,
355  MessageAction action);
372  DataFrame * ( * CreateFingerFrequencyRequest) (Protocol * self,
373  Device * device,
374  MessageAction action,
375  uint32_t frequency);
392  DataFrame * ( * CreateIdleFrequencyRequest) (Protocol * self,
393  Device * device,
394  MessageAction action,
395  uint32_t frequency);
415  DataFrame * ( * CreateDetectedObjectSizeRestrictionRequest)
416  (Protocol * self,
417  Device * device,
418  MessageAction action,
419  bool maximumSizeEnabled,
420  uint32_t maximumSize,
421  bool minimumSizeEnabled,
422  uint32_t minimumSize);
423 
440  DataFrame * ( * CreateNumberOfTrackedObjectsRequest)
441  (Protocol * self,
442  Device * device,
443  MessageAction action,
444  uint32_t numberOfTrackedObjects);
445 
465  DataFrame * ( * CreateOffsetRequest) (Protocol * self, Device * device, MessageAction action,
466  uint32_t offsetX, bool offsetXIsValid,
467  uint32_t offsetY, bool offsetYIsValid);
468 
488  DataFrame * ( * CreateHidDisplaySizeRequest) (Protocol * self, Device * device, MessageAction action,
489  uint32_t sizeX, bool sizeXIsValid,
490  uint32_t sizeY, bool sizeYIsValid);
491 
512  DataFrame * ( * CreateTouchModeRequest) (Protocol * self, Device * device, MessageAction action,
513  TouchModes touchMode, bool touchModeIsValid,
514  uint32_t clickOnTouchTime, bool clickOnTouchTimeIsValid,
515  uint32_t clickOnTouchRadius, bool clickOnTouchRadiusIsValid);
516 
536  DataFrame * ( * CreateFloatingProtectionRequest) (Protocol * self, Device * device, MessageAction action,
537  bool enabled, bool enabledIsValid,
538  uint32_t time, bool timeIsValid);
539 
540 #endif // !defined(PROTOCOL_PROTOCOL_H) || defined(CONTAINS_PROTOCOL)
541 #if !defined(PROTOCOL_PROTOCOL_H) && !defined(CONTAINS_PROTOCOL)
542 };
543 
544 // Exported Functions
545 
546 #ifdef __cplusplus
547 extern "C"
548 {
549 #endif // __cplusplus
550 
583 DLLEXTERNAL Protocol * Protocol_GetInstance (Connection * connection,
584  char * protocolString,
585  char * dataFrameType);
586 
608 DLLEXTERNAL bool Protocol_AddProtocol (ProtocolEntry * protocolEntry);
609 
620 DLLINTERNAL bool Protocol_Initialize (void);
621 
630 DLLINTERNAL void Protocol_Uninitialize (void);
631 
632 #ifdef __cplusplus
633 }
634 #endif // __cplusplus
635 
636 #define PROTOCOL_PROTOCOL_H
637 #endif // !defined(PROTOCOL_PROTOCOL_H) && !defined(CONTAINS_PROTOCOL)
638 
bool(* Disconnect)(Protocol *self)
Perform protocol specific processing upon disconnection.
Definition: Protocol.h:74
OperationModes
Enum describing the OperationModes that a sensor can operate in.
Definition: zForceTypes.h:149
DLLEXTERNAL bool Protocol_AddProtocol(ProtocolEntry *protocolEntry)
Add a new protocol to the list of those available.
uint64_t ResponseSerialNumber
Definition: Protocol.h:38
void(* DestroyPrivateDeviceData)(Protocol *self, void *privateDeviceData)
Definition: Protocol.h:49
DLLINTERNAL bool Protocol_Initialize(void)
Initialize the Protocol module.
TouchModes
Enum describing what touch mode a device can be in.
Definition: zForceTypes.h:185
The main Connection struct.
Definition: Connection.h:64
Protocol * Base
The immediate base class of this Protocol class.
Definition: Protocol.h:34
bool(* Connect)(Protocol *self)
Perform protocol specific processing upon connection.
Definition: Protocol.h:63
Connection * Connection
Definition: Protocol.h:35
void(* Destructor)(Protocol *self)
The destructor for this class.
Definition: Protocol.h:45
DLLINTERNAL void Protocol_Uninitialize(void)
Unitialize the Protocol module.
Struct containing the DataFrame information.
Definition: DataFrame.h:26
This structure represents the base class of all protocol definitions.
Definition: Protocol.h:30
bool(* DecodeDataFrame)(Protocol *self, DataFrame *dataFrame)
Give a data frame to Protocol for processing.
Definition: Protocol.h:86
Main struct.
Definition: zForce.h:28
zForce * zForce
A pointer to the global zForce instance.
Definition: Protocol.h:52
Brief Device base class.
Definition: Device.h:23
struct ProtocolEntry ProtocolEntry
Definition: zForceTypes.h:35
MessageAction
Enum describing the action of a message.
Definition: zForceTypes.h:140
uint64_t NotificationSerialNumber
Definition: Protocol.h:42
DLLEXTERNAL Protocol * Protocol_GetInstance(Connection *connection, char *protocolString, char *dataFrameType)
This is the Protocol factory function.