mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 14:42:05 +00:00
wip - finally done switching to dynamic allocs
This commit is contained in:
parent
bf640bec3c
commit
5f88174dbf
@ -123,6 +123,7 @@ BLEService *createUpdateService(BLEServer *server)
|
|||||||
// Create the BLE Service
|
// Create the BLE Service
|
||||||
BLEService *service = server->createService("cb0b9a0b-a84c-4c0d-bdbb-442e3144ee30");
|
BLEService *service = server->createService("cb0b9a0b-a84c-4c0d-bdbb-442e3144ee30");
|
||||||
|
|
||||||
|
assert(!resultC);
|
||||||
resultC = new (btPool) BLECharacteristic("5e134862-7411-4424-ac4a-210937432c77", BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_NOTIFY);
|
resultC = new (btPool) BLECharacteristic("5e134862-7411-4424-ac4a-210937432c77", BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_NOTIFY);
|
||||||
|
|
||||||
addWithDesc(service, new (btPool) TotalSizeCharacteristic, "total image size");
|
addWithDesc(service, new (btPool) TotalSizeCharacteristic, "total image size");
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
// This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in proccess at once
|
// This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in proccess at once
|
||||||
static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)];
|
static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)];
|
||||||
|
|
||||||
|
|
||||||
class ProtobufCharacteristic : public CallbackCharacteristic
|
class ProtobufCharacteristic : public CallbackCharacteristic
|
||||||
{
|
{
|
||||||
const pb_msgdesc_t *fields;
|
const pb_msgdesc_t *fields;
|
||||||
@ -222,25 +221,19 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static FromNumCharacteristic meshFromNumCharacteristic;
|
FromNumCharacteristic *meshFromNumCharacteristic;
|
||||||
|
|
||||||
static FromRadioCharacteristic meshFromRadioCharacteristic;
|
|
||||||
static ToRadioCharacteristic meshToRadioCharacteristic;
|
|
||||||
static NodeInfoCharacteristic meshNodeInfoCharacteristic;
|
|
||||||
|
|
||||||
static ProtobufCharacteristic
|
|
||||||
meshMyNodeCharacteristic("ea9f3f82-8dc4-4733-9452-1f6da28892a2", BLECharacteristic::PROPERTY_READ, MyNodeInfo_fields, &myNodeInfo);
|
|
||||||
|
|
||||||
static OwnerCharacteristic meshOwnerCharacteristic;
|
|
||||||
static RadioCharacteristic meshRadioCharacteristic;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell any bluetooth clients that the number of rx packets has changed
|
* Tell any bluetooth clients that the number of rx packets has changed
|
||||||
*/
|
*/
|
||||||
void bluetoothNotifyFromNum(uint32_t newValue)
|
void bluetoothNotifyFromNum(uint32_t newValue)
|
||||||
{
|
{
|
||||||
meshFromNumCharacteristic.setValue(newValue);
|
if (meshFromNumCharacteristic)
|
||||||
meshFromNumCharacteristic.notify();
|
{
|
||||||
|
// if bt not running ignore
|
||||||
|
meshFromNumCharacteristic->setValue(newValue);
|
||||||
|
meshFromNumCharacteristic->notify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -304,16 +297,19 @@ BLEService *createMeshBluetoothService(BLEServer *server)
|
|||||||
// Create the BLE Service, we need more than the default of 15 handles
|
// Create the BLE Service, we need more than the default of 15 handles
|
||||||
BLEService *service = server->createService(BLEUUID("6ba1b218-15a8-461f-9fa8-5dcae273eafd"), 25, 0);
|
BLEService *service = server->createService(BLEUUID("6ba1b218-15a8-461f-9fa8-5dcae273eafd"), 25, 0);
|
||||||
|
|
||||||
addWithDesc(service, &meshFromRadioCharacteristic, "fromRadio");
|
assert(!meshFromNumCharacteristic);
|
||||||
addWithDesc(service, &meshToRadioCharacteristic, "toRadio");
|
meshFromNumCharacteristic = new (btPool) FromNumCharacteristic;
|
||||||
addWithDesc(service, &meshFromNumCharacteristic, "fromNum");
|
|
||||||
|
|
||||||
addWithDesc(service, &meshMyNodeCharacteristic, "myNode");
|
addWithDesc(service, meshFromNumCharacteristic, "fromRadio");
|
||||||
addWithDesc(service, &meshRadioCharacteristic, "radio");
|
addWithDesc(service, new (btPool) ToRadioCharacteristic, "toRadio");
|
||||||
addWithDesc(service, &meshOwnerCharacteristic, "owner");
|
addWithDesc(service, new (btPool) FromRadioCharacteristic, "fromNum");
|
||||||
addWithDesc(service, &meshNodeInfoCharacteristic, "nodeinfo");
|
|
||||||
|
|
||||||
meshFromNumCharacteristic.addDescriptor(new (btPool) BLE2902()); // Needed so clients can request notification
|
addWithDesc(service, new (btPool) ProtobufCharacteristic("ea9f3f82-8dc4-4733-9452-1f6da28892a2", BLECharacteristic::PROPERTY_READ, MyNodeInfo_fields, &myNodeInfo), "myNode");
|
||||||
|
addWithDesc(service, new (btPool) RadioCharacteristic, "radio");
|
||||||
|
addWithDesc(service, new (btPool) OwnerCharacteristic, "owner");
|
||||||
|
addWithDesc(service, new (btPool) NodeInfoCharacteristic, "nodeinfo");
|
||||||
|
|
||||||
|
meshFromNumCharacteristic->addDescriptor(new (btPool) BLE2902()); // Needed so clients can request notification
|
||||||
|
|
||||||
service->start();
|
service->start();
|
||||||
server->getAdvertising()->addServiceUUID(service->getUUID());
|
server->getAdvertising()->addServiceUUID(service->getUUID());
|
||||||
|
Loading…
Reference in New Issue
Block a user