File tree 2 files changed +5
-5
lines changed
libraries/n-able/examples
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ void setup() {
30
30
void loop () {
31
31
if (!pAdvertising->isAdvertising ()) {
32
32
// Update the advertised data
33
- pAdvertising->setServiceData (dataUuid, std::string (( char *) &count, sizeof (count) ));
33
+ pAdvertising->setServiceData (dataUuid, static_cast < uint8_t *>( &count) , sizeof (count));
34
34
35
35
// Start advertising the data
36
36
pAdvertising->start (5 );
Original file line number Diff line number Diff line change @@ -15,11 +15,11 @@ NimBLEScan* pBLEScan;
15
15
uint32_t scanTime = 30 ; // Scan duration in seconds (0 = forever)
16
16
17
17
// Callback class for received advertisements
18
- class MyAdvertisedDeviceCallbacks : public NimBLEAdvertisedDeviceCallbacks {
19
- void onResult (NimBLEAdvertisedDevice* advertisedDevice) {
18
+ class ScanCallbacks : public NimBLEScanCallbacks {
19
+ void onResult (const NimBLEAdvertisedDevice* advertisedDevice) {
20
20
Serial.printf (" Advertised Device: %s \n " , advertisedDevice->toString ().c_str ());
21
21
}
22
- };
22
+ } scanCallbacks ;
23
23
24
24
void setup () {
25
25
Serial.begin (115200 );
@@ -32,7 +32,7 @@ void setup() {
32
32
pBLEScan = NimBLEDevice::getScan ();
33
33
34
34
// Set the callback for when devices are discovered, no duplicates.
35
- pBLEScan->setAdvertisedDeviceCallbacks ( new MyAdvertisedDeviceCallbacks () , false );
35
+ pBLEScan->setScanCallbacks (&scanCallbacks , false );
36
36
37
37
// Set active scanning, this will get scan response data from the advertiser.
38
38
pBLEScan->setActiveScan (true );
You can’t perform that action at this time.
0 commit comments