TeensyNanoExoCode
Loading...
Searching...
No Matches
ExoBLE.h
Go to the documentation of this file.
1
11#ifndef EXOBLE_H
12#define EXOBLE_H
13#if defined(ARDUINO_ARDUINO_NANO33BLE) | defined(ARDUINO_NANO_RP2040_CONNECT)
14
15//#define EXOBLE_DEBUG
16#define MAX_PARSER_CHARACTERS 8
17#define NAME_PREAMBLE "EXOBLE_"
18#define MAC_ADDRESS_TOTAL_LENGTH 17
19#define MAC_ADDRESS_NAME_LENGTH 6
20
21
22
23#include <Arduino.h>
24#include <ArduinoBLE.h>
25
26#include "BleParser.h"
27#include "GattDb.h"
28#include "BleMessage.h"
29#include "BleMessageQueue.h"
30
31class ExoBLE
32{
33 public:
39 ExoBLE();
46 bool setup();
47
53 void advertising_onoff(bool onoff);
54
61 bool handle_updates();
62
68 void send_message(BleMessage &msg);
69
75 void send_error(int error_code, int joint_id);
76
77 private:
78
79 // BLE connection state
80 int _connected = 0;
81
82 // The Gatt database which defines the services and characteristics
83 GattDb _gatt_db = GattDb();
84
85 // The parser used to serialize and deserialize the BLE data
86 BleParser _ble_parser = BleParser();
87};
88
93namespace ble_rx
94{
95 void on_rx_recieved(BLEDevice central, BLECharacteristic characteristic);
96}
97
102namespace connection_callbacks
103{
104 static bool is_connected = false;
105}
106
107#endif // defined(ARDUINO_ARDUINO_NANO33BLE) | defined(ARDUINO_NANO_RP2040_CONNECT)
108
109
110#endif
Defines the BleMessage class used to hold command-data pairs exchanged between the GUI.
Defines a FIFO queue for the BLEMessage type. The maximum size is specified in the cpp.
This class is used to serialize and deserialize the BLE data. The application uses Nordic's UART serv...
Definition BleMessage.h:16
Definition BleParser.h:21