TeensyNanoExoCode
Loading...
Searching...
No Matches
BleParser.h
Go to the documentation of this file.
1
10#ifndef BLEPARSER_H
11#define BLEPARSER_H
12// #if defined(ARDUINO_ARDUINO_NANO33BLE) | defined(ARDUINO_NANO_RP2040_CONNECT)
13#include "Arduino.h"
14#include "ble_commands.h"
15#include "BleMessage.h"
16#include "GattDb.h"
17#include <vector>
18
19
21{
22 public:
27 BleParser();
28
36 BleMessage* handle_raw_data(char* buffer, int length);
37
46 int package_raw_data(byte* buffer, BleMessage &msg);
47
48 private:
49 // Empty message
50 const BleMessage _empty_message = BleMessage();
51 // The current working message, used by handle_raw_data
52 BleMessage _working_message = BleMessage();
53 bool _waiting_for_data = false;
54 int _bytes_collected = 0;
55 byte _buffer[64];
56
62 void _handle_command(char command);
63};
64
65// #endif
66#endif
Defines the BleMessage class used to hold command-data pairs exchanged between the GUI.
This file declares the BLE commands, and the functions that should be called when they are received.
Definition BleMessage.h:16
Definition BleParser.h:21
int package_raw_data(byte *buffer, BleMessage &msg)
Packs data to be sent to the GUI, modifies the char array that you send it.
Definition BleParser.cpp:56
BleMessage * handle_raw_data(char *buffer, int length)
Given a buffer and buffer length, package the data into a BleMessage class.
Definition BleParser.cpp:15
BleParser()
Construct a new Ble Parser object.
Definition BleParser.cpp:10