Exemplo n.º 1
0
/**
 * @name	timer_fire
 * @brief	fire's the given timer to js
 * @param	timer - (core_timer *) timer to fire
 * @retval	NONE
 */
CEXPORT static void timer_fire(core_timer *timer) {
	js_timer_fire(timer);

	if (!timer->repeat) {
		timer_unschedule(timer);
	} else {
		timer->time_left = timer->duration;
	}
}
static void window_unload(Window *window) {
    statium_watchface_destroy(application.layer);

    timer_unschedule();

    // Shut down communication between watch and phone.
    app_message_deregister_callbacks();

    // Unwatch bluethooth state.
    bluetooth_connection_service_unsubscribe();
}
Exemplo n.º 3
0
/**
 * @name	core_timer_clear
 * @brief	unschedules timers with the given id
 * @param	id - (int) id to unschedule timers with
 * @retval	NONE
 */
CEXPORT void core_timer_clear(int id) {
	core_timer *timer = timer_head;

	while (timer) {
		if (timer->id == id) {
			timer_unschedule(timer);
			return;
		}

		timer = timer->next;
	}

	LOG("{timer} Tried to clear timer %i when it didn't exist", id);
}
static void bluetooth_connection(bool connected) {
    if (connected) {
        // Ask for recommandation game.
        DictionaryIterator* iterator;
        app_message_outbox_begin(&iterator);
        // Code value doesn't really matter.
        dict_write_uint32(iterator, PEBBLE_KEYS_GAME, 0xB00B5);
        app_message_outbox_send();
        // Reschedule the timer.
        timer_schedule(NULL);
    }
    else {
        timer_unschedule();
        statium_watchface_layer_set_text(application.layer, _("Bluetooth is off"));
    }
}
static void message_game_handler(Tuple* tuple) {
    timer_unschedule();
    statium_watchface_layer_set_text(application.layer, tuple->value->cstring);
}