Skip to content

Commit 62308e8

Browse files
add on advertising set start event
1 parent 421cf85 commit 62308e8

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

BLE_GAP/source/main.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
265265
/* Gap::EventHandler */
266266

267267
/** Look at scan payload to find a peer device and connect to it */
268-
virtual void onAdvertisingReport(const ble::AdvertisingReportEvent &event)
268+
void onAdvertisingReport(const ble::AdvertisingReportEvent &event) override
269269
{
270270
/* keep track of scan events for performance reporting */
271271
_scan_count++;
@@ -317,22 +317,27 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
317317
}
318318
}
319319

320-
virtual void onAdvertisingEnd(const ble::AdvertisingEndEvent &event)
320+
void onAdvertisingEnd(const ble::AdvertisingEndEvent &event) override
321321
{
322322
if (event.isConnected()) {
323323
printf("Stopped advertising early due to connection\r\n");
324324
}
325325
}
326326

327-
virtual void onScanTimeout(const ble::ScanTimeoutEvent&)
327+
void onAdvertisingStart(const ble::AdvertisingStartEvent &event) override
328+
{
329+
printf("Advertising set %d started\r\n", event.getAdvHandle());
330+
}
331+
332+
void onScanTimeout(const ble::ScanTimeoutEvent&) override
328333
{
329334
printf("Stopped scanning due to timeout parameter\r\n");
330335
_event_queue.call(this, &GapDemo::end_scanning_mode);
331336
}
332337

333338
/** This is called by Gap to notify the application we connected,
334339
* in our case it immediately disconnects */
335-
virtual void onConnectionComplete(const ble::ConnectionCompleteEvent &event)
340+
void onConnectionComplete(const ble::ConnectionCompleteEvent &event) override
336341
{
337342
_is_connecting = false;
338343
_demo_duration.stop();
@@ -370,7 +375,7 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
370375

371376
/** This is called by Gap to notify the application we disconnected,
372377
* in our case it calls next_demo_mode() to progress the demo */
373-
virtual void onDisconnectionComplete(const ble::DisconnectionCompleteEvent &event)
378+
void onDisconnectionComplete(const ble::DisconnectionCompleteEvent &event) override
374379
{
375380
printf("Disconnected\r\n");
376381

@@ -389,12 +394,12 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
389394
/**
390395
* Implementation of Gap::EventHandler::onReadPhy
391396
*/
392-
virtual void onReadPhy(
397+
void onReadPhy(
393398
ble_error_t error,
394399
ble::connection_handle_t connectionHandle,
395400
ble::phy_t txPhy,
396401
ble::phy_t rxPhy
397-
)
402+
) override
398403
{
399404
if (error) {
400405
printf(
@@ -412,12 +417,12 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
412417
/**
413418
* Implementation of Gap::EventHandler::onPhyUpdateComplete
414419
*/
415-
virtual void onPhyUpdateComplete(
420+
void onPhyUpdateComplete(
416421
ble_error_t error,
417422
ble::connection_handle_t connectionHandle,
418423
ble::phy_t txPhy,
419424
ble::phy_t rxPhy
420-
)
425+
) override
421426
{
422427
if (error) {
423428
printf(
@@ -435,11 +440,11 @@ class GapDemo : private mbed::NonCopyable<GapDemo>, public ble::Gap::EventHandle
435440
/**
436441
* Implementation of Gap::EventHandler::onDataLengthChange
437442
*/
438-
virtual void onDataLengthChange(
443+
void onDataLengthChange(
439444
ble::connection_handle_t connectionHandle,
440445
uint16_t txSize,
441446
uint16_t rxSize
442-
)
447+
) override
443448
{
444449
printf(
445450
"Data length changed on the connection %d.\r\n"

0 commit comments

Comments
 (0)