{
msg_error_t err = MSG_SUCCESS;
+ try
+ {
+ // plugin manager initialize
+ MsgPluginManager::instance()->initialize();
+ }
+ catch (MsgException& e)
+ {
+ MSG_FATAL("%s", e.what());
+ }
+ catch (exception& e)
+ {
+ MSG_FATAL("%s", e.what());
+ }
+
MSG_MAIN_TYPE_T mainType = MSG_SMS_TYPE;
MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType);
// Regist vconf CB.
MsgSettingRegVconfCB();
- try
- {
- // plugin manager initialize
- MsgPluginManager::instance()->initialize();
- }
- catch (MsgException& e)
- {
- MSG_FATAL("%s", e.what());
- }
- catch (exception& e)
- {
- MSG_FATAL("%s", e.what());
- }
-
pthread_t startThreadId;
// start transaction manager
#endif
+typedef void (*_vconf_change_cb)(keynode_t *key, void* data);
+
/*==================================================================================================
FUNCTION PROTOTYPES
==================================================================================================*/
void MsgSettingRegVconfCB();
void MsgSettingRemoveVconfCB();
+void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb);
#endif // MSG_GCONF_WRAPPER_H
* 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"
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)
{
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)
{
{
MSG_BEGIN();
+ if (!pTapiHandle)
+ return MSG_ERR_PLUGIN_TAPIINIT;
+
SmsPluginCallback::instance()->deRegisterEvent();
tel_deinit(pTapiHandle);
{
MSG_BEGIN();
+ if (!pTapiHandle)
+ return MSG_ERR_PLUGIN_TAPIINIT;
+
int tryNum = 0, tapiRet = TAPI_API_SUCCESS;
TelSimCardStatus_t status = TAPI_SIM_STATUS_CARD_ERROR;
{
MSG_BEGIN();
+ if (!pTapiHandle)
+ return MSG_ERR_PLUGIN_TAPIINIT;
+
int status = 0, tapiRet = TAPI_API_SUCCESS;
tapiRet = tel_check_sms_device_status(pTapiHandle, &status);
MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL);
}
}
+
+void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
+{
+ if (vconf_notify_key_changed(pKey, pCb, NULL) < 0) {
+ MSG_DEBUG("Fail to regist vconf CB with [%s]", pKey);
+ } else {
+ MSG_DEBUG("Success to regist vconf CB with [%s]", pKey);
+ }
+}