Skip to content

Commit e3db394

Browse files
committed
Add BTSerialInterface (BluetoothSerial) register_callback and memrelease
1 parent 05bee20 commit e3db394

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

Firmware/RTK_Everywhere/bluetoothSelect.h

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class BTSerialInterface : public virtual Stream
1717

1818
virtual void disconnect() = 0;
1919
virtual void end() = 0;
20-
// virtual esp_err_t register_callback(esp_spp_cb_t callback) = 0;
20+
virtual esp_err_t register_callback(void * callback) = 0;
2121
virtual void setTimeout(unsigned long timeout) = 0;
2222

2323
virtual int available() = 0;
@@ -43,6 +43,7 @@ class BTSerialInterface : public virtual Stream
4343
virtual void respondPasskey(uint32_t passkey) = 0;
4444

4545
virtual void deleteAllBondedDevices() = 0;
46+
virtual void memrelease() = 0;
4647
};
4748

4849
class BTClassicSerial : public virtual BTSerialInterface, public BluetoothSerial
@@ -66,10 +67,10 @@ class BTClassicSerial : public virtual BTSerialInterface, public BluetoothSerial
6667
BluetoothSerial::end();
6768
}
6869

69-
// esp_err_t register_callback(esp_spp_cb_t callback)
70-
// {
71-
// return BluetoothSerial::register_callback(callback);
72-
// }
70+
esp_err_t register_callback(void * callback)
71+
{
72+
return BluetoothSerial::register_callback((esp_spp_cb_t)callback);
73+
}
7374

7475
void setTimeout(unsigned long timeout)
7576
{
@@ -162,6 +163,11 @@ class BTClassicSerial : public virtual BTSerialInterface, public BluetoothSerial
162163
{
163164
BluetoothSerial::deleteAllBondedDevices();
164165
}
166+
167+
void memrelease()
168+
{
169+
BluetoothSerial::memrelease();
170+
}
165171
};
166172

167173
class BTLESerial : public virtual BTSerialInterface, public BleSerial
@@ -186,11 +192,10 @@ class BTLESerial : public virtual BTSerialInterface, public BleSerial
186192
BleSerial::end();
187193
}
188194

189-
// esp_err_t register_callback(esp_spp_cb_t callback)
190-
// {
191-
// connectionCallback = callback;
192-
// return ESP_OK;
193-
// }
195+
esp_err_t register_callback(void * callback)
196+
{
197+
return ESP_OK;
198+
}
194199

195200
void setTimeout(unsigned long timeout)
196201
{
@@ -268,6 +273,8 @@ class BTLESerial : public virtual BTSerialInterface, public BleSerial
268273

269274
void deleteAllBondedDevices() {}
270275

276+
void memrelease() {}
277+
271278
// Callbacks removed in v2 of BleSerial. Using polled connected() in bluetoothUpdate()
272279
// override BLEServerCallbacks
273280
// void Server->onConnect(BLEServer *pServer)

0 commit comments

Comments
 (0)