void moments_status_bluetooth_icon_show(void);
void moments_status_bluetooth_icon_hide(void);
+void moments_status_headset_icon_show(void);
+void moments_status_headset_icon_hide(void);
+
void moments_status_battery_update(int percent, int converted_percent, bool is_charging);
void moments_status_callsignal_update(int strength, bool is_roaming);
void moments_status_network_update(int network_type, int packet_type);
#define STATUS_SIMCARD_LAYOUT "status_simcard_layout"
#define STATUS_LOCATION_LAYOUT "status_location_layout"
#define STATUS_BLUETOOTH_LAYOUT "status_bluetooth_layout"
+#define STATUS_HEADSET_LAYOUT "status_headset_layout"
#define SIZE_SETTER "size_setter"
#define MOMENTS_BG "moments_bg"
#define MOMENTS_CONTENT "moments_content"
--- /dev/null
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../../../inc/moments/moments_view_edje_conf.h"
+
+#define HEADSET_DIR_PREFIX "Headset"
+
+collections {
+ group { STATUS_HEADSET_LAYOUT;
+ images {
+ image: HEADSET_DIR_PREFIX"/headset_on.png" COMP;
+ }
+ parts {
+ part {
+ name: "icon_image";
+ type: IMAGE;
+ description {
+ state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ image.normal: HEADSET_DIR_PREFIX"/headset_on.png";
+ color: 250 250 250 255;
+ }
+ }
+ }
+ }
+}
+
+
static void __simcard_state_changed_cb(telephony_h handle, telephony_noti_e noti_id, void *data, void *user_data);
static void __location_service_state_changed_cb(runtime_info_key_e key, void *data);
static void __bluetooth_state_changed_cb(keynode_t *node, void *user_data);
+static void __headset_state_changed_cb(keynode_t *node, void *user_data);
static void __get_callsignal_state(bool *is_roaming, int *strength);
static void __get_network_strength_and_packet_type(int *network_type, int *packet_type);
static void __get_wifi_strength_and_packet_type(int *strength, int *packet_type);
__location_service_state_changed_cb(0, NULL);
}
__bluetooth_state_changed_cb(NULL, NULL);
+ __headset_state_changed_cb(NULL, NULL);
s_info.on_initialization = false;
}
/* BLUETOOTH */
vconf_notify_key_changed(VCONFKEY_BT_STATUS, __bluetooth_state_changed_cb, NULL);
vconf_notify_key_changed(VCONFKEY_WMS_WMANAGER_CONNECTED, __bluetooth_state_changed_cb, NULL);
+ /* HEADSET */
+ vconf_notify_key_changed(VCONFKEY_BT_DEVICE, __headset_state_changed_cb, NULL);
}
static void __unregister_status_callback(void)
vconf_ignore_key_changed(VCONFKEY_BT_STATUS, __bluetooth_state_changed_cb);
vconf_ignore_key_changed(VCONFKEY_WMS_WMANAGER_CONNECTED, __bluetooth_state_changed_cb);
+
+ vconf_ignore_key_changed(VCONFKEY_WMS_WMANAGER_CONNECTED, __headset_state_changed_cb);
}
static void __battery_state_changed_cb(device_callback_e type, void *value, void *user_data)
_E("Failed to get vconkey for BLUETOOTH CONNECTED");
return;
}
+ } else {
+ // Disconnect HEADSET
}
moments_status_bluetooth_update(on_off, connected);
moments_status_update_view();
}
+static void __headset_state_changed_cb(keynode_t *node, void *user_data)
+{
+ _D("Headset State is changed");
+ int is_bt_on = 0;
+
+ if (vconf_get_int(VCONFKEY_BT_STATUS, &is_bt_on) < 0) {
+ _E("Failed to get vconfkey for bluetooth state");
+ return;
+ }
+
+ if (is_bt_on) {
+ int is_device_connected = 0;
+ if (vconf_get_int(VCONFKEY_BT_DEVICE, &is_device_connected) < 0) {
+ _E("Failed to get bt is connected with device");
+ return;
+ }
+
+ if (is_device_connected == VCONFKEY_BT_DEVICE_HEADSET_CONNECTED ||
+ is_device_connected == VCONFKEY_BT_DEVICE_A2DP_HEADSET_CONNECTED) {
+ _D("Headset is connected");
+ moments_status_headset_icon_show();
+ } else {
+ moments_status_headset_icon_hide();
+ }
+ } else {
+ moments_status_headset_icon_hide();
+ }
+
+ moments_status_update_view();
+}
+
static void __network_type_changed_cb(keynode_t *node, void *user_data)
{
__call_network_service_state_changed_cb(NULL, 0, NULL, NULL);
__bluetooth_state_changed_cb(NULL, NULL);
}
+void __t__moments_restore_status_headset_state(void)
+{
+ __headset_state_changed_cb(NULL, NULL);
+}
+
void __t__moments_manager_update_status_view(int is_flight, int service_state, int wifi_state)
{
__update_status_view_by_call_network_changed(is_flight, service_state, wifi_state);
#define STATUS_SIMCARD_EDJE EDJE_DIR"/circle/moments_status_simcard.edj"
#define STATUS_LOCATION_EDJE EDJE_DIR"/circle/moments_status_location.edj"
#define STATUS_BLUETOOTH_EDJE EDJE_DIR"/circle/moments_status_bluetooth.edj"
+#define STATUS_HEADSET_EDJE EDJE_DIR"/circle/moments_status_headset.edj"
static struct __status_view_s {
Evas_Object *status_layout;
Evas_Object *status_simcard;
Evas_Object *status_location;
Evas_Object *status_bluetooth;
+ Evas_Object *status_headset;
} s_info = {
.status_layout = NULL,
.status_grid = NULL,
.status_simcard = NULL,
.status_location = NULL,
.status_bluetooth = NULL,
+ .status_headset = NULL,
};
static status_icon_type_e __status_icon_priority_bt[STATUS_ICON_MAX_COUNT_BT] = {
static Evas_Object *__create_simcard(Evas_Object *parent);
static Evas_Object *__create_location(Evas_Object *parent);
static Evas_Object *__create_bluetooth(Evas_Object *parent);
+static Evas_Object *__create_headset(Evas_Object *parent);
Evas_Object *moments_status_view_create(Evas_Object *parent)
{
}
}
+void moments_status_headset_icon_show(void)
+{
+ if (s_info.status_headset) moments_status_headset_icon_hide();
+
+ s_info.status_headset = __create_headset(s_info.status_layout);
+
+ __status_icon_list[STATUS_ICON_HEADSET] = s_info.status_headset;
+ __status_icon_is_appended[STATUS_ICON_HEADSET] = true;
+
+ __register_icon_type_to_list(STATUS_ICON_HEADSET);
+}
+
+void moments_status_headset_icon_hide(void)
+{
+ __unregister_icon_type_from_list(STATUS_ICON_HEADSET);
+ __status_icon_is_appended[STATUS_ICON_HEADSET] = false;
+
+ if (s_info.status_headset) evas_object_del(s_info.status_headset);
+ s_info.status_headset = NULL;
+ __status_icon_list[STATUS_ICON_HEADSET] = NULL;
+}
+
void moments_status_update_view(void)
{
_D("Update status icon list");
{
Evas_Object *bluetooth = elm_layout_add(parent);
if (!bluetooth || !elm_layout_file_set(bluetooth, util_get_res_file_path(STATUS_BLUETOOTH_EDJE), STATUS_BLUETOOTH_LAYOUT)) {
- _E("Failed to create location layout");
+ _E("Failed to create bluetooth layout");
return NULL;
}
evas_object_size_hint_min_set(bluetooth, MOMENTS_STATUS_ICON_W, MOMENTS_STATUS_ICON_H);
return bluetooth;
}
+static Evas_Object *__create_headset(Evas_Object *parent)
+{
+ Evas_Object *headset = elm_layout_add(parent);
+ if (!headset || !elm_layout_file_set(headset, util_get_res_file_path(STATUS_HEADSET_EDJE), STATUS_HEADSET_LAYOUT)) {
+ _E("Failed to create headset layout");
+ return NULL;
+ }
+ evas_object_size_hint_min_set(headset, MOMENTS_STATUS_ICON_W, MOMENTS_STATUS_ICON_H);
+ evas_object_size_hint_align_set(headset, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(headset, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_move(headset, OUTSIDE_X, OUTSIDE_Y);
+ evas_object_show(headset);
+
+ return headset;
+}
+
static int __get_icon_position_index(status_icon_type_e type)
{
Eina_List *list = NULL;
return s_info.status_bluetooth;
}
+Evas_Object *__t__get_moments_status_headset(void)
+{
+ return s_info.status_headset;
+}
+
int __t__get_moments_status_icon_index(int type)
{
return __get_icon_position_index(type);
static unit_case_func_t __case_check_status_view_simcard(void *data);
static unit_case_func_t __case_check_status_view_location(void *data);
static unit_case_func_t __case_check_status_view_bluetooth(void *data);
+static unit_case_func_t __case_check_status_view_headset(void *data);
static void __status_restore_icons(void);
TEST_CASE_DONE(s_info.group);
}
+static unit_case_func_t __continue_check_status_headset_icon_change(void *data);
+static unit_case_func_t __case_check_status_view_headset(void *data)
+{
+ Evas_Object *headset = __t__get_moments_status_headset();
+ if (!headset) {
+ moments_status_headset_icon_show();
+ moments_status_update_view();
+ TEST_CASE_CONTINUE(0.3, __case_check_status_view_headset, NULL);
+ }
+
+ TEST_ASSERT_TRUE_UPGRADE(evas_object_visible_get(headset));
+
+ int index = __t__get_moments_status_icon_index(STATUS_ICON_HEADSET);
+ TEST_ASSERT_TRUE_UPGRADE(index >= 0);
+
+ int x, y, w, h;
+ evas_object_geometry_get(headset, &x, &y, &w, &h);
+ TEST_ASSERT_EQUAL_INT_UPGRADE(__t_status_icon_position[index][0], x);
+ TEST_ASSERT_EQUAL_INT_UPGRADE(__t_status_icon_position[index][1], y);
+ TEST_ASSERT_EQUAL_INT_UPGRADE(MOMENTS_STATUS_ICON_W, w);
+ TEST_ASSERT_EQUAL_INT_UPGRADE(MOMENTS_STATUS_ICON_H, h);
+
+ moments_status_update_view();
+
+ TEST_CASE_CONTINUE(0.3, __continue_check_status_headset_icon_change, headset);
+}
+
+static unit_case_func_t __continue_check_status_headset_icon_change(void *data)
+{
+ double val = 0.0;
+ Evas_Object *headset = (Evas_Object *)data;
+
+ TEST_CASE_DONE(s_info.group);
+}
+
void group_feature_moments_status_view_ui(unit_group_t * group)
{
s_info.group = group;
TEST_CASE_ADD(s_info.group, __case_check_status_view_simcard, NULL);
TEST_CASE_ADD(s_info.group, __case_check_status_view_location, NULL);
TEST_CASE_ADD(s_info.group, __case_check_status_view_bluetooth, NULL);
+ TEST_CASE_ADD(s_info.group, __case_check_status_view_headset, NULL);
TEST_GROUP_TEAR_DOWN(s_info.group, __group_tear_down);
TEST_GROUP_RUN(s_info.group);
__t__moments_restore_status_call_network_service_state();
}
__t__moments_restore_status_bluetooth_state();
+ __t__moments_restore_status_headset_state();
}
#endif
extern Evas_Object *__t__get_moments_status_location(void);
extern Evas_Object *__t__get_moments_status_location(void);
extern Evas_Object *__t__get_moments_status_bluetooth(void);
+extern Evas_Object *__t__get_moments_status_headset(void);
extern void __t__moments_restore_status_battery(void);
extern void __t__moments_restore_status_call_network_service_state(void);
extern void __t__moments_restore_status_bluetooth_state(void);
+extern void __t__moments_restore_status_headset_state(void);
extern void __t__moments_flight_mode_just_turned_on_off(int turn_on);
extern void __t__moments_manager_update_status_view(int is_flight, int service_state, int wifi_state);
extern int __t__get_moments_status_icon_index(int type);