forked from WEARTHaptics/WEART-SDK-Cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WeArtTrackingRawData.h
48 lines (38 loc) · 1.38 KB
/
WeArtTrackingRawData.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* WEART - Raw Sensor Data thimble TD
* https://www.weart.it/
*/
#pragma once
#include "WeArtCommon.h"
#include "WeArtMessageListener.h"
#include "WeArtMessages.h"
#include <queue>
//! @brief Object used to track the raw sensors data for a single thimble
class WeArtTrackingRawData : public WeArtMessageListener {
public:
//! @brief Create a WeArtTrackingRawData tracking object
//! @param handSide Hand side from which to take the sensor data
//! @param actuationPoint Thimble from which to take the sensor data
WeArtTrackingRawData(HandSide handSide, ActuationPoint actuationPoint);
//! @brief Sensor data sample
struct Sample {
//! @brief Timestamp when the sample was created (in milliseconds unix epoch time)
std::uint64_t timestamp;
//! @brief Sampled sensor data
SensorData data;
};
//! @brief Get the last sample received
//! @return the last sample received
Sample GetLastSample();
//! @brief Adds a callback called whenever a new sample is received
//! @param callback Callback called when a sample is received
void AddSampleCallback(std::function<void(Sample)> callback);
//! @copydoc WeArtMessageListener::OnMessageReceived
void OnMessageReceived(WeArtMessage* msg) override;
private:
HandSide handSide;
ActuationPoint actuationPoint;
const unsigned int K_NUM_SAMPLES = 3;
std::queue<Sample> samples;
std::vector<std::function<void(Sample)>> callbacks;
};