-
Notifications
You must be signed in to change notification settings - Fork 2
/
ftmsdevice.h
67 lines (53 loc) · 1.9 KB
/
ftmsdevice.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef FTMSDEVICE_H
#define FTMSDEVICE_H
#include <QObject>
#include <QLowEnergyAdvertisingData>
#include <QLowEnergyController>
#include <QLowEnergyService>
#include <QLowEnergyServiceData>
#include <QLowEnergyCharacteristicData>
#include <QLowEnergyDescriptorData>
#include <QLowEnergyAdvertisingParameters>
#include <QTimer>
class FTMSDevice : public QObject
{
Q_OBJECT
public:
explicit FTMSDevice(QObject *parent = nullptr);
public slots:
void setCurrentPower(qint16 power);
void setCurrentCadence(quint8 cadence);
void setCurrentHeartRate(quint8 heartRate);
void initialize();
void sendCurrentValues();
void restartAdvertising();
signals:
void newTargetPower(quint32 targetPower);
void newTargetKp(double kp);
private slots:
void onIncomingControlPointCommand(QLowEnergyCharacteristic c, QByteArray b);
private:
QLowEnergyService *m_ftmsService;
QLowEnergyDescriptorData m_ftmsClientConfig;
QLowEnergyServiceData m_ftmsServiceData;
QLowEnergyAdvertisingData m_advertisingData;
QLowEnergyCharacteristicData m_indoorBikeCharData;
QLowEnergyCharacteristicData m_powerRangeCharData;
QLowEnergyCharacteristicData m_resistanceRangeCharData;
QLowEnergyCharacteristicData m_ftmsFeatureCharData;
QLowEnergyCharacteristicData m_ftmsControlPointCharData;
QLowEnergyCharacteristicData m_ftmsStatusCharData;
QLowEnergyDescriptorData m_indoorBikeClientConfig;
QLowEnergyDescriptorData m_powerRangeClientConfig;
QLowEnergyDescriptorData m_resistanceRangeClientConfig;
QLowEnergyDescriptorData m_ftmsFeatureClientConfig;
QLowEnergyDescriptorData m_ftmsControlPointClientConfig;
QLowEnergyDescriptorData m_ftmsStatusClientConfig;
QLowEnergyController *m_controller;
quint8 m_currentHeartrate;
qint16 m_currentPower;
quint16 m_currentCadence;
quint16 m_currentSpeed;
QTimer m_updateTimer;
};
#endif // FTMSDEVICE_H