/////////////////////////////////////////// BUTTON BEHAVIOURS ////////////////////////////////////////// void reply_up_click_handler(ClickRecognizerRef recognizer, void *context) { text_layer_set_text(busy_text, "Sending Msg..."); text_layer_set_text(callback_text, " "); text_layer_set_text(lol_text, " "); confirm_vibe(); send_int(KEY_BUTTON_REPLY, REPLY_BUSY); call_counter = 2; tick_timer_service_subscribe(SECOND_UNIT, reply_timer); }
static void init() { tick_timer_service_subscribe(MINUTE_UNIT, tick_handler); s_main_window = window_create(); window_set_window_handlers(s_main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload });
static void main_window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_frame(window_layer); s_display_layer = layer_create(bounds); layer_set_update_proc(s_display_layer, display_layer_update_callback); layer_add_child(window_layer, s_display_layer); tick_timer_service_subscribe(SECOND_UNIT, handle_second_tick); }
int main() { app_message_register_outbox_sent(data_delivered); app_message_register_inbox_received(received_data); app_message_open(124, 50); tick_timer_service_subscribe(SECOND_UNIT, (TickHandler) second_tick); init_menu_window(); app_event_loop(); return 0; }
void init(void) { int i; static struct tm* now; time_t unix_now; window = window_create(); for(i = 0; i < 12; i++) { bs[i] = gbitmap_create_with_resource(bsh[i]); } bcolon = bs[10]; bdash = bs[11]; #if(DATE) bl[0] = bitmap_layer_create(GRect(0,(168/2)-56,30,51)); bl[1] = bitmap_layer_create(GRect(35,(168/2)-56,30,51)); bl[2] = bitmap_layer_create(GRect(67,(168/2)-56,9,51)); bl[3] = bitmap_layer_create(GRect(79,(168/2)-56,30,51)); bl[4] = bitmap_layer_create(GRect(114,(168/2)-56,30,51)); bl[5] = bitmap_layer_create(GRect(0,(168/2)+5,30,51)); bl[6] = bitmap_layer_create(GRect(35,(168/2)+5,30,51)); bl[7] = bitmap_layer_create(GRect(67,(168/2)+5,9,51)); bl[8] = bitmap_layer_create(GRect(79,(168/2)+5,30,51)); bl[9] = bitmap_layer_create(GRect(114,(168/2)+5,30,51)); for(i = 0; i < 10; i++) layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(bl[i])); #else bl[0] = bitmap_layer_create(GRect(0,(168/2)-25,30,51)); bl[1] = bitmap_layer_create(GRect(35,(168/2)-25,30,51)); bl[2] = bitmap_layer_create(GRect(67,(168/2)-25,9,51)); bl[3] = bitmap_layer_create(GRect(79,(168/2)-25,30,51)); bl[4] = bitmap_layer_create(GRect(114,(168/2)-25,30,51)); for(i = 0; i < 5; i++) layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(bl[i])); #endif window_set_background_color(window, GColorBlack); bitmap_layer_set_bitmap(bl[2], bcolon); #if(DATE) bitmap_layer_set_bitmap(bl[7], bdash); #endif tick_timer_service_subscribe(SECOND_UNIT, &handle_minute_tick); unix_now = time(NULL); now = localtime(&unix_now); handle_minute_tick(now, SECOND_UNIT); window_stack_push(window, true); }
void handle_init(void) { // Create a window and text layers window = window_create(); // Create the Time Layer, set the font, and text alignment time_layer = text_layer_create(GRect(0, 5, 144, 168)); text_layer_set_font(time_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD)); text_layer_set_text_alignment(time_layer, GTextAlignmentCenter); // Add the time layer to the window layer_add_child(window_get_root_layer(window), text_layer_get_layer(time_layer)); //Create a horizontal divider line_layer = layer_create(GRect(8, 60, 128, 2)); layer_set_update_proc(line_layer, line_layer_update_callback); layer_add_child(window_get_root_layer(window), line_layer); // Create the Date Layer, set the font, and text alignment date_layer = text_layer_create(GRect(0, 70, 144, 108)); text_layer_set_font(date_layer, fonts_get_system_font(FONT_KEY_BITHAM_30_BLACK)); text_layer_set_text_alignment(date_layer, GTextAlignmentCenter); // Add the date layer to the window layer_add_child(window_get_root_layer(window), text_layer_get_layer(date_layer)); // Create the Year Layer, set the font, and text alignment year_layer = text_layer_create(GRect(0, 100, 144, 108)); text_layer_set_font(year_layer, fonts_get_system_font(FONT_KEY_BITHAM_30_BLACK)); text_layer_set_text_alignment(year_layer, GTextAlignmentCenter); // Add the year layer to the window layer_add_child(window_get_root_layer(window), text_layer_get_layer(year_layer)); // Create the info layer, set the font, text and alignment info_layer = text_layer_create(GRect(0, 140, 144, 30)); text_layer_set_font(info_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); text_layer_set_text_alignment(info_layer, GTextAlignmentCenter); text_layer_set_text(info_layer, "www.dozenal.org"); // Add the info layer to the window layer_add_child(window_get_root_layer(window), text_layer_get_layer(info_layer)); // Push the window window_stack_push(window, true); // initiate the screen time_t now = time(NULL); refresh_screen(localtime(&now)); // Register the time handler function tick_timer_service_subscribe(SECOND_UNIT, handle_minute_tick); // App Logging! // APP_LOG(APP_LOG_LEVEL_DEBUG, "Just pushed a window!"); }
void handle_init(void) { window = window_create(); window_stack_push(window, true /* Animated */); window_set_background_color(window, GColorBlack); fontRobotoCondensed19 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_19)); Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_bounds(window_layer); triangle_overlay_layer = layer_create(bounds); layer_set_update_proc(triangle_overlay_layer, triangle_display_layer_update_callback); layer_add_child(window_layer, triangle_overlay_layer); triangle_overlay_path = gpath_create(&TRIANGLE_OVERLAY_POINTS); gpath_move_to(triangle_overlay_path, grect_center_point(&bounds)); // init hand paths minute_arrow_path = gpath_create(&MINUTE_HAND_POINTS); gpath_move_to(minute_arrow_path, grect_center_point(&bounds)); hour_arrow_path = gpath_create(&HOUR_HAND_POINTS); gpath_move_to(hour_arrow_path, grect_center_point(&bounds)); tick_timer_service_subscribe(MINUTE_UNIT, handle_tick); s_hands_layer = layer_create(bounds); layer_set_update_proc(s_hands_layer, hands_update_proc); layer_add_child(window_layer, s_hands_layer); // Battery Line Basalt #ifdef PBL_PLATFORM_BASALT GRect line_frame = GRect(22, 160, 104, 6); LineLayer = layer_create(line_frame); layer_set_update_proc(LineLayer, line_layer_update_callback); layer_add_child(window_layer, LineLayer); #else //Chalk GRect line_round_frame = GRect(1, 1, 180, 180); RoundBatteryLayer = layer_create(line_round_frame); layer_set_update_proc(RoundBatteryLayer, RoundBatteryLayer_update_callback); layer_add_child(window_layer,RoundBatteryLayer); #endif //Service subscribes: battery_state_service_subscribe(&handle_battery); handle_battery(battery_state_service_peek()); bluetooth_connection_service_subscribe(&handle_bluetooth); handle_bluetooth(bluetooth_connection_service_peek()); app_focus_service_subscribe(&handle_appfocus); }
void process_tuple(Tuple *t){ int key = t->key; if(key == 9000){ app_timer_register(1000, send_initial_request, NULL); tick_timer_service_subscribe(MINUTE_UNIT, handle_tick); return; } if(key < 10){ //HOME switch(key){ case 0: strncpy(home_matchup_subtitle, t->value->cstring, sizeof(home_matchup_subtitle)); break; case 1: strncpy(home_league_subtitle, t->value->cstring, sizeof(home_league_subtitle)); break; case 2: strncpy(home_team_subtitle, t->value->cstring, sizeof(home_team_subtitle)); break; } } else if(key < 100){ //MATCHUP switch(key){ case 10: strncpy(matchup_ally_name, t->value->cstring, sizeof(matchup_ally_name)); break; case 11: matchup_ally_score_int = atoi(t->value->cstring); break; case 12: strncpy(matchup_ally_score_char, t->value->cstring, sizeof(matchup_ally_score_char)); break; case 13: strncpy(matchup_enemy_name, t->value->cstring, sizeof(matchup_enemy_name)); break; case 14: matchup_enemy_score_int = atoi(t->value->cstring); break; case 15: strncpy(matchup_enemy_score_char, t->value->cstring, sizeof(matchup_enemy_score_char)); break; } } else if(key < 200){ //LEAGUE strncpy(league_team_names[key-100], t->value->cstring, sizeof(league_team_names[key-100])); if(strcmp(league_team_names[key-100], "") == 0 && key-100 < num_teams){ num_teams = key-100; menu_layer_reload_data(league_menu_layer); } } else if(key < 300){ //TEAM strncpy(team_player_names[key-200], t->value->cstring, sizeof(team_player_names[key-200])); if(strcmp(team_player_names[key-200], "") == 0 && key-200 < num_players){ num_players = key-200; menu_layer_reload_data(team_menu_layer); } } else if(key == 300){ //DRAFT STATUS if(atoi(t->value->cstring) == 1){ #ifdef PBL_COLOR menu_layer_set_normal_colors(home_menu_layer, GColorBlack, GColorLightGray); menu_layer_set_highlight_colors(home_menu_layer, APP_COLOR, GColorLightGray); menu_layer_reload_data(home_menu_layer); #endif text_layer_set_text(home_text_layer, "Status: Pre-Draft"); pre_draft = true; } } }
static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) { // App Sync keeps new_tuple in sync_buffer, so we may use it directly switch (key) { case BLUETOOTHVIBE_KEY: bluetoothvibe = new_tuple->value->uint8 != 0; persist_write_bool(BLUETOOTHVIBE_KEY, bluetoothvibe); break; case HOURLYVIBE_KEY: hourlyvibe = new_tuple->value->uint8 != 0; persist_write_bool(HOURLYVIBE_KEY, hourlyvibe); break; case FLIP_KEY: flip = new_tuple->value->uint8; persist_write_bool(FLIP_KEY, flip); break; case COLOUR_KEY: colour = new_tuple->value->uint8; persist_write_bool(COLOUR_KEY, colour); colourswap(); break; case BLINK_KEY: blink = new_tuple->value->uint8; persist_write_bool(BLINK_KEY, blink); tick_timer_service_unsubscribe(); if(blink) { tick_timer_service_subscribe(SECOND_UNIT, handle_tick); } else { tick_timer_service_subscribe(MINUTE_UNIT, handle_tick); } break; } }
static void init(void) { // register handlers for clock ticks tick_timer_service_subscribe(SECOND_UNIT, tick_handler_second); tick_timer_service_subscribe(MINUTE_UNIT, tick_handler_minute); // Register callbacks app_message_register_inbox_received(inbox_received_callback); app_message_register_inbox_dropped(inbox_dropped_callback); app_message_register_outbox_failed(outbox_failed_callback); app_message_register_outbox_sent(outbox_sent_callback); // Create main Window element and assign to pointer s_main_window = window_create(); // Set handlers to manage the elements inside the Window window_set_window_handlers(s_main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload });
static void init() { main_window = window_create(); window_set_background_color(main_window, GColorBlack); tick_timer_service_subscribe(MINUTE_UNIT, tick_handler); window_set_window_handlers(main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload, });
static void do_init(void) { window = window_create(); window_stack_push(window, true); window_set_background_color(window, GColorBlack); window_layer = window_get_root_layer(window); GRect line_frame = GRect(8, 120, 139, 2); line_layer = layer_create(line_frame); layer_set_update_proc(line_layer, draw_line); layer_add_child(window_layer, line_layer); time_layer = text_layer_create(GRect(5, 66, 118, 70)); text_layer_set_text_color(time_layer, GColorWhite); text_layer_set_background_color(time_layer, GColorClear); text_layer_set_font(time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_font_droid_44))); text_layer_set_text_alignment(time_layer,GTextAlignmentRight); layer_add_child(window_layer, text_layer_get_layer(time_layer)); date_layer = text_layer_create(GRect(65, 125, 79, 25)); text_layer_set_text_color(date_layer, GColorWhite); text_layer_set_background_color(date_layer, GColorClear); text_layer_set_font(date_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_font_droid_18))); layer_add_child(window_layer, text_layer_get_layer(date_layer)); wday_layer = text_layer_create(GRect(60, 143, 50, 25)); text_layer_set_text_color(wday_layer, GColorWhite); text_layer_set_background_color(wday_layer, GColorClear); text_layer_set_font(wday_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_font_droid_18))); layer_add_child(window_layer, text_layer_get_layer(wday_layer)); //+時間のNULL回避?(わかってない→調べる time_t now = time(NULL); struct tm *current_time = localtime(&now); handle_time_tick(current_time, SECOND_UNIT); tick_timer_service_subscribe(SECOND_UNIT, &handle_time_tick); batt_layer = bitmap_layer_create(GRect(123, 151, 14, 10)); layer_add_child(window_layer, bitmap_layer_get_layer(batt_layer)); //親レイヤに載せる watchicon_layer = bitmap_layer_create(GRect(131, 151, 6, 10)); layer_add_child(window_layer, bitmap_layer_get_layer(watchicon_layer)); bitmap_layer_set_background_color(watchicon_layer, GColorClear); bt_layer = bitmap_layer_create(GRect(110, 151, 11, 10)); layer_add_child(window_layer, bitmap_layer_get_layer(bt_layer)); handle_battery(battery_state_service_peek()); battery_state_service_subscribe(&handle_battery); handle_bluetooth(bluetooth_connection_service_peek()); bluetooth_connection_service_subscribe(&handle_bluetooth); }
void accl_init(void) { tick_timer_service_subscribe(SECOND_UNIT, handle_second_tick); accel_data_service_subscribe(10, &accel_data_handler); accel_service_set_sampling_rate(sample_freq); //This is the place that works app_message_register_outbox_failed(accl_out_failed_handler); app_message_register_outbox_sent(accl_out_received_handler); timer = app_timer_register(timer_interval, timer_callback, NULL); app_comm_set_sniff_interval(SNIFF_INTERVAL_REDUCED); }
void tap_handler(AccelAxisType axis, int32_t direction) { APP_LOG(APP_LOG_LEVEL_DEBUG_VERBOSE, "accel tap!"); enable_second_expire = time(NULL) + enable_second_age; if (!enable_second) { APP_LOG(APP_LOG_LEVEL_DEBUG_VERBOSE, "enable sec"); enable_second = true; tick_timer_service_unsubscribe(); tick_timer_service_subscribe(SECOND_UNIT, tick_handler); refresh_analog_enable_second(); } }
static void init() { // Register with TickTimerService tick_timer_service_subscribe(MINUTE_UNIT, tick_handler); // Create main Window element and assign to pointer s_main_window = window_create(); // Set handlers to manage the elements inside the Window window_set_window_handlers(s_main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload });
static void main_window_load(Window *window) { Layer *window_layer = window_get_root_layer(window); GRect bounds = layer_get_frame(window_layer); s_battery_layer = text_layer_create(PBL_IF_ROUND_ELSE( GRect(38, 12, bounds.size.w-76, 32), GRect(8, 6, bounds.size.w-16, 32))); text_layer_set_text_color(s_battery_layer, GColorBlack); text_layer_set_background_color(s_battery_layer, GColorClear); text_layer_set_font(s_battery_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(s_battery_layer, GTextAlignmentRight); text_layer_set_text(s_battery_layer, "100%"); s_date_layer = text_layer_create(PBL_IF_ROUND_ELSE( GRect(38, 12, bounds.size.w-76, 32), GRect(8, 6, bounds.size.w-16, 32))); text_layer_set_text_color(s_date_layer, GColorBlack); text_layer_set_background_color(s_date_layer, GColorClear); text_layer_set_font(s_date_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(s_date_layer, GTextAlignmentLeft); text_layer_set_text(s_date_layer, "Jan 1"); s_time_layer = text_layer_create(GRect(0, 48, bounds.size.w, 56)); text_layer_set_text_color(s_time_layer, GColorWhite); text_layer_set_background_color(s_time_layer, GColorMidnightGreen); text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_LECO_42_NUMBERS)); text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter); s_steps_layer = text_layer_create(GRect(0, 100, bounds.size.w, 32)); text_layer_set_text_color(s_steps_layer, GColorBlack); text_layer_set_background_color(s_steps_layer, GColorCadetBlue); text_layer_set_font(s_steps_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(s_steps_layer, GTextAlignmentCenter); text_layer_set_text(s_steps_layer, "0 steps"); s_connection_layer = text_layer_create(GRect(0, 136, bounds.size.w, 20)); text_layer_set_text_color(s_connection_layer, GColorBlack); text_layer_set_background_color(s_connection_layer, GColorClear); text_layer_set_font(s_connection_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD)); text_layer_set_text_alignment(s_connection_layer, GTextAlignmentCenter); handle_bluetooth(connection_service_peek_pebble_app_connection()); time_t now = time(NULL); struct tm *current_time = localtime(&now); handle_minute_tick(current_time, MINUTE_UNIT); tick_timer_service_subscribe(MINUTE_UNIT, handle_minute_tick); battery_state_service_subscribe(handle_battery); connection_service_subscribe((ConnectionHandlers) { .pebble_app_connection_handler = handle_bluetooth });
static void init() { // 注册时间服务 tick_timer_service_subscribe(SECOND_UNIT, frame.refresh); // 创建窗口 mainWindow = window_create(); // 注册窗口事件 window_set_window_handlers(mainWindow, (WindowHandlers) { .load = onWindowLoad, .unload = onWindowUnload });
//INITIALIZE static void init() { //register tap handler accel_tap_service_subscribe(tap_handler); //make the main window tick_timer_service_subscribe(MINUTE_UNIT, tick_handler); s_main_window = window_create(); window_set_window_handlers(s_main_window, (WindowHandlers){ .load = main_window_load, .unload = main_window_unload });
/* * Main - or main as it is known */ int main(void) { init(); tick_timer_service_subscribe(SECOND_UNIT, &handle_tick); bluetooth_connection_service_subscribe(&bt_connection_handler); battery_state_service_subscribe (&battery_state_handler); conserve_power(true); app_event_loop(); deinit(); }
static void init(void) { window = window_create(); WindowHandlers handlers = { .load = window_load, .unload = window_unload }; window_set_window_handlers(window, handlers); tick_timer_service_subscribe(MINUTE_UNIT, tick_handler); window_stack_push(window, true); }
void handle_init(void) { // Creates images resource bitmap_1 = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_GROUND_TEMPLATE); bitmap_2 = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_YL0); bitmap_3 = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_YF0); bitmap_4 = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_YR0); // Create a window and text layer window = window_create(); text_layer = text_layer_create(GRect(0, 0, 144, 154)); // Set the text, font, and text alignment text_layer_set_text(text_layer, "Hello World!"); text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); text_layer_set_text_alignment(text_layer, GTextAlignmentCenter); // Add the text layer to the window layer_add_child(window_get_root_layer(window), text_layer_get_layer(text_layer)); date_layer = text_layer_create(GRect(0, 112, 144, 56)); text_layer_set_text_alignment(date_layer, GTextAlignmentCenter); text_layer_set_font(date_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_LIGHT)); layer_add_child(window_get_root_layer(window), text_layer_get_layer(date_layer)); inverter_layer = inverter_layer_create(GRect(0, 112, 144, 56)); layer_add_child(window_get_root_layer(window), inverter_layer_get_layer(inverter_layer)); // Draws ground ground = bitmap_layer_create(GRect(0, 56, 144, 56)); yorp_left = bitmap_layer_create(r1); yorp_front = bitmap_layer_create(r2); yorp_right = bitmap_layer_create(r3); bitmap_layer_set_bitmap(ground, bitmap_1); bitmap_layer_set_bitmap(yorp_left, bitmap_2); bitmap_layer_set_bitmap(yorp_front, bitmap_3); bitmap_layer_set_bitmap(yorp_right, bitmap_4); Layer * l = window_get_root_layer(window); layer_add_child(l, bitmap_layer_get_layer(ground)); layer_add_child(l, bitmap_layer_get_layer(yorp_left)); layer_add_child(l, bitmap_layer_get_layer(yorp_front)); layer_add_child(l, bitmap_layer_get_layer(yorp_right)); time_t now = time(NULL); handle_timechanges(localtime(&now), SECOND_UNIT); tick_timer_service_subscribe(SECOND_UNIT, handle_timechanges); // Push the window window_stack_push(window, true); // App Logging! APP_LOG(APP_LOG_LEVEL_DEBUG, "Hello World from the applogs!"); }
static void pullups_play_pause_handler(ClickRecognizerRef rec, void *context) { if (ticking) return; cur_reps += cur_setting.u.s.step; if (cur_reps <= 0) { cur_reps = cur_setting.u.s.reps; return; } ticking = 1; tick_timer_service_subscribe(SECOND_UNIT, pullups_tick_handler); }
static void init(void) { Window* w; tick_timer_service_subscribe(SECOND_UNIT, handle_tick); //APP_LOG(APP_LOG_LEVEL_DEBUG, "Creating GPS window"); w = window_create(); window_set_background_color(w, GColorBlack); window_set_fullscreen(w, true); window_set_window_handlers(w, (WindowHandlers) { .load = gps_window_load, .unload = gps_window_unload });
static void init() { window = window_create(); window_stack_push(window, true); window_set_background_color(window, GColorBlack); // Avoids a blank screen on watch start. time_t now = time(NULL); struct tm *tick_time = localtime(&now); display_time(tick_time); tick_timer_service_subscribe(MINUTE_UNIT, handle_minute_tick); }
/////////////////////////////////////////////////////////////////////////////// // Down click on timer window. void down_single_click_handler(ClickRecognizerRef recognizer, Window *window) { // Go to the next period, if this is the last period, don't do anything. if (control_block_get_intervals_left() > 1){ // Stop timer. tick_timer_service_unsubscribe(); control_block_next_period(); // Start the timer. tick_timer_service_subscribe(SECOND_UNIT, handle_tick); } }
static void init() { tick_timer_service_subscribe(INTERVAL_UPDATE, tick_handler); bluetooth_connection_service_subscribe(bt_handler); battery_state_service_subscribe(batt_handler); s_main_window = window_create(); window_set_window_handlers(s_main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload });
void init() { main_window = window_create(); custom_font_24 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_CUSTOM_24)); battery_state_service_subscribe(battery_state_changed_handler); tick_timer_service_subscribe(MINUTE_UNIT | DAY_UNIT, time_changed_handler); window_set_window_handlers(main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload });
// Setup and breakdown static void init () { // create main window s_main_window = window_create(); // Register with TickTimerService tick_timer_service_subscribe(MINUTE_UNIT, tick_handler); // set the window handlers window_set_window_handlers(s_main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload });
void wakeup_handler(WakeupId id, int32_t reason) { // The app has woken! // Subscribe to TickTimerService tick_timer_service_subscribe(SECOND_UNIT, tick_handler); // Create alert window s_alert_window = window_create(); window_set_click_config_provider(s_alert_window, click_config_provider); window_set_window_handlers(s_alert_window, (WindowHandlers) { .load = alert_window_load, .unload = alert_window_unload });
//Инициализация void init() { //Подписка на события ежеминутного "тика" и смены состояний батареи/блютуза tick_timer_service_subscribe(MINUTE_UNIT, (TickHandler) tick_handler); battery_state_service_subscribe(batt_handler); bluetooth_connection_service_subscribe(bt_handler); //Создание окна и задание обработчиков window = window_create(); window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload, });