Ble: hide pin code if device is locked (#1008)

This commit is contained in:
あく 2022-02-24 15:38:06 +03:00 committed by GitHub
parent da6e31b2bf
commit 966b400f8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

6
firmware/targets/f6/ble_glue/gap.c Executable file → Normal file
View File

@ -186,7 +186,11 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
// Generate random PIN code
uint32_t pin = rand() % 999999;
aci_gap_pass_key_resp(gap->service.connection_handle, pin);
FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin);
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
FURI_LOG_I(TAG, "Pass key request event. Pin: ******");
} else {
FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin);
}
GapEvent event = {.type = GapEventTypePinCodeShow, .data.pin_code = pin};
gap->on_event_cb(event, gap->context);
} break;

6
firmware/targets/f7/ble_glue/gap.c Executable file → Normal file
View File

@ -186,7 +186,11 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
// Generate random PIN code
uint32_t pin = rand() % 999999;
aci_gap_pass_key_resp(gap->service.connection_handle, pin);
FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin);
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
FURI_LOG_I(TAG, "Pass key request event. Pin: ******");
} else {
FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin);
}
GapEvent event = {.type = GapEventTypePinCodeShow, .data.pin_code = pin};
gap->on_event_cb(event, gap->context);
} break;