1 #ifndef NUITRACK_HAND_TRACKER_H_
2 #define NUITRACK_HAND_TRACKER_H_
6 #include "nuitrack/modules/HeaderOnlyAPI_Module.h"
7 #include "nuitrack/types/Export.h"
8 #include "nuitrack/types/HandTrackerData.h"
9 #include "nuitrack/capi/HandTracker_CAPI.h"
10 #include "nuitrack/utils/ExceptionTranslator.h"
11 #include "nuitrack/utils/CallbackStruct.h"
28 class HandTracker :
public tdv::nuitrack::HeaderOnlyAPI_Module
35 typedef std::shared_ptr<HandTracker>
Ptr;
46 typedef std::function<void (HandTrackerData::Ptr)>
OnUpdate;
59 NuitrackModule* pimpl = NULL;
60 ExceptionType exception_code = nuitrack_CreateHandTracker(&pimpl);
61 ExceptionTranslator::generateExceptionByErrorCode(exception_code);
62 return std::shared_ptr<HandTracker>(
new HandTracker(pimpl));
68 nuitrack_DestroyHandTracker(
_pimpl);
110 HandTrackerDataInner* data = NULL;
111 nuitrack_ReceiveInnerHandTrackerData(
_pimpl, &data);
121 return nuitrack_GetHandTrackerProcessingTime(
_pimpl);
124 bool canUpdate()
const
126 return nuitrack_GetNuitrackModuleCanUpdate(
_pimpl);
137 return nuitrack_GetNuitrackModuleTimestamp(
_pimpl);
uint64_t connectOnUpdate(const OnUpdate &callback)
Add a callback for the hand data update request.
Definition: HandTracker.h:89
Represents the interface to the capabilities of the Nuitrack Hand Tracker module. ...
Definition: HandTracker.h:28
HandTrackerCallbackWrapper _callbackWrapper
Definition: HandTracker.h:156
ExceptionType
Possible error codes for Nuitrack internal functions.
Definition: Error.h:20
HandTracker(NuitrackModule *pimpl)
Definition: HandTracker.h:72
float getProcessingTime() const
Returns last hand data processing time in milliseconds.
Definition: HandTracker.h:119
virtual uint64_t getTimestamp()
Returns the last processed data timestamp in microseconds.
Definition: HandTracker.h:135
std::function< void(HandTrackerData::Ptr)> OnUpdate
The callback type of the hand data update request.
Definition: HandTracker.h:46
void destroyHandTracker()
Definition: HandTracker.h:148
std::shared_ptr< HandTracker > Ptr
Smart pointer to access the SkeletonTracker instance.
Definition: HandTracker.h:35
static HandTracker::Ptr create()
Create the HandTracker module object.
Definition: HandTracker.h:57
static void onUpdateCallback(HandTrackerDataInner *data, HandTracker *tracker)
Definition: HandTracker.h:142
void disconnectOnUpdate(uint64_t handler)
Remove a callback of the hand data update request.
Definition: HandTracker.h:100
NuitrackModule * _pimpl
Definition: HandTracker.h:154
HandTrackerData::Ptr getData()
Returns smart pointer to the last avilable HandTrackerData.
Definition: HandTracker.h:108
CallbackStruct< HandTrackerData::Ptr > * _callbackStruct
Definition: HandTracker.h:158
Stores hand tracking results related to a specific point in time.
Definition: HandTrackerData.h:17