forked from h2zero/esp-nimble-cpp
[Breaking] Change all time input parameters to milliseconds. (#78)
Changes all functions that accept a time parameter to use milliseconds instead of seconds. * Adds duration input to NimBLEDevice::startAdvertising and NimBLEServer::startAdvertising.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* updated by chegewara
|
||||
* updated for NimBLE by H2zero
|
||||
*/
|
||||
|
||||
|
||||
/** NimBLE differences highlighted in comment blocks **/
|
||||
|
||||
/*******original********
|
||||
@@ -38,7 +38,7 @@ static void notifyCallback(
|
||||
}
|
||||
|
||||
/** None of these are required as they will be handled by the library with defaults. **
|
||||
** Remove as you see fit for your needs */
|
||||
** Remove as you see fit for your needs */
|
||||
class MyClientCallback : public BLEClientCallbacks {
|
||||
void onConnect(BLEClient* pclient) {
|
||||
}
|
||||
@@ -120,9 +120,9 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
|
||||
/**
|
||||
* Called for each advertising BLE server.
|
||||
*/
|
||||
|
||||
|
||||
/*** Only a reference to the advertised device is passed now
|
||||
void onResult(BLEAdvertisedDevice advertisedDevice) { **/
|
||||
void onResult(BLEAdvertisedDevice advertisedDevice) { **/
|
||||
void onResult(BLEAdvertisedDevice* advertisedDevice) {
|
||||
printf("BLE Advertised Device found: %s\n", advertisedDevice->toString().c_str());
|
||||
|
||||
@@ -171,7 +171,7 @@ void connectTask (void * parameter){
|
||||
/*** Note: write value now returns true if successful, false otherwise - try again or disconnect ***/
|
||||
pRemoteCharacteristic->writeValue((uint8_t*)buf, strlen(buf), false);
|
||||
}else if(doScan){
|
||||
BLEDevice::getScan()->start(0); // this is just eample to start scan after disconnect, most likely there is better way to do it in arduino
|
||||
BLEDevice::getScan()->start(0); // this is just eample to start scan after disconnect, most likely there is better way to do it
|
||||
}
|
||||
|
||||
vTaskDelay(1000/portTICK_PERIOD_MS); // Delay a second between loops.
|
||||
@@ -195,6 +195,6 @@ void app_main(void) {
|
||||
pBLEScan->setActiveScan(true);
|
||||
|
||||
xTaskCreate(connectTask, "connectTask", 5000, NULL, 1, NULL);
|
||||
pBLEScan->start(5, false);
|
||||
pBLEScan->start(5 * 1000, false);
|
||||
} // End of setup.
|
||||
|
||||
|
Reference in New Issue
Block a user