-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBLECommunicator.h
51 lines (43 loc) · 1.59 KB
/
BLECommunicator.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
#ifndef BLE_COMMUNICATOR
#define BLE_COMMUNICATOR
#include <ArduinoBLE.h>
#include "Coordinates.h"
#include "Sensors.h"
#include "MultiMotorControl.h"
class BLECommunicator
{
public:
BLECommunicator(Sensors *sensors, MultiMotorControl *motors);
void setTemperature(int8_t temperature);
void setHumidity(int8_t humidity);
void setPressure(float pressure);
void setAccerelationDirection(Coordinates coords);
void setGyroscopeDirection(Coordinates coords);
void setMagnetometerDirection(Coordinates coords);
bool tryReadMotorSpeeds(uint8_t &motorPercent);
void listenForConnections();
private:
int _temperature = 0;
float _pressure = 0;
int _humidity = 0;
Coordinates _accCoords;
Coordinates _magCoords;
Coordinates _gyroCoords;
Sensors *_sensors;
MultiMotorControl *_motors;
BLEService *sensorsService;
BLEService *commandsService;
BLETypedCharacteristic<int8_t> *_temperatureCharacteristic;
BLETypedCharacteristic<int8_t> *_humidityCharacteristic;
BLETypedCharacteristic<float> *_pressureCharacteristic;
BLETypedCharacteristic<Coordinates> *_accCoordinatesCharacteristic;
BLETypedCharacteristic<Coordinates> *_magCoordinatesCharacteristic;
BLETypedCharacteristic<Coordinates> *_gyroCoordinatesCharacteristic;
BLECharacteristic *_motorSpeedCharacteristic;
void rampAllMotors(uint8_t throttle);
//void motorsThrottled(BLEDevice central, BLECharacteristic characteristic);
};
// template BLETypedCharacteristic<float>;
// template BLETypedCharacteristic<int>;
// template BLETypedCharacteristic<Coordinates>;
#endif