Optional secure pairing with a passkey
Support passkey pairing when requested by the central Fix a comment and reorder warning
This commit is contained in:
parent
6a5946c4e3
commit
eca0588c23
|
@ -17,7 +17,7 @@ BatteryInformationService::BatteryInformationService(Controllers::Battery& batte
|
||||||
characteristicDefinition {{.uuid = &batteryLevelUuid.u,
|
characteristicDefinition {{.uuid = &batteryLevelUuid.u,
|
||||||
.access_cb = BatteryInformationServiceCallback,
|
.access_cb = BatteryInformationServiceCallback,
|
||||||
.arg = this,
|
.arg = this,
|
||||||
.flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_READ_ENC | BLE_GATT_CHR_F_READ_AUTHEN | BLE_GATT_CHR_F_NOTIFY,
|
.flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY,
|
||||||
.val_handle = &batteryLevelHandle},
|
.val_handle = &batteryLevelHandle},
|
||||||
{0}},
|
{0}},
|
||||||
serviceDefinition {
|
serviceDefinition {
|
||||||
|
|
|
@ -134,10 +134,8 @@ void NimbleController::Init() {
|
||||||
|
|
||||||
RestoreBond();
|
RestoreBond();
|
||||||
|
|
||||||
if (!ble_gap_adv_active() && !bleController.IsConnected()) {
|
|
||||||
StartAdvertising();
|
StartAdvertising();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void NimbleController::StartAdvertising() {
|
void NimbleController::StartAdvertising() {
|
||||||
struct ble_gap_adv_params adv_params;
|
struct ble_gap_adv_params adv_params;
|
||||||
|
@ -274,7 +272,7 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
|
||||||
* display capability only so we only handle the "display" action here.
|
* display capability only so we only handle the "display" action here.
|
||||||
*
|
*
|
||||||
* Standards insist that the rand() PRNG be deterministic.
|
* Standards insist that the rand() PRNG be deterministic.
|
||||||
* Use the nimble TRNG here since rand() is predictable.
|
* Use the tinycrypt prng here since rand() is predictable.
|
||||||
*/
|
*/
|
||||||
NRF_LOG_INFO("Security event : BLE_GAP_EVENT_PASSKEY_ACTION");
|
NRF_LOG_INFO("Security event : BLE_GAP_EVENT_PASSKEY_ACTION");
|
||||||
if (event->passkey.params.action == BLE_SM_IOACT_DISP) {
|
if (event->passkey.params.action == BLE_SM_IOACT_DISP) {
|
||||||
|
|
|
@ -110,8 +110,8 @@ namespace Pinetime {
|
||||||
ImmediateAlertService immediateAlertService;
|
ImmediateAlertService immediateAlertService;
|
||||||
HeartRateService heartRateService;
|
HeartRateService heartRateService;
|
||||||
MotionService motionService;
|
MotionService motionService;
|
||||||
ServiceDiscovery serviceDiscovery;
|
|
||||||
FSService fsService;
|
FSService fsService;
|
||||||
|
ServiceDiscovery serviceDiscovery;
|
||||||
|
|
||||||
uint8_t addrType;
|
uint8_t addrType;
|
||||||
uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE;
|
uint16_t connectionHandle = BLE_HS_CONN_HANDLE_NONE;
|
||||||
|
|
Loading…
Reference in a new issue