[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:
h2zero
2022-08-26 19:32:01 -06:00
committed by GitHub
parent 0b6337538c
commit bb3dd5f114
14 changed files with 36 additions and 35 deletions
+6
View File
@@ -17,6 +17,7 @@ For more information on the improvements and additions please refer to the [clas
* [Remote Services](#remote-services)
* [Remote characteristics](#remote-characteristics)
* [Security](#client-security)
* [Scanning](#scan-api)
* [General Security](#security-api)
* [Configuration](#arduino-configuration)
<br/>
@@ -321,6 +322,11 @@ The client will automatically initiate security when the peripheral responds tha
The default configuration will use "just-works" pairing with no bonding, if you wish to enable bonding see below.
<br/>
<a name="scan-api"></a>
### BLE Scan
The scan API is mostly unchanged from the original except for `NimBLEScan::start`, in which the duration parameter is now in milliseconds instead of seconds.
<br/>
<a name="security-api"></a>
## Security API
Security operations have been moved to `BLEDevice` (`NimBLEDevice`).
+3 -3
View File
@@ -146,7 +146,7 @@ After initializing the NimBLE stack we create a scan instance by calling `NimBLE
Once we have created the scan we can start looking for advertising servers.
To do this we call `NimBLEScan::start(duration)`, the duration parameter is a uint32_t that specifies the number of seconds to scan for,
To do this we call `NimBLEScan::start(duration)`, the duration parameter is a uint32_t that specifies the number of milliseconds to scan for,
passing 0 will scan forever.
In this example we will scan for 10 seconds. This is a blocking function (a non blocking overload is also available).
@@ -162,7 +162,7 @@ void app_main(void)
NimBLEDevice::init("");
NimBLEScan *pScan = NimBLEDevice::getScan();
NimBLEScanResults results = pScan->start(10);
NimBLEScanResults results = pScan->start(10 * 1000);
}
```
<br/>
@@ -302,7 +302,7 @@ void app_main(void)
NimBLEDevice::init("");
NimBLEScan *pScan = NimBLEDevice::getScan();
NimBLEScanResults results = pScan->start(10);
NimBLEScanResults results = pScan->start(10 * 1000);
NimBLEUUID serviceUuid("ABCD");