Skip to content

Commit 5c002ed

Browse files
committed
first scan/connect to sink
1 parent 9c6746e commit 5c002ed

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

app/src/applications/lea_assistant/lea_assistant_app.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -42,39 +42,39 @@ static void close_app(void)
4242
zsw_app_manager_app_close_request(&app);
4343
}
4444

45-
static void on_sink_selected(lea_assistant_device_t *device)
45+
static void on_source_selected(lea_assistant_device_t *device)
4646
{
47-
LOG_DBG("Sink %s selected", device->name);
47+
LOG_DBG("Source %s selected", device->name);
4848

49-
// Could use `MESSAGE_SUBTYPE_CONNECT_SINK`, but calling it directly so don't need to fill buffer and parse LTV
50-
connect_to_sink(&device->addr);
49+
// Could use `MESSAGE_SUBTYPE_ADD_SOURCE`, but calling it directly so don't need to fill buffer and parse LTV
50+
add_source(device->sid, device->pa_interval, device->broadcast_id, &device->addr);
5151
close_app();
5252
}
5353

54-
static void on_source_selected(lea_assistant_device_t *device)
54+
static void on_sink_selected(lea_assistant_device_t *device)
5555
{
56-
LOG_DBG("Source %s selected", device->name);
56+
LOG_DBG("Sink %s selected", device->name);
5757

5858
message_handler(&(struct webusb_message ) {
5959
.sub_type = MESSAGE_SUBTYPE_STOP_SCAN
6060
}, 0);
6161

6262
message_handler(&(struct webusb_message ) {
63-
.sub_type = MESSAGE_SUBTYPE_START_SINK_SCAN
63+
.sub_type = MESSAGE_SUBTYPE_START_SOURCE_SCAN
6464
}, 0);
6565

66-
// Could use `MESSAGE_SUBTYPE_ADD_SOURCE`, but calling it directly so don't need to fill buffer and parse LTV
67-
add_source(device->sid, device->pa_interval, device->broadcast_id, &device->addr);
68-
lea_assistant_ui_show_sink(on_sink_selected);
66+
// Could use `MESSAGE_SUBTYPE_CONNECT_SINK`, but calling it directly so don't need to fill buffer and parse LTV
67+
connect_to_sink(&device->addr);
68+
lea_assistant_ui_show_source(on_source_selected);
6969
}
7070

7171
static void lea_assistant_app_start(lv_obj_t *root, lv_group_t *group)
7272
{
7373
LOG_DBG("LEA Assistant app start");
7474
message_handler(&(struct webusb_message ) {
75-
.sub_type = MESSAGE_SUBTYPE_START_SOURCE_SCAN
75+
.sub_type = MESSAGE_SUBTYPE_START_SINK_SCAN
7676
}, 0);
77-
lea_assistant_ui_show(root, on_source_selected, close_app);
77+
lea_assistant_ui_show(root, on_sink_selected, close_app);
7878
}
7979

8080
static void lea_assistant_app_stop(void)

app/src/applications/lea_assistant/lea_assistant_ui.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void lea_assistant_ui_show(lv_obj_t *root, on_button_press_cb_t on_button_click_
151151
page_init(root, "Audio source:");
152152
}
153153

154-
void lea_assistant_ui_show_sink(on_button_press_cb_t on_button_click_cb)
154+
void lea_assistant_ui_show_source(on_button_press_cb_t on_button_click_cb)
155155
{
156156
if (root_page != NULL) {
157157
lv_obj_del(root_page);

app/src/applications/lea_assistant/lea_assistant_ui.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ typedef void(*on_close_cb_t)(void);
99

1010
void lea_assistant_ui_show(lv_obj_t *root, on_button_press_cb_t on_button_click_cb, on_close_cb_t close_cb);
1111

12-
void lea_assistant_ui_show_sink(on_button_press_cb_t on_button_click_cb);
12+
void lea_assistant_ui_show_source(on_button_press_cb_t on_button_click_cb);
1313

1414
void lea_assistant_ui_add_list_entry(lea_assistant_device_t *device);
1515

0 commit comments

Comments
 (0)