mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Send BLE notifications as text
This commit is contained in:
parent
f3443ab8f8
commit
8e493f4e99
1 changed files with 7 additions and 0 deletions
|
|
@ -68,6 +68,13 @@ public:
|
||||||
BLEService* service = _server->createService(NUS_SERVICE_UUID);
|
BLEService* service = _server->createService(NUS_SERVICE_UUID);
|
||||||
_tx_char = service->createCharacteristic(NUS_TX_UUID, BLECharacteristic::PROPERTY_NOTIFY);
|
_tx_char = service->createCharacteristic(NUS_TX_UUID, BLECharacteristic::PROPERTY_NOTIFY);
|
||||||
_tx_char->addDescriptor(new BLE2902());
|
_tx_char->addDescriptor(new BLE2902());
|
||||||
|
|
||||||
|
// Characteristic Presentation Format (0x2904): declare value as UTF-8 string
|
||||||
|
// Format: format(1) exponent(1) unit(2) namespace(1) description(2)
|
||||||
|
static const uint8_t utf8_format[] = { 0x19, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00 };
|
||||||
|
BLEDescriptor* pFormat = new BLEDescriptor((uint16_t)0x2904);
|
||||||
|
pFormat->setValue(const_cast<uint8_t*>(utf8_format), sizeof(utf8_format));
|
||||||
|
_tx_char->addDescriptor(pFormat);
|
||||||
service->start();
|
service->start();
|
||||||
|
|
||||||
BLEAdvertising* adv = BLEDevice::getAdvertising();
|
BLEAdvertising* adv = BLEDevice::getAdvertising();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue