mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2025-07-08 15:49:27 -04:00
BLE improvements
This commit is contained in:
parent
9d2da569c9
commit
16dedc72c2
3 changed files with 11 additions and 0 deletions
|
@ -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) {
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
|
||||
void begin(const char *name);
|
||||
void end();
|
||||
void startAdvertising();
|
||||
void stopAdvertising();
|
||||
void onWrite(BLECharacteristic *characteristic);
|
||||
int available();
|
||||
int peek();
|
||||
|
|
|
@ -266,6 +266,7 @@ char bt_devname[11];
|
|||
// Serial.println("Authentication fail");
|
||||
ble_authenticated = false;
|
||||
bt_state = BT_STATE_ON;
|
||||
bt_update_passkey();
|
||||
bt_security_setup();
|
||||
}
|
||||
bt_allow_pairing = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue