kopia lustrzana https://github.com/meshtastic/firmware
Esp32 NimBLE experiments (#1613)
* Delete callbacks on bleServer on destruct * Trying thingspull/1617/head
rodzic
1d1ccd6b19
commit
7d0411cd15
|
@ -1 +1 @@
|
||||||
Subproject commit addd11766c2e76d4f84e715aa7f0d4e061b925a8
|
Subproject commit c473ed7a6aa83c4be80382aa9abf8f8258be40a3
|
|
@ -257,10 +257,10 @@ typedef struct _Location {
|
||||||
uint32_t expire;
|
uint32_t expire;
|
||||||
/* If true, only allow the original sender to update the location. */
|
/* If true, only allow the original sender to update the location. */
|
||||||
bool locked;
|
bool locked;
|
||||||
/* Name of the location - max 40 chars */
|
/* Name of the location - max 30 chars */
|
||||||
char name[30];
|
char name[30];
|
||||||
/* *
|
/* *
|
||||||
Description of the location - max 160 chars */
|
Description of the location - max 100 chars */
|
||||||
char description[100];
|
char description[100];
|
||||||
} Location;
|
} Location;
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,11 @@ class ESP32BluetoothServerCallback : public NimBLEServerCallbacks {
|
||||||
screen->stopBluetoothPinScreen();
|
screen->stopBluetoothPinScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc *desc) {
|
||||||
|
DEBUG_MSG("BLE disconnect\n");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static ESP32BluetoothToRadioCallback *toRadioCallbacks;
|
static ESP32BluetoothToRadioCallback *toRadioCallbacks;
|
||||||
static ESP32BluetoothFromRadioCallback *fromRadioCallbacks;
|
static ESP32BluetoothFromRadioCallback *fromRadioCallbacks;
|
||||||
|
|
||||||
|
@ -120,6 +122,9 @@ void ESP32Bluetooth::shutdown()
|
||||||
// Shutdown bluetooth for minimum power draw
|
// Shutdown bluetooth for minimum power draw
|
||||||
DEBUG_MSG("Disable bluetooth\n");
|
DEBUG_MSG("Disable bluetooth\n");
|
||||||
//Bluefruit.Advertising.stop();
|
//Bluefruit.Advertising.stop();
|
||||||
|
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
||||||
|
pAdvertising->reset();
|
||||||
|
pAdvertising->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP32Bluetooth::setup()
|
void ESP32Bluetooth::setup()
|
||||||
|
@ -175,7 +180,7 @@ void ESP32Bluetooth::setup()
|
||||||
bleServer = NimBLEDevice::createServer();
|
bleServer = NimBLEDevice::createServer();
|
||||||
|
|
||||||
ESP32BluetoothServerCallback *serverCallbacks = new ESP32BluetoothServerCallback();
|
ESP32BluetoothServerCallback *serverCallbacks = new ESP32BluetoothServerCallback();
|
||||||
bleServer->setCallbacks(serverCallbacks);
|
bleServer->setCallbacks(serverCallbacks, true);
|
||||||
|
|
||||||
NimBLEService *bleService = bleServer->createService(MESH_SERVICE_UUID);
|
NimBLEService *bleService = bleServer->createService(MESH_SERVICE_UUID);
|
||||||
//NimBLECharacteristic *pNonSecureCharacteristic = bleService->createCharacteristic("1234", NIMBLE_PROPERTY::READ );
|
//NimBLECharacteristic *pNonSecureCharacteristic = bleService->createCharacteristic("1234", NIMBLE_PROPERTY::READ );
|
||||||
|
@ -208,9 +213,9 @@ void ESP32Bluetooth::setup()
|
||||||
//ToRadioCharacteristic->setCallbacks()
|
//ToRadioCharacteristic->setCallbacks()
|
||||||
|
|
||||||
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
||||||
|
pAdvertising->reset();
|
||||||
pAdvertising->addServiceUUID(MESH_SERVICE_UUID);
|
pAdvertising->addServiceUUID(MESH_SERVICE_UUID);
|
||||||
pAdvertising->start();
|
pAdvertising->start(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,7 +233,7 @@ void ESP32Bluetooth::clearBonds()
|
||||||
|
|
||||||
//Bluefruit.Periph.clearBonds();
|
//Bluefruit.Periph.clearBonds();
|
||||||
//Bluefruit.Central.clearBonds();
|
//Bluefruit.Central.clearBonds();
|
||||||
|
NimBLEDevice::deleteAllBonds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearNVS() {
|
void clearNVS() {
|
||||||
|
|
Ładowanie…
Reference in New Issue