-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathftmsdevice.h
76 lines (61 loc) · 2.21 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
68
69
70
71
72
73
74
75
76
#ifndef FTMSDEVICE_H
#define FTMSDEVICE_H
#include <QObject>
#include <QLowEnergyAdvertisingData>
#include <QLowEnergyController>
#include <QLowEnergyService>
#include <QLowEnergyServiceData>
#include <QLowEnergyCharacteristicData>
#include <QLowEnergyDescriptorData>
#include <QLowEnergyAdvertisingParameters>
#include <QTimer>
#include "fecdevice.h"
class FTMSDevice : public QObject
{
Q_OBJECT
public:
explicit FTMSDevice(unsigned short int devId, QObject *parent = nullptr);
public slots:
void setCurrentPower(qint16 power);
void setCurrentCadence(quint8 cadence);
void setCurrentHeartRate(quint8 heartRate);
void setControllable(bool isControllable);
void initialize();
void sendCurrentValues();
void restartAdvertising();
signals:
void newTargetPower(quint32 targetPower);
void newTargetKp(double kp);
void newGrade(double grade);
void simulationModeChanged(FECDevice::FecMode mode);
private slots:
void onIncomingControlPointCommand(QLowEnergyCharacteristic c, QByteArray b);
void setSimulationMode(bool isSimulation);
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;
unsigned short m_devId;
bool m_isControllable;
bool m_isSimulation;
};
#endif // FTMSDEVICE_H