Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE/GAP fixes #3533

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
hal: fixed excessively strict event handler re-init checks
hedger committed Mar 21, 2024

Verified

This commit was signed with the committer’s verified signature.
djhi Gildas Garcia
commit e5c42918b84cae1eb4b3fcef5378aa6cf5327084
2 changes: 1 addition & 1 deletion targets/f7/ble_glue/ble_event_thread.c
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ void ble_event_thread_stop(void) {
}

FuriThreadId thread_id = furi_thread_get_id(event_thread);
furi_assert(thread_id);
furi_check(thread_id);
furi_thread_flags_set(thread_id, BLE_EVENT_THREAD_FLAG_KILL_THREAD);
furi_thread_join(event_thread);
furi_thread_free(event_thread);
4 changes: 2 additions & 2 deletions targets/f7/ble_glue/ble_glue.c
Original file line number Diff line number Diff line change
@@ -224,7 +224,7 @@ bool ble_glue_wait_for_c2_start(int32_t timeout_ms) {
}

bool ble_glue_start(void) {
furi_assert(ble_glue);
furi_check(ble_glue);

if(ble_glue->status != BleGlueStatusC2Started) {
return false;
@@ -243,7 +243,7 @@ bool ble_glue_start(void) {
}

void ble_glue_stop(void) {
furi_assert(ble_glue);
furi_check(ble_glue);

ble_event_thread_stop();
// Free resources
10 changes: 5 additions & 5 deletions targets/f7/ble_glue/furi_ble/event_dispatcher.c
Original file line number Diff line number Diff line change
@@ -50,14 +50,14 @@ BleEventFlowStatus ble_event_dispatcher_process_event(void* payload) {
}

void ble_event_dispatcher_init(void) {
furi_assert(!initialized);

GapSvcEventHandlerList_init(handlers);
initialized = true;
if(!initialized) {
GapSvcEventHandlerList_init(handlers);
initialized = true;
}
}

void ble_event_dispatcher_reset(void) {
furi_assert(initialized);
furi_check(initialized);
furi_check(GapSvcEventHandlerList_size(handlers) == 0);

GapSvcEventHandlerList_clear(handlers);
2 changes: 1 addition & 1 deletion targets/f7/ble_glue/furi_ble/gatt.c
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ bool ble_gatt_characteristic_update(
uint16_t svc_handle,
BleGattCharacteristicInstance* char_instance,
const void* source) {
furi_assert(char_instance);
furi_check(char_instance);
const BleGattCharacteristicParams* char_descriptor = char_instance->characteristic;
FURI_LOG_D(TAG, "Updating %s char", char_descriptor->name);

2 changes: 1 addition & 1 deletion targets/f7/ble_glue/gap.c
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ static void gap_advertise_start(GapState new_state);
static int32_t gap_app(void* context);

static void gap_verify_connection_parameters(Gap* gap) {
furi_assert(gap);
furi_check(gap);

FURI_LOG_I(
TAG,