Neonode zForce(TM) SDK
Protocol.h
Go to the documentation of this file.
1 
10 #ifndef PROTOCOL_PROTOCOL_H
11 #define PROTOCOL_PROTOCOL_H 1
12 
13 #ifndef ZFORCECOMMON_H
14  #error Please include "zForceCommon.h" before this file.
15 #endif // ZFORCECOMMON_H
16 
20 typedef struct Protocol Protocol;
27 struct Protocol
28 {
31 
34 
40 
46 
48  void ( * Destructor) (Protocol * self);
49 
51  void ( * DestroyPrivateDeviceData) (Protocol * self, void * privateDeviceData);
52 
55 
67  bool ( * Connect) (Protocol * self);
68 
80  bool ( * Disconnect) (Protocol * self);
81 
94  bool ( * DecodeDataFrame) (Protocol * self, DataFrame * dataFrame);
95 #if 0
96  // When this is implemented, or a placeholder is placed, it will be an ABI-breaking change, but only
97  // for programs implementing their own protocol.
98  // So maybe better that, when we actually do other ABI-breaking changes, we implement this,
99  // even if it always returns an error, as opposed to not existing.
116  DataFrame * ( * CreateDeviceCountRequest) (Protocol * self, Device * device, MessageAction action,
117  uint32_t totalNumberOfDevices, bool HasTotalNumberOfDevices,
118  uint32_t coreDevices, bool HasCoreDevices,
119  uint32_t airDevices, bool HasAirDevices,
120  uint32_t plusDevices, bool HasPlusDevices,
121  uint32_t lightingDevices, bool HasLightingDevices);
122 #endif // 0
145  DataFrame * ( * CreateResolutionRequest) (Protocol * self, Device * device, MessageAction action,
146  uint32_t x, bool hasX,
147  uint32_t y, bool hasY,
148  uint32_t z, bool hasZ);
149 
170  DataFrame * ( * CreateTouchActiveAreaRequest) (Protocol * self, Device * device, MessageAction action,
171  uint32_t lowerBoundX, uint32_t upperBoundX, bool xIsValid,
172  uint32_t lowerBoundY, uint32_t upperBoundY, bool yIsValid);
173 
192  DataFrame * ( * CreateReverseTouchActiveAreaRequest) (Protocol * self, Device * device, MessageAction action,
193  bool xIsReversed, bool yIsReversed);
194 
212  DataFrame * ( * CreateFlipXYRequest) (Protocol * self, Device * device, MessageAction action, bool axesAreFlipped);
213 
230  DataFrame * ( * CreateReflectiveEdgeFilterRequest) (Protocol * self, Device * device, MessageAction action,
231  bool isFilterOn);
232 
250  DataFrame * ( * CreateMergeTouchesRequest) (Protocol * self, Device * device, MessageAction action,
251  bool areTouchesMerged);
252 
269  DataFrame * ( * CreateDetectionModeRequest) (Protocol * self, Device * device, MessageAction action);
270 
289  DataFrame * ( * CreateMcuUniqueIdentifierRequest) (Protocol * self, Device * device, MessageAction action,
290  uint8_t * identifier, uint32_t bufferSize);
291 
311  DataFrame * ( * CreateEnableRequest) (Protocol * self, Device * device, MessageAction action,
312  bool continuousMode, uint32_t numberOfMessages);
313 
332  DataFrame * ( * CreateOperationModesRequest) (Protocol * self,
333  Device * device,
334  MessageAction action,
335  OperationModes modeMask,
336  OperationModes modeValues);
337 
354  DataFrame * ( * CreateDisableRequest) (Protocol * self, Device * device, MessageAction action);
355 
373  DataFrame * ( * CreateFingerFrequencyRequest) (Protocol * self, Device * device, MessageAction action,
374  uint32_t frequency);
375 
393  DataFrame * ( * CreateIdleFrequencyRequest) (Protocol * self, Device * device, MessageAction action,
394  uint32_t frequency);
395 
416  DataFrame * ( * CreateDetectedObjectSizeRestrictionRequest) (Protocol * self, Device * device, MessageAction action,
417  bool maximumSizeEnabled, uint32_t maximumSize,
418  bool minimumSizeEnabled, uint32_t minimumSize);
419 
437  DataFrame * ( * CreateNumberOfTrackedObjectsRequest) (Protocol * self, Device * device, MessageAction action,
438  uint32_t numberOfTrackedObjects);
439 
460  DataFrame * ( * CreateOffsetRequest) (Protocol * self, Device * device, MessageAction action,
461  uint32_t offsetX, bool offsetXIsValid,
462  uint32_t offsetY, bool offsetYIsValid);
463 
484  DataFrame * ( * CreateHidDisplaySizeRequest) (Protocol * self, Device * device, MessageAction action,
485  uint32_t sizeX, bool sizeXIsValid,
486  uint32_t sizeY, bool sizeYIsValid);
487 
509  DataFrame * ( * CreateTouchModeRequest) (Protocol * self, Device * device, MessageAction action,
510  TouchModes touchMode, bool touchModeIsValid,
511  uint32_t clickOnTouchTime, bool clickOnTouchTimeIsValid,
512  uint32_t clickOnTouchRadius, bool clickOnTouchRadiusIsValid);
513 
534  DataFrame * ( * CreateFloatingProtectionRequest) (Protocol * self, Device * device, MessageAction action,
535  bool enabled, bool enabledIsValid,
536  uint32_t time, bool timeIsValid);
537 
566  DataFrame * ( * CreateSnappingFilterRequest) (Protocol * self, Device * device, MessageAction action,
567  bool enabled, bool enabledIsValid,
568  uint32_t leftInner,
569  uint32_t leftOuter, bool leftIsValid,
570  uint32_t rightInner,
571  uint32_t rightOuter, bool rightIsValid,
572  uint32_t topInner,
573  uint32_t topOuter, bool topIsValid,
574  uint32_t bottomInner,
575  uint32_t bottomOuter, bool bottomIsValid);
576 
601  DataFrame * ( * CreateDoubleClickPreventionRequest) (Protocol * self, Device * device,
602  MessageAction action,
603  bool enabled,
604  bool enabledIsValid,
605  uint32_t doubleClickPreventionTime,
606  bool doubleClickPreventionTimeIsValid,
607  uint32_t doubleClickPreventionRadius,
608  bool doubleClickPreventionRadiusIsValid);
609 };
610 
611 // Exported Functions
612 
613 #ifdef __cplusplus
614 extern "C"
615 {
616 #endif // __cplusplus
617 
641 DLLEXTERNAL Protocol * Protocol_GetInstance (Connection * connection, char * protocolString, char * dataFrameType);
642 
659 DLLEXTERNAL bool Protocol_AddProtocol (ProtocolEntry * protocolEntry);
660 
671 DLLINTERNAL bool Protocol_Initialize (void);
672 
680 DLLINTERNAL void Protocol_Uninitialize (void);
681 
682 #ifdef __cplusplus
683 }
684 #endif // __cplusplus
685 
686 #endif // PROTOCOL_PROTOCOL_H
DLLEXTERNAL Protocol * Protocol_GetInstance(Connection *connection, char *protocolString, char *dataFrameType)
This is the Protocol factory function.
DLLEXTERNAL bool Protocol_AddProtocol(ProtocolEntry *protocolEntry)
Add a new protocol to the list of those available.
DLLINTERNAL bool Protocol_Initialize(void)
Initialize the Protocol module.
DLLINTERNAL void Protocol_Uninitialize(void)
Unitialize the Protocol module.
The main Connection struct.
Definition: Connection.h:66
Struct containing the DataFrame information.
Definition: DataFrame.h:25
Device base class.
Definition: Device.h:26
This structure represents the base class of all protocol definitions.
Definition: Protocol.h:28
uint64_t NotificationSerialNumber
Definition: Protocol.h:45
Protocol * Base
The immediate base class of this Protocol class.
Definition: Protocol.h:30
bool(* Connect)(Protocol *self)
Perform protocol specific processing upon connection.
Definition: Protocol.h:67
void(* DestroyPrivateDeviceData)(Protocol *self, void *privateDeviceData)
Protocol Specific method to destroy any potential Protocol Specific Data stored in a Device;.
Definition: Protocol.h:51
zForce * zForce
A pointer to the global zForce instance.
Definition: Protocol.h:54
void(* Destructor)(Protocol *self)
The destructor for this class.
Definition: Protocol.h:48
uint64_t ResponseSerialNumber
Definition: Protocol.h:39
bool(* Disconnect)(Protocol *self)
Perform protocol specific processing upon disconnection.
Definition: Protocol.h:80
bool(* DecodeDataFrame)(Protocol *self, DataFrame *dataFrame)
Give a data frame to Protocol for processing.
Definition: Protocol.h:94
Connection * Connection
Each Protocol is linked to one connection.
Definition: Protocol.h:33
Main struct.
Definition: zForce.h:29
TouchModes
Enum describing what touch mode a device can be in.
Definition: zForceTypes.h:191
struct ProtocolEntry ProtocolEntry
Definition: zForceTypes.h:34
MessageAction
Enum describing the action of a message.
Definition: zForceTypes.h:146
OperationModes
Enum describing the OperationModes that a sensor can operate in.
Definition: zForceTypes.h:155