-
Notifications
You must be signed in to change notification settings - Fork 3
/
WeArtTrackingCalibration.cpp
29 lines (24 loc) · 1.09 KB
/
WeArtTrackingCalibration.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "WeArtTrackingCalibration.h"
WeArtTrackingCalibration::WeArtTrackingCalibration()
: WeArtMessageListener({ CalibrationStatusMessage::ID, CalibrationResultMessage::ID }) {}
void WeArtTrackingCalibration::AddStatusCallback(std::function<void(HandSide, CalibrationStatus)> callback) {
statusCallbacks.push_back(callback);
}
void WeArtTrackingCalibration::AddResultCallback(std::function<void(HandSide, bool)> callback) {
resultCallbacks.push_back(callback);
}
void WeArtTrackingCalibration::OnMessageReceived(WeArtMessage* msg) {
if (msg->getID() == CalibrationStatusMessage::ID) {
CalibrationStatusMessage* message = static_cast<CalibrationStatusMessage*>(msg);
currentHand = message->getHand();
status = message->getStatus();
for (auto callback : statusCallbacks)
callback(currentHand, status);
} else if (msg->getID() == CalibrationResultMessage::ID) {
CalibrationResultMessage* message = static_cast<CalibrationResultMessage*>(msg);
currentHand = message->getHand();
result = message->getSuccess();
for (auto callback : resultCallbacks)
callback(currentHand, result);
}
}