-
Notifications
You must be signed in to change notification settings - Fork 0
/
NxTrackerInterface.h
43 lines (32 loc) · 1.27 KB
/
NxTrackerInterface.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
//
// m1-orientationmanager
// Copyright © 2023 Mach1. All rights reserved.
//
#pragma once
#include <string>
#include <vector>
#include "m1_orientation_client/M1OrientationTypes.h"
#include "simpleble/SimpleBLE.h"
// Credit: [Raees Kattali](github.com/kattaliraees) for discovering the data command and characteristic UUIDs
// Credit: [Michael G. Wagner](youtube.com/michaelgwagner) for discovering the data translation and type conversion
#define NXTRACKER_GAP_ADVERTISE_SERVICE_UUID "A010"
#define NXTRACKER_ORIENTATION_DATA_GATT_SERVICE_UUID "0000a010-5761-7665-7341-7564696f4c74"
#define NXTRACKER_ORIENTATION_DATA_GATT_CHARATERISTIC_UUID "0000a015-5761-7665-7341-7564696f4c74"
#define NXTRACKER_START_WRITE_GATT_CHARACTERISTIC_UUID "0000a011-5761-7665-7341-7564696f4c74"
class NxTrackerInterface {
public:
NxTrackerInterface();
~NxTrackerInterface();
// ble
SimpleBLE::Safe::Peripheral* deviceInterface = nullptr;
bool set_peripheral_device(SimpleBLE::Peripheral&);
void sendStartCommand();
Mach1::Quaternion getRotationQuat();
void recenter();
int getBatteryLevel();
int battery_level;
void disconnect();
private:
Mach1::Quaternion currentOrientationQuat;
std::vector<float> parseQuatData(std::vector<uint8_t> data);
};