/*! @brief delete method, Key Event Profile message handler. @param[in] received Received message. */ static void in_received_delete_key_event_handler(DictionaryIterator *received) { Tuple *attributeTuple = dict_find(received, KEY_ATTRIBUTE); switch (attributeTuple->value->uint8) { case KEY_EVENT_ATTRIBUTE_ON_DOWN: entry_log2( "ON_DOWN", "del_handler" ) ; event_flag_on_down = false; if (event_flag_on_up == false && window != NULL) { key_event_window_uninit(); } break; case KEY_EVENT_ATTRIBUTE_ON_UP: entry_log2( "ON_UP", "del_handler" ) ; event_flag_on_up = false; if (event_flag_on_down == false && window != NULL) { key_event_window_uninit(); } break; default: // not support entry_log( "not support", "orientation" ) ; pebble_set_error_code(ERROR_NOT_SUPPORT_ATTRIBUTE); break; } }
/*! @brief put method, Key Event Profile message handler. @param[in] received Received message. @param[in] iter Iterator to store the response. */ static void in_received_put_key_event_handler(DictionaryIterator *received) { Tuple *attributeTuple = dict_find(received, KEY_ATTRIBUTE); switch (attributeTuple->value->uint8) { case KEY_EVENT_ATTRIBUTE_ON_DOWN: entry_log2( "ON_DOWN", "put_handler" ) ; if (window == NULL) { key_event_window_init(); } event_flag_on_down = true; break; case KEY_EVENT_ATTRIBUTE_ON_UP: entry_log2( "ON_UP", "put_handler" ) ; if (window == NULL) { key_event_window_init(); } event_flag_on_up = true; break; default: // not support pebble_set_error_code(ERROR_NOT_SUPPORT_ATTRIBUTE); break; } }
/*! @brief Message processing for key event profile. @param[in] received Received message. @retval RETURN_SYNC Synchronous. @retval RETURN_ASYNC Asynchronous. */ int in_received_key_event_handler(DictionaryIterator *received) { Tuple *actionTuple = dict_find(received, KEY_ACTION); switch (actionTuple->value->uint8) { case ACTION_PUT: entry_log2( "put", "keyevent" ) ; in_received_put_key_event_handler(received); break; case ACTION_DELETE: entry_log( "delete", "keyevent" ) ; in_received_delete_key_event_handler(received); break; default: // not support. pebble_set_error_code(ERROR_NOT_SUPPORT_ACTION); break; } return RETURN_SYNC; }
int in_received_device_orientation_handler(DictionaryIterator *received) { Tuple *actionTuple = dict_find(received, KEY_ACTION); switch (actionTuple->value->uint8) { case ACTION_PUT: entry_log2( "put", "orientation" ) ; counter_for_log = 0 ; last_event_time = get_current_time(); outbox_wait_flag = 0 ; in_received_put_device_orientation_handler(received); break; case ACTION_DELETE: entry_log( "delete", "orientation" ) ; in_received_delete_device_orientation_handler(received); break; default: // not support. pebble_set_error_code(ERROR_NOT_SUPPORT_ACTION); break; } return RETURN_SYNC; }