mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-14 09:02:14 +00:00
remove more dead rev1 protocol code
This commit is contained in:
parent
dc7469c64b
commit
575a15e135
@ -41,39 +41,6 @@ class BluetoothPhoneAPI : public PhoneAPI
|
|||||||
|
|
||||||
BluetoothPhoneAPI *bluetoothPhoneAPI;
|
BluetoothPhoneAPI *bluetoothPhoneAPI;
|
||||||
|
|
||||||
class ProtobufCharacteristic : public CallbackCharacteristic
|
|
||||||
{
|
|
||||||
const pb_msgdesc_t *fields;
|
|
||||||
void *my_struct;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ProtobufCharacteristic(const char *uuid, uint32_t btprops, const pb_msgdesc_t *_fields, void *_my_struct)
|
|
||||||
: CallbackCharacteristic(uuid, btprops), fields(_fields), my_struct(_my_struct)
|
|
||||||
{
|
|
||||||
setCallbacks(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onRead(BLECharacteristic *c)
|
|
||||||
{
|
|
||||||
size_t numbytes = pb_encode_to_bytes(trBytes, sizeof(trBytes), fields, my_struct);
|
|
||||||
DEBUG_MSG("pbread from %s returns %d bytes\n", c->getUUID().toString().c_str(), numbytes);
|
|
||||||
c->setValue(trBytes, numbytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onWrite(BLECharacteristic *c) { writeToDest(c, my_struct); }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/// like onWrite, but we provide an different destination to write to, for use by subclasses that
|
|
||||||
/// want to optionally ignore parts of writes.
|
|
||||||
/// returns true for success
|
|
||||||
bool writeToDest(BLECharacteristic *c, void *dest)
|
|
||||||
{
|
|
||||||
// dumpCharacteristic(pCharacteristic);
|
|
||||||
std::string src = c->getValue();
|
|
||||||
DEBUG_MSG("pbwrite to %s of %d bytes\n", c->getUUID().toString().c_str(), src.length());
|
|
||||||
return pb_decode_from_bytes((const uint8_t *)src.c_str(), src.length(), fields, dest);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class ToRadioCharacteristic : public CallbackCharacteristic
|
class ToRadioCharacteristic : public CallbackCharacteristic
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user