-
Notifications
You must be signed in to change notification settings - Fork 3
/
WeArtAnalogSensorData.h
47 lines (37 loc) · 1.28 KB
/
WeArtAnalogSensorData.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
/**
* WEART - Raw Analog Sensor Data thimble TD
* https://www.weart.it/
*/
#pragma once
#include "WeArtCommon.h"
#include "WeArtMessageListener.h"
#include "WeArtMessages.h"
#include <queue>
class WeArtAnalogSensorData : public WeArtMessageListener
{
public:
//! @brief Create a WeArtAnalogSensorData tracking object
//! @param handSide Hand side from which to take the sensor data
//! @param actuationPoint Thimble from which to take the sensor data
WeArtAnalogSensorData(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
AnalogSensorRawData 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;
Sample lastSample;
std::vector<std::function<void(Sample)>> callbacks;
};