Wire up bluetooth indicator
This commit is contained in:
10
src/c/main.c
10
src/c/main.c
@@ -332,6 +332,13 @@ static void main_window_unload(Window *window) {
|
||||
animation_destroy(s_head_out_template);
|
||||
}
|
||||
|
||||
static void bluetooth_callback(bool connected) {
|
||||
replace_gbitmap_color(GColorLightGray, GColorBlack, s_bt_icon, s_bt_layer);
|
||||
if (!connected) {
|
||||
replace_gbitmap_color(GColorBlack, GColorLightGray, s_bt_icon, s_bt_layer);
|
||||
}
|
||||
}
|
||||
|
||||
// DEBUG buttons
|
||||
static void up_single_click_handler(ClickRecognizerRef recognizer, void *context) {
|
||||
Window *window = (Window *)context;
|
||||
@@ -442,6 +449,9 @@ static void init() {
|
||||
// show the Window on the watch, with animated=true
|
||||
window_stack_push(s_main_window, true);
|
||||
|
||||
// register with ConnectionService (bluetooth status)
|
||||
connection_service_subscribe((ConnectionHandlers){.pebble_app_connection_handler=bluetooth_callback});
|
||||
|
||||
// register with TickTimerService
|
||||
tick_timer_service_subscribe(MINUTE_UNIT, minute_handler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user