From: Radoslaw Czerski Date: Mon, 13 Jun 2016 15:01:41 +0000 (+0200) Subject: modules/processing/call_options: new module added. X-Git-Tag: accepted/tizen/mobile/20160615.001333~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F72811%2F10;p=profile%2Fmobile%2Fapps%2Fnative%2Findicator.git modules/processing/call_options: new module added. Mute and Speaker on icons added. Change-Id: Ifb7592160b55ee46b5b3c9d80462eefe21146c01 Signed-off-by: Radoslaw Czerski --- diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt index 6cfd421..2c3e9ea 100644 --- a/CMake/CMakeLists.txt +++ b/CMake/CMakeLists.txt @@ -45,6 +45,7 @@ pkg_check_modules(pkgs REQUIRED storage capi-base-utils-i18n capi-message-port + callmgr_client ) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/packaging/org.tizen.indicator.spec b/packaging/org.tizen.indicator.spec index 78f6230..d7aaa78 100644 --- a/packaging/org.tizen.indicator.spec +++ b/packaging/org.tizen.indicator.spec @@ -51,6 +51,7 @@ BuildRequires: pkgconfig(capi-network-nfc) BuildRequires: pkgconfig(capi-network-tethering) BuildRequires: pkgconfig(storage) BuildRequires: pkgconfig(capi-base-utils-i18n) +BuildRequires: pkgconfig(callmgr_client) BuildRequires: cmake BuildRequires: edje-tools diff --git a/project_def.prop b/project_def.prop index 98f97cf..5948098 100644 --- a/project_def.prop +++ b/project_def.prop @@ -9,7 +9,8 @@ type = app profile = mobile-3.0 # C Sources -USER_SRCS = src/modules/information/video_play.c src/modules/information/earphone.c src/bg_color.c src/modules/information/toast_popup.c /src/modules/processing/call_divert.c src/modules/information/mp3_playing.c src/icon.c src/modules/modules.c src/modules/processing/transfer.c src/modules/processing/uploading.c src/modules/information/voice_recorder.c src/modules/information/noti.c src/modules/information/lowmem.c src/modules/information/fm_radio.c src/modules/setting/gps.c src/modules/processing/call.c src/modules/information/more_notify.c src/modules/setting/bluetooth.c src/tts.c src/modules/connection/connection.c src/modules/connection/wifi.c src/list.c src/modules/setting/nfc.c src/ticker.c src/modules/connection/dock.c src/main.c src/box.c src/modules/information/ext_storage.c src/modules/power/battery.c src/modules/connection/mobile_hotspot.c src/modules/home/search.c src/util.c src/modules/clock/clock.c src/modules/information/alarm.c src/modules/network/rssi.c src/modules/processing/downloading.c src/modules/setting/wifi-direct.c src/modules/connection/usb.c src/modules/setting/silent.c + +USER_SRCS = src/modules/information/video_play.c src/modules/information/earphone.c src/bg_color.c src/modules/information/toast_popup.c /src/modules/processing/call_options.c /src/modules/processing/call_divert.c src/modules/information/mp3_playing.c src/icon.c src/modules/modules.c src/modules/processing/transfer.c src/modules/processing/uploading.c src/modules/information/voice_recorder.c src/modules/information/noti.c src/modules/information/lowmem.c src/modules/information/fm_radio.c src/modules/setting/gps.c src/modules/processing/call.c src/modules/information/more_notify.c src/modules/setting/bluetooth.c src/tts.c src/modules/connection/connection.c src/modules/connection/wifi.c src/list.c src/modules/setting/nfc.c src/ticker.c src/modules/connection/dock.c src/main.c src/box.c src/modules/information/ext_storage.c src/modules/power/battery.c src/modules/connection/mobile_hotspot.c src/modules/home/search.c src/util.c src/modules/clock/clock.c src/modules/information/alarm.c src/modules/network/rssi.c src/modules/processing/downloading.c src/modules/setting/wifi-direct.c src/modules/connection/usb.c src/modules/setting/silent.c # EDC Sources USER_EDCS = diff --git a/res/resource/indicator_port.edc b/res/resource/indicator_port.edc index d235bac..7edebe6 100644 --- a/res/resource/indicator_port.edc +++ b/res/resource/indicator_port.edc @@ -1596,24 +1596,7 @@ collections { target: "elm.swallow.fixed5"; target: "elm.rect.wifi"; } - // BLUETOOTH - program { - name: "indicator.bluetooth.show"; - action: STATE_SET "default" 0.0; - signal: "indicator.bluetooth.show"; - source: "indicator.prog"; - target: "elm.swallow.fixed6"; - target: "elm.rect.bt"; - } - program { - name: "indicator.bluetooth.hide"; - action: STATE_SET "hide" 0.0; - signal: "indicator.bluetooth.hide"; - source: "indicator.prog"; - target: "elm.swallow.fixed6"; - target: "elm.rect.bt"; - } // WIFI-Direct program { name: "indicator.wifidirect.show"; diff --git a/src/icon.c b/src/icon.c index ea6b31f..d1b18a6 100644 --- a/src/icon.c +++ b/src/icon.c @@ -97,7 +97,7 @@ static const char *_icon_ani_type_set_send_signal(icon_s *icon, Icon_Ani_Type ty retv_if(!icon, NULL); const char *BLINK_SIGNAL = "icon,state,blink"; - const char *ROATATE_SIGNAL = "icon,state,rotate"; + const char *ROTATE_SIGNAL = "icon,state,rotate"; const char *METRONOME_SIGNAL = "icon,state,metronome"; const char *DEFAULT = "icon,state,default"; const char *send_signal = DEFAULT; @@ -107,7 +107,7 @@ static const char *_icon_ani_type_set_send_signal(icon_s *icon, Icon_Ani_Type ty send_signal = BLINK_SIGNAL; break; case ICON_ANI_ROTATE: - send_signal = ROATATE_SIGNAL; + send_signal = ROTATE_SIGNAL; break; case ICON_ANI_METRONOME: send_signal = METRONOME_SIGNAL; diff --git a/src/modules/modules.c b/src/modules/modules.c index c5cfcd7..b702fd3 100644 --- a/src/modules/modules.c +++ b/src/modules/modules.c @@ -38,6 +38,8 @@ extern icon_s conn; /* Processing */ extern icon_s call; extern icon_s call_divert; +extern icon_s call_options_mute; +extern icon_s call_options_speaker; /* Information */ extern icon_s ext_storage; @@ -97,7 +99,8 @@ static icon_s *modules[INDICATOR_MODULE_NUMBERS] = { /* Processing */ &call, &call_divert, - + &call_options_mute, + &call_options_speaker, /* Information */ /* &message, */ /* &voice_mail, */ diff --git a/src/modules/processing/call.c b/src/modules/processing/call.c index 0b9f409..09a4197 100644 --- a/src/modules/processing/call.c +++ b/src/modules/processing/call.c @@ -31,7 +31,7 @@ #include "util.h" #include "log.h" -#define ICON_PRIORITY INDICATOR_PRIORITY_MINICTRL3 +#define ICON_PRIORITY INDICATOR_PRIORITY_MINICTRL1 #define MODULE_NAME "call" #define MINICONTROL_VOICE_NAME "[voicecall-quickpanel]" #define MINICONTROL_VIDEO_NAME "[videocall-quickpanel]" diff --git a/src/modules/processing/call_options.c b/src/modules/processing/call_options.c new file mode 100644 index 0000000..ee2aec4 --- /dev/null +++ b/src/modules/processing/call_options.c @@ -0,0 +1,167 @@ +/* + * Indicator + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 +#include +#include "common.h" +#include "indicator.h" +#include "main.h" +#include "modules.h" +#include "icon.h" +#include "util.h" +#include "log.h" + +#define MODULE_NAME_MUTE "call_options_mute" +#define ICON_PRIORITY_MUTE INDICATOR_PRIORITY_MINICTRL2 + +#define MODULE_NAME_SPEAKER "call_options_speaker" +#define ICON_PRIORITY_SPEAKER INDICATOR_PRIORITY_MINICTRL3 + +static int register_call_options_mute_module(void *data); +static int register_call_options_speaker_module(void *data); + +static int unregister_call_options_mute_module(void); +static int unregister_call_options_speaker_module(void); + +icon_s call_options_mute = { + .type = INDICATOR_IMG_ICON, + .name = MODULE_NAME_MUTE, + .priority = ICON_PRIORITY_MUTE, + .always_top = EINA_TRUE, + .exist_in_view = EINA_FALSE, + .img_obj = {"Call/B03_Call_Mute.png",}, + .obj_exist = EINA_FALSE, + .area = INDICATOR_ICON_AREA_MINICTRL, + .init = register_call_options_mute_module, + .fini = unregister_call_options_mute_module, + .minictrl_control = NULL, /* mctrl_monitor_cb */ +}; + +icon_s call_options_speaker = { + .type = INDICATOR_IMG_ICON, + .name = MODULE_NAME_SPEAKER, + .priority = ICON_PRIORITY_SPEAKER, + .always_top = EINA_TRUE, + .exist_in_view = EINA_FALSE, + .img_obj = {"Call/B03_Call_Speaker_on.png",}, + .obj_exist = EINA_FALSE, + .area = INDICATOR_ICON_AREA_MINICTRL, + .init = register_call_options_speaker_module, + .fini = unregister_call_options_speaker_module, + .minictrl_control = NULL, /* mctrl_monitor_cb */ +}; + +static cm_client_h cm_handle; +static int init_cnt = 0; + +static void mute_status_cb(cm_mute_status_e mute_status, void *user_data) +{ + if (mute_status == CM_MUTE_STATUS_ON) + icon_show(&call_options_mute); + + else if (mute_status == CM_MUTE_STATUS_OFF) + icon_hide(&call_options_mute); +} + +static void audio_status_cb(cm_audio_state_type_e audio_state, void *user_data) +{ + if (audio_state == CM_AUDIO_STATE_SPEAKER_E) + icon_show(&call_options_speaker); + + else + icon_hide(&call_options_speaker); +} + +static int call_manager_init(void) +{ + if (init_cnt == 0) { + int ret = cm_init(&cm_handle); + retvm_if(ret != CM_ERROR_NONE, FAIL, "cm_init failed[%d]: %s", ret, get_error_message(ret)); + } + + init_cnt++; + + return OK; +} + +static int call_manager_deinit(void) +{ + if (init_cnt == 1) { + int ret = cm_deinit(cm_handle); + retvm_if(ret != CM_ERROR_NONE, FAIL, "cm_deinit failed[%d]: %s", ret, get_error_message(ret)); + } + + init_cnt--; + + return OK; +} + +static int register_call_options_mute_module(void *data) +{ + int ret; + + ret = call_manager_init(); + retvm_if(ret == FAIL, FAIL, "call_manager_init[%d]: %s", ret, get_error_message(ret)); + + ret = cm_set_mute_status_cb(cm_handle, mute_status_cb, data); + retvm_if(ret != CM_ERROR_NONE, FAIL, "cm_mute_status_cb failed[%d]: %s", ret, get_error_message(ret)); + + return OK; +} + +static int register_call_options_speaker_module(void *data) +{ + int ret; + + ret = call_manager_init(); + retvm_if(ret == FAIL, FAIL, "call_manager_init[%d]: %s", ret, get_error_message(ret)); + + ret = cm_set_audio_state_changed_cb(cm_handle, audio_status_cb, data); + retvm_if(ret != CM_ERROR_NONE, FAIL, "cm_set_audio_state_changed_cb[%d]: %s", ret, get_error_message(ret)); + + return OK; +} + +static int unregister_call_options_mute_module(void) +{ + int ret; + + ret = cm_unset_mute_status_cb(cm_handle); + if (ret != CM_ERROR_NONE) + _E("cm_unset_mute_status_cb[%d]: %s", ret, get_error_message(ret)); + + ret = call_manager_deinit(); + retvm_if(ret == FAIL, FAIL, "call_manager_deinit[%d]: %s", ret, get_error_message(ret)); + + return OK; +} + +static int unregister_call_options_speaker_module(void) +{ + int ret; + + ret = cm_unset_audio_state_changed_cb(cm_handle); + if (ret != CM_ERROR_NONE) + _E("cm_unset_audio_state_changed_cb[%d]: %s", ret, get_error_message(ret)); + + ret = call_manager_deinit(); + retvm_if(ret == FAIL, FAIL, "call_manager_deinit[%d]: %s", ret, get_error_message(ret)); + + return OK; +}