mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2025-06-07 14:22:51 -04:00
Incorporate changes from upstream 1.82
This commit is contained in:
commit
fd5520d95f
12 changed files with 251 additions and 128 deletions
|
@ -97,6 +97,17 @@ void BLESerial::flush() {
|
|||
}
|
||||
}
|
||||
|
||||
void BLESerial::disconnect() {
|
||||
if (ble_server->getConnectedCount() > 0) {
|
||||
uint16_t conn_id = ble_server->getConnId();
|
||||
// Serial.printf("Have connected: %d\n", conn_id);
|
||||
ble_server->disconnect(conn_id);
|
||||
// Serial.println("Disconnected");
|
||||
} else {
|
||||
// Serial.println("No connected");
|
||||
}
|
||||
}
|
||||
|
||||
void BLESerial::begin(const char *name) {
|
||||
ConnectedDeviceCount = 0;
|
||||
BLEDevice::init(name);
|
||||
|
@ -111,7 +122,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);
|
||||
|
@ -120,6 +134,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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue