summaryrefslogtreecommitdiff
path: root/plugin/sms_plugin
diff options
context:
space:
mode:
authorKeeBum Kim <keebum.kim@samsung.com>2012-08-30 10:17:16 +0900
committerKeeBum Kim <keebum.kim@samsung.com>2012-08-30 10:17:16 +0900
commit7b2aa27342312dd7f574a0e937bcf4a76238a0af (patch)
treecfdfeda84f3edc98e9d105405bc896c237454347 /plugin/sms_plugin
parentdf2d254fd272d0cdcde0235da91f00867c2bb55b (diff)
downloadmsg-service-7b2aa27342312dd7f574a0e937bcf4a76238a0af.tar.gz
msg-service-7b2aa27342312dd7f574a0e937bcf4a76238a0af.tar.bz2
msg-service-7b2aa27342312dd7f574a0e937bcf4a76238a0af.zip
Apply tapi ready vconf.
Diffstat (limited to 'plugin/sms_plugin')
-rwxr-xr-xplugin/sms_plugin/SmsPluginMain.cpp45
1 files changed, 39 insertions, 6 deletions
diff --git a/plugin/sms_plugin/SmsPluginMain.cpp b/plugin/sms_plugin/SmsPluginMain.cpp
index d81dfab..d405b7e 100755
--- a/plugin/sms_plugin/SmsPluginMain.cpp
+++ b/plugin/sms_plugin/SmsPluginMain.cpp
@@ -14,10 +14,13 @@
* limitations under the License.
*/
+#include <errno.h>
+
#include "MsgDebug.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
+#include "MsgMutex.h"
#include "SmsPluginTransport.h"
#include "SmsPluginSimMsg.h"
#include "SmsPluginStorage.h"
@@ -38,9 +41,20 @@ extern "C"
struct tapi_handle *pTapiHandle = NULL;
+Mutex mx;
+CndVar cv;
+
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
+static void MsgTapiInitCB(keynode_t *key, void* data)
+{
+ MSG_DEBUG("MsgTapiInitCB is called.");
+ mx.lock();
+ cv.signal();
+ mx.unlock();
+}
+
msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
{
if (pPluginHandle == NULL)
@@ -93,18 +107,28 @@ msg_error_t SmsPlgInitialize()
{
MSG_BEGIN();
- TapiHandle *ph;
+ MSG_DEBUG("set MSG_SIM_CHANGED to MSG_SIM_STATUS_NOT_FOUND.");
+ MsgSettingSetInt(MSG_SIM_CHANGED, MSG_SIM_STATUS_NOT_FOUND);
- ph = tel_init(NULL);
+ bool bReady;
+ MsgSettingGetBool(VCONFKEY_TELEPHONY_READY, &bReady);
+ MSG_DEBUG("Get VCONFKEY_TELEPHONY_READY [%d].", bReady);
- if (!ph)
- return MSG_ERR_PLUGIN_TAPIINIT;
+ int ret = 0;
- pTapiHandle = ph;
+ if(!bReady) {
+ MsgSettingRegVconfCBCommon(VCONFKEY_TELEPHONY_READY, MsgTapiInitCB);
+ mx.lock();
+ ret = cv.timedwait(mx.pMutex(), 90);
+ mx.unlock();
+ }
try
{
- SmsPluginCallback::instance()->registerEvent();
+ if (ret != ETIMEDOUT) {
+ pTapiHandle = tel_init(NULL);
+ SmsPluginCallback::instance()->registerEvent();
+ }
}
catch (MsgException& e)
{
@@ -127,6 +151,9 @@ msg_error_t SmsPlgFinalize()
{
MSG_BEGIN();
+ if (!pTapiHandle)
+ return MSG_ERR_PLUGIN_TAPIINIT;
+
SmsPluginCallback::instance()->deRegisterEvent();
tel_deinit(pTapiHandle);
@@ -153,6 +180,9 @@ msg_error_t SmsPlgCheckSimStatus(MSG_SIM_STATUS_T *pStatus)
{
MSG_BEGIN();
+ if (!pTapiHandle)
+ return MSG_ERR_PLUGIN_TAPIINIT;
+
int tryNum = 0, tapiRet = TAPI_API_SUCCESS;
TelSimCardStatus_t status = TAPI_SIM_STATUS_CARD_ERROR;
@@ -246,6 +276,9 @@ msg_error_t SmsPlgCheckDeviceStatus()
{
MSG_BEGIN();
+ if (!pTapiHandle)
+ return MSG_ERR_PLUGIN_TAPIINIT;
+
int status = 0, tapiRet = TAPI_API_SUCCESS;
tapiRet = tel_check_sms_device_status(pTapiHandle, &status);