mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Bad BT paring pin handling improvements
This commit is contained in:
@@ -106,6 +106,7 @@ BadKbApp* bad_kb_app_alloc(char* arg) {
|
||||
|
||||
Bt* bt = furi_record_open(RECORD_BT);
|
||||
app->bt = bt;
|
||||
app->bt->suppress_pin_screen = true;
|
||||
app->is_bt = XTREME_SETTINGS()->bad_bt;
|
||||
app->bt_remember = XTREME_SETTINGS()->bad_bt_remember;
|
||||
const char* adv_name = furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard);
|
||||
@@ -210,6 +211,7 @@ void bad_kb_app_free(BadKbApp* app) {
|
||||
if(memcmp(app->bt_old_config.mac, app->mac, BAD_KB_MAC_ADDRESS_LEN) != 0) {
|
||||
furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, app->bt_old_config.mac);
|
||||
}
|
||||
app->bt->suppress_pin_screen = false;
|
||||
|
||||
// Close records
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
@@ -61,8 +61,11 @@ static ViewPort* bt_pin_code_view_port_alloc(Bt* bt) {
|
||||
}
|
||||
|
||||
static void bt_pin_code_show(Bt* bt, uint32_t pin_code) {
|
||||
furi_assert(bt);
|
||||
bt->pin_code = pin_code;
|
||||
notification_message(bt->notification, &sequence_display_backlight_on);
|
||||
if(bt->suppress_pin_screen) return;
|
||||
|
||||
gui_view_port_send_to_front(bt->gui, bt->pin_code_view_port);
|
||||
view_port_enabled_set(bt->pin_code_view_port, true);
|
||||
}
|
||||
@@ -76,10 +79,10 @@ static void bt_pin_code_hide(Bt* bt) {
|
||||
|
||||
static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) {
|
||||
furi_assert(bt);
|
||||
|
||||
if(bt_get_profile_pairing_method(bt) == GapPairingNone) return true;
|
||||
|
||||
bt->pin_code = pin;
|
||||
notification_message(bt->notification, &sequence_display_backlight_on);
|
||||
if(bt->suppress_pin_screen) return true;
|
||||
|
||||
FuriString* pin_str;
|
||||
dialog_message_set_icon(bt->dialog_message, XTREME_ASSETS()->I_BLE_Pairing_128x64, 0, 0);
|
||||
pin_str = furi_string_alloc_printf("Verify code\n%06lu", pin);
|
||||
|
||||
@@ -77,4 +77,5 @@ struct Bt {
|
||||
BtStatusChangedCallback status_changed_cb;
|
||||
void* status_changed_ctx;
|
||||
uint32_t pin;
|
||||
bool suppress_pin_screen;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user