BLE improvements

This commit is contained in:
Mark Qvist 2025-04-13 02:23:01 +02:00
parent 9d2da569c9
commit 16dedc72c2
3 changed files with 11 additions and 0 deletions

View file

@ -110,7 +110,10 @@ void BLESerial::begin(const char *name) {
BLEDevice::setSecurityCallbacks(this);
SetupSerialService();
this->startAdvertising();
}
void BLESerial::startAdvertising() {
ble_adv = BLEDevice::getAdvertising();
ble_adv->addServiceUUID(BLE_SERIAL_SERVICE_UUID);
ble_adv->setMinPreferred(0x20);
@ -119,6 +122,11 @@ void BLESerial::begin(const char *name) {
ble_adv->start();
}
void BLESerial::stopAdvertising() {
ble_adv = BLEDevice::getAdvertising();
ble_adv->stop();
}
void BLESerial::end() { BLEDevice::deinit(); }
void BLESerial::onWrite(BLECharacteristic *characteristic) {