Demonstration of the GAP profile. It shows advertising, scanning and connecting. The demo will cycle through several modes and print over the serial connection information about current activity.
GAP - Advertising, Scanning, Connecting
Demonstration of GAP API usage. It shows advertising, scanning and connecting. The demo will cycle through several modes and print over the serial connection information about current activity.
Running the application
Requirements
The sample application can be seen on any BLE scanner on a smartphone. If you don't have a scanner on your phone, please install :
- nRF Master Control Panel for Android.
- LightBlue for iPhone.
Information about activity is printed over the serial connection - please have a client open. You may use:
Hardware requirements are in the main readme.
Building instructions
Building instructions for all samples are in the main readme.
Diff: source/main.cpp
- Revision:
- 11:37872bf83624
- Parent:
- 10:6f1c573093c1
- Child:
- 16:4dd4ecbc8efb
--- a/source/main.cpp Wed Sep 26 15:00:23 2018 +0100 +++ b/source/main.cpp Wed Oct 17 14:45:12 2018 +0100 @@ -178,9 +178,9 @@ addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]); /* setup the default phy used in connection to 2M to reduce power consumption */ - Gap::Phys_t tx_phys = { /* 1M */ false, /* 2M */ true, /* coded */ false }; - Gap::Phys_t rx_phys = { /* 1M */ false, /* 2M */ true, /* coded */ false }; - ble_error_t err = _ble.gap().setPreferedPhys(&tx_phys, &rx_phys); + Gap::PhySet_t tx_phys(/* 1M */ false, /* 2M */ true, /* coded */ false); + Gap::PhySet_t rx_phys(/* 1M */ false, /* 2M */ true, /* coded */ false); + ble_error_t err = _ble.gap().setPreferredPhys(&tx_phys, &rx_phys); if (err) { printf("INFO: GAP::setPreferedPhys failed with error code %s", BLE::errorToString(err)); }