From: Oleksander Kostenko Date: Thu, 23 Jun 2016 12:10:34 +0000 (+0300) Subject: Minor fix isSimActivate() X-Git-Tag: submit/tizen_dev/20160719.083834~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=58e54f097942739c4d7125df94354409de63fbb3;p=profile%2Fmobile%2Fapps%2Fnative%2Fmessage.git Minor fix isSimActivate() Change-Id: I52f9b4bc11409e4c2b9d11543088b5882c44210b Signed-off-by: Oleksander Kostenko --- diff --git a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp index 1965c41..05051b2 100644 --- a/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp +++ b/src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp @@ -79,28 +79,6 @@ void MsgStoragePrivate::msg_storage_change_cb(msg_handle_t handle, msg_storage_c } } -bool MsgStoragePrivate::isSimActive() const -{ - bool res = false; - telephony_handle_list_s tel_handle_list; - if(telephony_init(&tel_handle_list) == TELEPHONY_ERROR_NONE) - { - if(tel_handle_list.count > 0) - { - telephony_h tel_handle = tel_handle_list.handle[0]; - telephony_network_service_state_e serv_state; - if(telephony_network_get_service_state(tel_handle, &serv_state) == TELEPHONY_ERROR_NONE) - { - res = (serv_state == TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE); - MSG_LOG("serv_state = ", serv_state); - } - } - telephony_deinit(&tel_handle_list); - } - - return res; -} - MsgStoragePrivate::~MsgStoragePrivate() { } @@ -136,13 +114,6 @@ MessageSMSListRef MsgStoragePrivate::getSimMsgList() msg_set_int_value(listCond, MSG_LIST_CONDITION_SIM_INDEX_INT, 1); msg_set_int_value(listCond, MSG_LIST_CONDITION_STORAGE_ID_INT, MSG_STORAGE_SIM); - if(!isSimActive()) - { - MSG_LOG_ERROR("SIM_CARD_IS_NOT_ACTIVE!"); - msg_release_struct(&listCond); - return nullptr; - } - if(msg_get_message_list2(m_ServiceHandle, listCond, &msgList) == 0) { res.reset(new SmsStructListPrivate(true, msgList)); diff --git a/src/Common/MsgEngine/src/private/MsgStoragePrivate.h b/src/Common/MsgEngine/src/private/MsgStoragePrivate.h index 8d05bd5..a21cc13 100644 --- a/src/Common/MsgEngine/src/private/MsgStoragePrivate.h +++ b/src/Common/MsgEngine/src/private/MsgStoragePrivate.h @@ -77,7 +77,6 @@ namespace Msg static void msg_storage_change_cb(msg_handle_t handle, msg_storage_change_type_t storageChangeType, msg_id_list_s *pMsgIdList, void *user_param); MessageSMS *createSms(); - bool isSimActive() const; private: msg_handle_t m_ServiceHandle; diff --git a/src/Common/SystemSettingsManager/inc/SystemSettingsManager.h b/src/Common/SystemSettingsManager/inc/SystemSettingsManager.h index 21833ae..94b8939 100644 --- a/src/Common/SystemSettingsManager/inc/SystemSettingsManager.h +++ b/src/Common/SystemSettingsManager/inc/SystemSettingsManager.h @@ -33,6 +33,7 @@ namespace Msg void addListener(ISystemSettingsManager &l); void removeListener(ISystemSettingsManager&l); bool isSimInserted() const; + bool isSimActive() const; bool isMobileDataEnabled() const; private: diff --git a/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp b/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp index 7c59ae8..c174b7e 100644 --- a/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp +++ b/src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp @@ -73,6 +73,24 @@ bool SystemSettingsManager::isSimInserted() const return res; } +bool SystemSettingsManager::isSimActive() const +{ + bool res = false; + + if(m_TelHandleList.count > 0) + { + telephony_h telHandle = m_TelHandleList.handle[0]; + telephony_network_service_state_e servState; + if(telephony_network_get_service_state(telHandle, &servState) == TELEPHONY_ERROR_NONE) + { + res = (servState == TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE); + MSG_LOG("servState = ", servState); + } + } + + return res; +} + bool SystemSettingsManager::isMobileDataEnabled() const { bool res = false;