Refactored to have a pure virtual bas class and added telnet capability
This commit is contained in:
@@ -2,18 +2,19 @@
|
||||
#include "SerialMessage.h"
|
||||
#include <BluetoothSerial.h>
|
||||
|
||||
template <uint16_t byteSize>
|
||||
class BluetoothSerialMessage : public SerialMessage<byteSize>{
|
||||
template <uint32_t SERIAL_BUFFER_SIZE, uint32_t MAX_ARGS>
|
||||
class BluetoothSerialMessage : public SerialMessage<SERIAL_BUFFER_SIZE, MAX_ARGS>{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Bluetooth Serial Message object
|
||||
*/
|
||||
BluetoothSerialMessage(BluetoothSerial *serial);
|
||||
|
||||
|
||||
void Init(uint32_t baudRate) override{this->Init();}
|
||||
/**
|
||||
* @brief Initialize the BluetoothSerialMessage object
|
||||
*/
|
||||
void Init(uint32_t baudRate = 115200) override;
|
||||
void Init();
|
||||
|
||||
/**
|
||||
* @brief prints the args array to the serial monitor
|
||||
@@ -28,32 +29,30 @@ class BluetoothSerialMessage : public SerialMessage<byteSize>{
|
||||
uint32_t dataAvailable() override;
|
||||
|
||||
BluetoothSerial *serial;
|
||||
|
||||
|
||||
};
|
||||
|
||||
template <uint16_t byteSize>
|
||||
char BluetoothSerialMessage<byteSize>::getChar(){
|
||||
template <uint32_t SERIAL_BUFFER_SIZE, uint32_t MAX_ARGS>
|
||||
char BluetoothSerialMessage<SERIAL_BUFFER_SIZE, MAX_ARGS>::getChar(){
|
||||
return serial->read();
|
||||
}
|
||||
|
||||
template <uint16_t byteSize>
|
||||
uint32_t BluetoothSerialMessage<byteSize>::dataAvailable(){
|
||||
template <uint32_t SERIAL_BUFFER_SIZE, uint32_t MAX_ARGS>
|
||||
uint32_t BluetoothSerialMessage<SERIAL_BUFFER_SIZE, MAX_ARGS>::dataAvailable(){
|
||||
return serial->available();
|
||||
}
|
||||
|
||||
template <uint16_t byteSize>
|
||||
BluetoothSerialMessage<byteSize>::BluetoothSerialMessage(BluetoothSerial *serial){
|
||||
template <uint32_t SERIAL_BUFFER_SIZE, uint32_t MAX_ARGS>
|
||||
BluetoothSerialMessage<SERIAL_BUFFER_SIZE, MAX_ARGS>::BluetoothSerialMessage(BluetoothSerial *serial){
|
||||
this->serial = serial;
|
||||
}
|
||||
|
||||
template <uint16_t byteSize>
|
||||
void BluetoothSerialMessage<byteSize>::Init(uint32_t baudRate){
|
||||
template <uint32_t SERIAL_BUFFER_SIZE, uint32_t MAX_ARGS>
|
||||
void BluetoothSerialMessage<SERIAL_BUFFER_SIZE, MAX_ARGS>::Init(){
|
||||
serial->begin("MiniBot");
|
||||
}
|
||||
|
||||
template <uint16_t byteSize>
|
||||
void BluetoothSerialMessage<byteSize>::PrintArgs(){
|
||||
template <uint32_t SERIAL_BUFFER_SIZE, uint32_t MAX_ARGS>
|
||||
void BluetoothSerialMessage<SERIAL_BUFFER_SIZE, MAX_ARGS>::PrintArgs(){
|
||||
serial->print("Current number of args: ");
|
||||
serial->println(this->populatedArgs);
|
||||
for (int i = 0; i < this->populatedArgs; i++) {
|
||||
|
||||
Reference in New Issue
Block a user