mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 20:08:36 -07:00
Better bt pin code detection
This commit is contained in:
@@ -76,7 +76,6 @@ static void bt_pin_code_hide(Bt* bt) {
|
|||||||
|
|
||||||
static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) {
|
static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) {
|
||||||
furi_assert(bt);
|
furi_assert(bt);
|
||||||
bt->pin = pin;
|
|
||||||
|
|
||||||
if(bt_get_profile_pairing_method(bt) == GapPairingNone) return true;
|
if(bt_get_profile_pairing_method(bt) == GapPairingNone) return true;
|
||||||
|
|
||||||
@@ -279,12 +278,14 @@ static bool bt_on_gap_event_callback(GapEvent event, void* context) {
|
|||||||
furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk);
|
furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk);
|
||||||
ret = true;
|
ret = true;
|
||||||
} else if(event.type == GapEventTypePinCodeShow) {
|
} else if(event.type == GapEventTypePinCodeShow) {
|
||||||
|
bt->pin = event.data.pin_code;
|
||||||
BtMessage message = {
|
BtMessage message = {
|
||||||
.type = BtMessageTypePinCodeShow, .data.pin_code = event.data.pin_code};
|
.type = BtMessageTypePinCodeShow, .data.pin_code = event.data.pin_code};
|
||||||
furi_check(
|
furi_check(
|
||||||
furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk);
|
furi_message_queue_put(bt->message_queue, &message, FuriWaitForever) == FuriStatusOk);
|
||||||
ret = true;
|
ret = true;
|
||||||
} else if(event.type == GapEventTypePinCodeVerify) {
|
} else if(event.type == GapEventTypePinCodeVerify) {
|
||||||
|
bt->pin = event.data.pin_code;
|
||||||
ret = bt_pin_code_verify_event_handler(bt, event.data.pin_code);
|
ret = bt_pin_code_verify_event_handler(bt, event.data.pin_code);
|
||||||
} else if(event.type == GapEventTypeUpdateMTU) {
|
} else if(event.type == GapEventTypeUpdateMTU) {
|
||||||
bt->max_packet_size = event.data.max_packet_size;
|
bt->max_packet_size = event.data.max_packet_size;
|
||||||
|
|||||||
Reference in New Issue
Block a user