Update change log and spec for wrt-plugins-tizen_0.4.48-1
authorDongjin Choi <milkelf.choi@samsung.com>
Sat, 29 Jun 2013 14:14:56 +0000 (23:14 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Sat, 29 Jun 2013 14:14:56 +0000 (23:14 +0900)
[model] REDWOOD
[binary_type] PDA
[customer] OPEN

[Issue] N/A
[Problem] RSA TC fail
[Cause] appcontrol launch fail.
[Solution] add try-catch block.

[Systeminfo] Remove sim capi, use tapi api

[Issue] N/A
[Problem] If object is finalized before completing async function, it makes crash
[Cause] It calls async function with this pointer. If the this is finalized and callback is called, it can access the pointer that is free.
[Solution] It will protect thisobject until completing async function

[NetworkbearerSelection] Fix TCT Manual tc

[Issue] N/A
[Problem] MMS support check API changed
[Cause] MMS support check API changed
[Solution] MMS support check API changed

[Issue#] N/A
[Problem] Show too many logs
[Cause] hasProperty and getProperty shows log
[Solution] Removed useless logs

[Issue#] N_SE-43294
[problem] web process crashed when getTitle function in Notification module.
[Cause] don't check invalid value.
[Solution] check invalid value.

[Issue] N/A
[Problem] message release bug fix for listener
[Cause] message release bug fix for listener
[Solution] message release bug fix for listener

[Systeminfo] Chanage get duid value code, Change system-info capi

[Issue] N/A
[Problem] appcontrol launch fail when trying to launch at the early of boot sequence.
[Cause] appcontrol launch fail.
[Solution] make possible to continue event despite app launch fail.

[WebSetting] Connect with WRT IPC for async call to Web UI process to remove cookies and setthe user agent string.

[team] WebAPI
[request] N/A
[horizontal_expansion] N/A

32 files changed:
packaging/wrt-plugins-tizen.spec
src/DataControl/SqlDataControlConsumer.cpp
src/Messaging/EventMessageReceived.cpp
src/Messaging/EventMessageReceived.h
src/Messaging/JSMessagingStorage.cpp
src/Messaging/MessageFactory.cpp
src/Messaging/Messaging.cpp
src/Messaging/MessagingListener.cpp
src/Messaging/MessagingServiceManager.cpp
src/NFC/JSNFCAdapter.cpp [changed mode: 0644->0755]
src/NFC/JSNFCTag.cpp [changed mode: 0644->0755]
src/NFC/JSNFCTarget.cpp [changed mode: 0644->0755]
src/NetworkBearerSelection/NetworkBearerSelection.cpp
src/NetworkBearerSelection/NetworkBearerSelection.h
src/NetworkBearerSelection/NetworkBearerSelectionResponseDispatcher.cpp [changed mode: 0644->0755]
src/Notification/StatusNotification.cpp
src/Systeminfo/BaseProperties.h
src/Systeminfo/EventGetSysteminfo.cpp [changed mode: 0644->0755]
src/Systeminfo/EventGetSysteminfo.h
src/Systeminfo/EventWatchSysteminfo.cpp
src/Systeminfo/EventWatchSysteminfo.h
src/Systeminfo/JSDeviceCapabilitiesInfo.cpp
src/Systeminfo/Systeminfo.cpp
src/Systeminfo/Systeminfo.h
src/Systeminfo/SysteminfoPropertyInfo.h
src/Tizen/JSTizen.cpp
src/WebSetting/CMakeLists.txt
src/WebSetting/JSWebSettingManager.cpp
src/WebSetting/WebSettingManager.cpp
src/WebSetting/WebSettingManager.h
src/WebSetting/plugin_config.cpp [changed mode: 0644->0755]
src/WebSetting/plugin_initializer.cpp

index 654276c..61634d2 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.47
-Release:    0
+Version:    0.4.48
+Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
 Source0:    %{name}-%{version}.tar.gz
@@ -61,6 +61,7 @@ BuildRequires:  pkgconfig(notification)
 BuildRequires:  pkgconfig(message-port)
 BuildRequires:  pkgconfig(sync-agent)
 BuildRequires:  pkgconfig(security-server)
+BuildRequires:  pkgconfig(wrt-plugins-ipc-message)
 BuildRequires:  expat-devel
 BuildRequires:  cmake
 BuildRequires:  gettext-devel
index f23c304..0e45b08 100644 (file)
@@ -701,24 +701,34 @@ void SQLDataControlConsumer::handlePendingEvent(const EventInsertPtr& event)
 {
        LoggerD("OK");
        WrtDeviceApis::Commons::EventRequestReceiver<EventInsert>::ManualAnswer(event); 
+       try {
+               CommonPendingEvent* userData = (CommonPendingEvent*)DataControlAsyncCallbackManagerSingleton::Instance().getRemainingSQLOperation();
 
-       CommonPendingEvent* userData = (CommonPendingEvent*)DataControlAsyncCallbackManagerSingleton::Instance().getRemainingSQLOperation();
-
-       if (userData)
+               if (userData)
+               {
+                       SendAppControlLaunchToProvider(userData);
+               }
+       }
+       catch (const WrtDeviceApis::Commons::Exception& ex) 
        {
-               SendAppControlLaunchToProvider(userData);
+               LoggerE("Exception: " << ex.GetMessage());
        }
 
 }
 void SQLDataControlConsumer::handlePendingEvent(const EventDeletePtr& event)
 {
        WrtDeviceApis::Commons::EventRequestReceiver<EventDelete>::ManualAnswer(event); 
+       try {
+               CommonPendingEvent* userData = (CommonPendingEvent*)DataControlAsyncCallbackManagerSingleton::Instance().getRemainingSQLOperation();
 
-       CommonPendingEvent* userData = (CommonPendingEvent*)DataControlAsyncCallbackManagerSingleton::Instance().getRemainingSQLOperation();
-
-       if (userData)
+               if (userData)
+               {
+                       SendAppControlLaunchToProvider(userData);
+               }
+       }
+       catch (const WrtDeviceApis::Commons::Exception& ex) 
        {
-               SendAppControlLaunchToProvider(userData);
+               LoggerE("Exception: " << ex.GetMessage());
        }
 
 
@@ -726,12 +736,17 @@ void SQLDataControlConsumer::handlePendingEvent(const EventDeletePtr& event)
 void SQLDataControlConsumer::handlePendingEvent(const EventSelectPtr& event)
 {
        WrtDeviceApis::Commons::EventRequestReceiver<EventSelect>::ManualAnswer(event);
+       try {
+               CommonPendingEvent* userData = (CommonPendingEvent*)DataControlAsyncCallbackManagerSingleton::Instance().getRemainingSQLOperation();
 
-       CommonPendingEvent* userData = (CommonPendingEvent*)DataControlAsyncCallbackManagerSingleton::Instance().getRemainingSQLOperation();
-
-       if (userData)
+               if (userData)
+               {
+                       SendAppControlLaunchToProvider(userData);
+               }
+       }
+       catch (const WrtDeviceApis::Commons::Exception& ex) 
        {
-               SendAppControlLaunchToProvider(userData);
+               LoggerE("Exception: " << ex.GetMessage());
        }
 
 }
@@ -739,12 +754,17 @@ void SQLDataControlConsumer::handlePendingEvent(const EventSelectPtr& event)
 void SQLDataControlConsumer::handlePendingEvent(const EventUpdatePtr& event)
 {
        WrtDeviceApis::Commons::EventRequestReceiver<EventUpdate>::ManualAnswer(event); 
+       try {
+               CommonPendingEvent* userData = (CommonPendingEvent*)DataControlAsyncCallbackManagerSingleton::Instance().getRemainingSQLOperation();
 
-       CommonPendingEvent* userData = (CommonPendingEvent*)DataControlAsyncCallbackManagerSingleton::Instance().getRemainingSQLOperation();
-
-       if (userData)
+               if (userData)
+               {
+                       SendAppControlLaunchToProvider(userData);
+               }
+       }
+       catch (const WrtDeviceApis::Commons::Exception& ex) 
        {
-               SendAppControlLaunchToProvider(userData);
+               LoggerE("Exception: " << ex.GetMessage());
        }
 
 }
@@ -1073,13 +1093,12 @@ void SQLDataControlConsumer::OnRequestReceived(const EventInsertPtr& event)
                delete rowData;
                
                EventInsertPendingEvent* pendingEvent = new EventInsertPendingEvent((void*)this, event);
-               event->switchToManualAnswer();
                
                if (DataControlAsyncCallbackManagerSingleton::Instance().checkDoSQLOperation())
                {
                        SendAppControlLaunchToProvider(pendingEvent);
                }
-
+               event->switchToManualAnswer();
                DataControlAsyncCallbackManagerSingleton::Instance().addSQLUserData(reqIdStr, (void*)pendingEvent);
 
 
@@ -1109,12 +1128,12 @@ void SQLDataControlConsumer::OnRequestReceived(const EventDeletePtr& event)
                }
 
                EventDeletePendingEvent* pendingEvent = new EventDeletePendingEvent(this, event);
-               event->switchToManualAnswer();
                
                if (DataControlAsyncCallbackManagerSingleton::Instance().checkDoSQLOperation())
                {
                        SendAppControlLaunchToProvider(pendingEvent);
                }
+               event->switchToManualAnswer();
                DataControlAsyncCallbackManagerSingleton::Instance().addSQLUserData(reqIdStr, (void*)pendingEvent);
        }       
        
@@ -1145,13 +1164,13 @@ void SQLDataControlConsumer::OnRequestReceived(const EventSelectPtr& event)
                }
                
                EventSelectPendingEvent* pendingEvent = new EventSelectPendingEvent(this, event);
-               event->switchToManualAnswer();
 
                if (DataControlAsyncCallbackManagerSingleton::Instance().checkDoSQLOperation())
                {
                        SendAppControlLaunchToProvider(pendingEvent);
                }
-
+               
+               event->switchToManualAnswer();
                DataControlAsyncCallbackManagerSingleton::Instance().addSQLUserData(reqIdStr, (void*)pendingEvent);
        }
        catch (const WrtDeviceApis::Commons::Exception& ex) 
@@ -1189,13 +1208,12 @@ void SQLDataControlConsumer::OnRequestReceived(const EventUpdatePtr& event)
                delete rowData;
 
                EventUpdatePendingEvent* pendingEvent = new EventUpdatePendingEvent(this, event);
-               event->switchToManualAnswer();
                
                if (DataControlAsyncCallbackManagerSingleton::Instance().checkDoSQLOperation())
                {
                        SendAppControlLaunchToProvider(pendingEvent);
                }
-
+               event->switchToManualAnswer();
                DataControlAsyncCallbackManagerSingleton::Instance().addSQLUserData(ssReqId.str(), (void*)pendingEvent);
 
        }
index 19631b4..406fa01 100755 (executable)
@@ -56,7 +56,17 @@ void EventMessageReceived::setMessageFolder(const IMessageFolderPtr& messagefold
 
 void EventMessageReceived::setMsg_Event_Type(Msg_EventType state)
 {
-       m_msg_event_type = state;
+    m_msg_event_type = state;
+}
+
+void EventMessageReceived::setMsg_Type(MessageType type)
+{
+    m_msg_type = type;
+}
+
+void EventMessageReceived::setAccount_Id(int account_id)
+{
+    m_account_id = account_id;
 }
 
 } // Messaging
index 10a6404..5dc843f 100755 (executable)
@@ -53,11 +53,19 @@ class EventMessageReceived : public WrtDeviceApis::Commons::ListenerEvent<
     Msg_EventType getMsg_Event_Type() {   return m_msg_event_type;}
 
 
+    void setMsg_Type(MessageType state);
+    MessageType getMsg_Type() {        return m_msg_type;}
+
+    void setAccount_Id(int account_id);
+    int getAccount_Id() { return m_account_id;}
+
   private:
     IConversationPtr m_conversation;
     IMessagePtr m_message;
     IMessageFolderPtr m_messagefolder; 
     Msg_EventType m_msg_event_type;
+    MessageType m_msg_type;
+    int m_account_id;
        
 };
 
index 736b60d..6ea7dd9 100644 (file)
@@ -1114,6 +1114,7 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte
         // argu 1. Messages Change Callback ( mandatory )
         functionResult = converter->toMessageMultifunctions(validator.toJSValueRef(0), CONVERSATIONS_MULTI_FUNCTION);
         funtionIndex = functionResult.functionIndex;
+        LoggerE("funtionIndex " << funtionIndex);
         if(funtionIndex < 0)
         {
             throw DeviceAPI::Common::TypeMismatchException("funtionIndex is not valid.");
@@ -1152,7 +1153,6 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte
             }
         }
 
-
         if(callbackManager)
         {
             callbackManager->setOnSuccess(onSuccessForCbm);
index fad4dac..95f9dd6 100644 (file)
@@ -131,13 +131,9 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType,
         retVal = new Mms(idStr, msg_data);
         break;
 
-    case EMPTY_MESSAGE:
-        LoggerD("creation empty message with data");
-        retVal = new EmptyMessage(idStr);
-        break;
-               
     default:
         LoggerE("creation error, unknown message type");
+        ThrowMsg(InvalidArgumentException, "creation error, unknown message types");
         break;
     }
     LoggerI("end");
index 57d943e..7625445 100644 (file)
@@ -1324,6 +1324,9 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event)
                                }
                        }
 
+                       jsEvent->setMsg_Type(EMAIL);
+                       jsEvent->setAccount_Id(account_id);
+
                        if ((mail_id > 0) && (NOTI_MAIL_ADD == status)) 
                        { // TODO also RECEIVE_THREAD_ITEM?
                                LoggerI("Email received. mail_id: " << mail_id);
@@ -1540,6 +1543,8 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
     LoggerD("ENTER");
 
     msg_error_t err = MSG_SUCCESS;
+    msg_struct_t msg = NULL;
+    msg_struct_t sendOpt = NULL;
 
     if(storageChangeType == MSG_STORAGE_CHANGE_CONTACT)
     {
@@ -1567,6 +1572,7 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                     event->setMessage(message);
                     event->setConversation(conversation);
                     event->setMsg_Event_Type(EventMessageReceived::MSG_DELETED);
+                    event->setMsg_Type(EMPTY_MESSAGE);
 
                     if(this_->m_onMessageReceived.size() > 0){
                         this_->m_onMessageReceived.emit(event);
@@ -1577,8 +1583,6 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                 }
                 else
                 {
-                    msg_struct_t msg = NULL;
-                    msg_struct_t sendOpt = NULL;
                     msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
                     sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT);
 
@@ -1613,6 +1617,7 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                             EventMessageReceivedPtr event(new EventMessageReceived());
                             event->setMessage(message);
                             event->setConversation(conversation);
+                            event->setMsg_Type(SMS);
 
                             if(this_->m_onMessageReceived.size() > 0){
                                 if(storageChangeType == MSG_STORAGE_CHANGE_INSERT)
@@ -1668,6 +1673,7 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                             EventMessageReceivedPtr event(new EventMessageReceived());
                             event->setMessage(message);
                             event->setConversation(conversation);
+                            event->setMsg_Type(MMS);
 
                             if(this_->m_onMessageReceived.size() > 0){
                                 if(storageChangeType == MSG_STORAGE_CHANGE_INSERT)
@@ -1713,22 +1719,53 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                             LoggerE("Ignore this mms, this is mms noti.");
                         }
                     }
-                                       
-                    if(msg != NULL)
+                    if(sendOpt != NULL)
                     {
-                          LoggerE("release msg : " << msg);
-                    msg_release_struct(&msg);
+                        LoggerE("release sendOpt");
+                        msg_release_struct(&sendOpt);
                     }
-                    msg_release_struct(&sendOpt);                                      
                 }
             }
         }
         Catch(WrtDeviceApis::Commons::ConversionException) {
             LoggerE("Couldn't convert message to sms.");
+            if(msg != NULL)
+            {
+                LoggerE("release msg : " << msg);
+                msg_release_struct(&msg);
+            }
+            if(sendOpt != NULL)
+            {
+                LoggerE("release sendOpt");
+                msg_release_struct(&sendOpt);
+            }
         }
         Catch(WrtDeviceApis::Commons::PlatformException) {
             LoggerE("onMessageStorageChanged platform exception");
-        }              
+            if(msg != NULL)
+            {
+                LoggerE("release msg : " << msg);
+                msg_release_struct(&msg);
+            }
+            if(sendOpt != NULL)
+            {
+                LoggerE("release sendOpt");
+                msg_release_struct(&sendOpt);
+            }
+        }
+        Catch(WrtDeviceApis::Commons::Exception) {
+            LoggerE("onMessageStorageChanged Exception");
+            if(msg != NULL)
+            {
+                LoggerE("release msg : " << msg);
+                msg_release_struct(&msg);
+            }
+            if(sendOpt != NULL)
+            {
+                LoggerE("release sendOpt");
+                msg_release_struct(&sendOpt);
+            }
+        }
     }
 }
 
index fdf73df..cb7d81e 100644 (file)
@@ -559,9 +559,33 @@ void MessagingListener::onAnswerReceived(
                DPL::DynamicPointerCast<EventOnMessagingStorageChangesPrivateData>(event->getPrivateData());
        WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr defaultCbm = multiCallbacks->getMessagesAdded();
 
-    JSContextRef context = defaultCbm->getContext();
+       JSContextRef context = defaultCbm->getContext();
        ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context);
 
+       LoggerE("multiCallbacks->getType(): " << multiCallbacks->getType());
+       LoggerE("event->getMsg_Type(): " << event->getMsg_Type());
+       LoggerE("multiCallbacks->getMsg_Type(): " << multiCallbacks->getIndex());
+       LoggerE("event->getAccount_Id(): " << event->getAccount_Id());
+
+       if(multiCallbacks->getType() != event->getMsg_Type())
+       {
+               if(event->getMsg_Type() == EMAIL)
+               {
+                       LoggerE("Type is different. skip!!!");
+                       return;
+               }
+               if((multiCallbacks->getType() != EMAIL) && (event->getMsg_Type() != EMPTY_MESSAGE))
+               {
+                       LoggerE("Type is different. skip!!!");
+                       return;
+               }
+       }
+
+       if((multiCallbacks->getType() == EMAIL) && (multiCallbacks->getIndex() != event->getAccount_Id()))
+       {
+               LoggerE("accountId is different. skip!!!");
+               return;
+       }
 
        Try
        {
@@ -726,7 +750,7 @@ long MessagingListener::addIncomingMsgCallback(const WrtDeviceApis::CommonsJavaS
 {
        IncomingMsgCB* callbacks = NULL;
        long handle = 0;
-       
+
        switch(funtionIndex)
        {
                case MESSAGES_MULTI_FUNCTION:
index 27fe93e..9a8725f 100644 (file)
@@ -95,7 +95,7 @@ void MessagingServiceManager::getMessagingServiceManager(const EventGetMessaging
        if( event->getMessagingServiceType() == MMS)
        {
                bool isSupported = false;
-               if(system_info_get_value_bool(SYSTEM_INFO_KEY_MMS_SUPPORTED, &isSupported) != SYSTEM_INFO_ERROR_NONE) {
+               if(system_info_get_platform_bool("tizen.org/feature/network.telephony.mms", &isSupported) != SYSTEM_INFO_ERROR_NONE) {
                        LoggerE("Can't know whether mms is supported or not");
                }
                LoggerD("isSupported " << isSupported);
old mode 100644 (file)
new mode 100755 (executable)
index 9e4dd96..5805a85
@@ -438,6 +438,7 @@ JSValueRef JSNFCAdapter::setPowered (JSContextRef context, JSObjectRef object,
                EventNFCChangedSetPoweredPtr event(new EventNFCChangedSetPowered(state));
                event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
                event->setForAsynchronousCall(&NFCStaticController::getInstance());
+               callbackManager->setObject(thisObject);
                nfcAdapter->setPowered(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
old mode 100644 (file)
new mode 100755 (executable)
index 571361c..c96c8e4
@@ -226,7 +226,7 @@ JSValueRef JSNFCTag::readNDEF(JSContextRef context,
                EventTagActionReadPtr event(new EventTagActionRead());
                event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
                event->setForAsynchronousCall(&NFCResponseDispatcher::getInstance());
-
+               callbackManager->setObject(thisObject);
                nfcTag->readNdef(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
@@ -297,6 +297,7 @@ JSValueRef JSNFCTag::writeNDEF(JSContextRef context,
                event->writeNdef(messageHandle);
                event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager));
                event->setForAsynchronousCall(&NFCResponseDispatcher::getInstance());
+               callbackManager->setObject(thisObject);
                nfcTag->writeNdef(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
@@ -370,6 +371,7 @@ JSValueRef JSNFCTag::transceive(JSContextRef context,
                event->transceive(data);
                event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
                event->setForAsynchronousCall(&NFCResponseDispatcher::getInstance());
+               callbackManager->setObject(thisObject);
                nfcTag->transceive(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
old mode 100644 (file)
new mode 100755 (executable)
index 0cdb586..01ba2a7
@@ -310,6 +310,7 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context,
 
                void *messageHandle = convert.copiedMessage(ndefMessageObj);
                EventTargetActionSendPtr event(new EventTargetActionSend(messageHandle));
+               callbackManager->setObject(thisObject);
                event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager));
                event->setForAsynchronousCall(&NFCResponseDispatcher::getInstance());
                nfcTarget->sendNDEF(event);
index 9d4fa1a..bbb4c9a 100755 (executable)
@@ -46,9 +46,12 @@ static void connection_state_changed_callback(connection_profile_state_e state,
         EventNetworkBearerSelectionPtr event = pendingEvent->getEvent();
 
         if (state == CONNECTION_PROFILE_STATE_DISCONNECTED) {
-            networkBearerSelection->makeCallback(event, CONNECTION_STATE_DISCONNECTED);
+            networkBearerSelection->makeRequestCallback(event, CONNECTION_STATE_DISCONNECTED);
+            delete pendingEvent;
+            pendingEvent = NULL;
+            user_data = NULL;
         } else if (state == CONNECTION_PROFILE_STATE_CONNECTED) {
-            networkBearerSelection->makeCallback(event, CONNECTION_STATE_CONNECTED);
+            networkBearerSelection->makeRequestCallback(event, CONNECTION_STATE_CONNECTED);
         }
     
         user_data = NULL;
@@ -76,7 +79,7 @@ static void connection_opened_callback(connection_error_e result, void* user_dat
 
 static void connection_closed_callback(connection_error_e result, void* user_data)
 {
-    LoggerD("enter");
+    LoggerD("result : " << result);
        if (result ==  CONNECTION_ERROR_NONE) {
                LoggerD("Connection close Succeeded");
         if (user_data != NULL) {
@@ -90,6 +93,19 @@ static void connection_closed_callback(connection_error_e result, void* user_dat
             pendingEvent = NULL;
             user_data = NULL;
         }
+    } else if (result == CONNECTION_ERROR_OPERATION_FAILED) {
+               LoggerD("Connection close Failed");
+        if (user_data != NULL) {
+            NewtorkBearerReleasePendingEvent *pendingEvent = (NewtorkBearerReleasePendingEvent *)user_data;
+            NetworkBearerSelection *networkBearerSelection = (NetworkBearerSelection *)pendingEvent->getThisObject();
+            EventNetworkBearerReleasePtr event = pendingEvent->getEvent();
+
+            networkBearerSelection->makeReleaseCallback(event);
+
+            delete pendingEvent;
+            pendingEvent = NULL;
+            user_data = NULL;
+        }
     }
 }
 
@@ -170,13 +186,13 @@ void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerSelection
     int ret = connection_get_profile_iterator(m_connectionHandle, CONNECTION_ITERATOR_TYPE_REGISTERED, &profileIter);
        if (ret != CONNECTION_ERROR_NONE) {
         LoggerD("Fail to get profile iterator");
-        makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+        makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
         return;
     }
     while (connection_profile_iterator_has_next(profileIter)) {
         if (connection_profile_iterator_next(profileIter, &m_profileHandle) != CONNECTION_ERROR_NONE) {
             LoggerD("Fail to get profile handle");
-            makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+            makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
             return;
        }
     }
@@ -185,7 +201,7 @@ void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerSelection
 
     if (connection_open_profile(m_connectionHandle, m_profileHandle, connection_opened_callback, pendingEvent) != CONNECTION_ERROR_NONE) {
         LoggerD("Connection open Failed");
-        makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+        makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
         delete pendingEvent;
         pendingEvent = NULL;
     }
@@ -195,6 +211,11 @@ void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerReleasePt
 {
     LoggerD("enter");
     if (event->getDomainName().compare(m_domainName) == 0) {
+        if (!m_profileHandle) {
+            event->setExceptionCode(ExceptionCodes::AlreadyInUseException);
+            return;
+        }
+        
         event->switchToManualAnswer();
 
         if (connection_profile_unset_state_changed_cb(m_profileHandle) != CONNECTION_ERROR_NONE) {
@@ -222,7 +243,7 @@ void NetworkBearerSelection::reLaunchConnection(const EventNetworkBearerSelectio
 
     if (connection_profile_unset_state_changed_cb(m_profileHandle) != CONNECTION_ERROR_NONE) {
         LoggerD("unset callback is failed");
-        makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+        makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
         return;
     }
 
@@ -230,7 +251,7 @@ void NetworkBearerSelection::reLaunchConnection(const EventNetworkBearerSelectio
 
     if (connection_close_profile(m_connectionHandle, m_profileHandle, connection_removed_callback, pendingEvent) != CONNECTION_ERROR_NONE) {
         LoggerD("connection close failed");
-        makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+        makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
         delete pendingEvent;
         pendingEvent = NULL;
     }
@@ -246,13 +267,13 @@ void NetworkBearerSelection::removeStateChangeListener(const EventNetworkBearerS
     int ret = connection_get_profile_iterator(m_connectionHandle, CONNECTION_ITERATOR_TYPE_REGISTERED, &profileIter);
     if (ret != CONNECTION_ERROR_NONE) {
         LoggerD("Fail to get profile iterator");
-        makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+        makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
         return;
     }
     while (connection_profile_iterator_has_next(profileIter)) {
         if (connection_profile_iterator_next(profileIter, &m_profileHandle) != CONNECTION_ERROR_NONE) {
             LoggerD("Fail to get profile handle");
-            makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+            makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
             return;
         }
     }
@@ -261,7 +282,7 @@ void NetworkBearerSelection::removeStateChangeListener(const EventNetworkBearerS
 
     if (connection_open_profile(m_connectionHandle, m_profileHandle, connection_opened_callback, pendingEvent) != CONNECTION_ERROR_NONE) {
         LoggerD("Connection open Failed");
-        makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+        makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
         delete pendingEvent;
         pendingEvent = NULL;
     }
@@ -276,7 +297,7 @@ void NetworkBearerSelection::registStateChangeListener(const EventNetworkBearerS
 
        if (connection_profile_get_network_interface_name(m_profileHandle, &interfaceName) != CONNECTION_ERROR_NONE) {
         LoggerD("Fail to get interface name!");
-        makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+        makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
     }
        else {
         LoggerD("Interface name : " << interfaceName);
@@ -286,11 +307,11 @@ void NetworkBearerSelection::registStateChangeListener(const EventNetworkBearerS
 
     if(!host_entry) {
         LoggerD("gethostbyname is failed");
-        makeCallback(event, CONNECTION_STATE_INVALID_VALUES_ERROR);
+        makeRequestCallback(event, CONNECTION_STATE_INVALID_VALUES_ERROR);
 
         if (connection_close_profile(m_connectionHandle, m_profileHandle, connection_closed_callback2, NULL) != CONNECTION_ERROR_NONE) {
             LoggerD("connection close failed");
-            makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
+            makeRequestCallback(event, CONNECTION_STATE_PLATFORM_ERROR);
         }
         m_profileHandle = NULL;
         return;
@@ -317,7 +338,7 @@ void NetworkBearerSelection::deregistStateChangeListener(const EventNetworkBeare
        EventRequestReceiver<EventNetworkBearerRelease>::ManualAnswer(event);         
 }
 
-void NetworkBearerSelection::makeCallback(const EventNetworkBearerSelectionPtr &event, connectionStateType state)
+void NetworkBearerSelection::makeRequestCallback(const EventNetworkBearerSelectionPtr &event, connectionStateType state)
 {
     LoggerD("state : " << state);
     OnNetworkBearerSelectionStateChangedEmitterPtr emitter = event->getEmitter();
@@ -334,12 +355,21 @@ void NetworkBearerSelection::makeCallback(const EventNetworkBearerSelectionPtr &
         listener->setExceptionCode(ExceptionCodes::PlatformException);
     } else if (state == CONNECTION_STATE_DISCONNECTED) {
         m_connectionState = NETWORK_DISCONNECTED;
+        if (connection_profile_unset_state_changed_cb(m_profileHandle) != CONNECTION_ERROR_NONE) {
+            LoggerD("unset callback is failed");
+        }
+        m_profileHandle = NULL;
     } else if (state == CONNECTION_STATE_CONNECTED) {
         m_connectionState = NETWORK_CONNECTED;
     }
     emitter->emit(listener);
 }
 
+void NetworkBearerSelection::makeReleaseCallback(const EventNetworkBearerReleasePtr &event)
+{
+    event->setExceptionCode(ExceptionCodes::AlreadyInUseException);
+}
+
 bool NetworkBearerSelection::checkProfileHandle()
 {
     if(m_profileHandle == NULL) {
index 40ae3fa..2da8e56 100755 (executable)
@@ -55,12 +55,13 @@ class NetworkBearerSelection : public INetworkBearerSelection
     void removeStateChangeListener(const EventNetworkBearerSelectionPtr &event);
     void registStateChangeListener(const EventNetworkBearerSelectionPtr &event);
     void deregistStateChangeListener(const EventNetworkBearerReleasePtr &event);    
-    void makeCallback(const EventNetworkBearerSelectionPtr &event, const connectionStateType state);
+    void makeRequestCallback(const EventNetworkBearerSelectionPtr &event, const connectionStateType state);
+    void makeReleaseCallback(const EventNetworkBearerReleasePtr &event);
     bool checkProfileHandle();
 
   protected:
     virtual void OnRequestReceived(const EventNetworkBearerSelectionPtr &event);
-    virtual void OnRequestReceived(const EventNetworkBearerReleasePtr &event);    
+    virtual void OnRequestReceived(const EventNetworkBearerReleasePtr &event);
 
   private:
     connection_h m_connectionHandle;
old mode 100644 (file)
new mode 100755 (executable)
index 0634e5d..9d55e36
@@ -79,6 +79,9 @@ void NetworkBearerSelectionResponseDispatcher::OnAnswerReceived(const EventNetwo
                case ExceptionCodes::ConversionException:
                        error = JSWebAPIErrorFactory::makeErrorObject(gContext, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong argument");
                        break;
+        case ExceptionCodes::AlreadyInUseException:
+                       error = JSWebAPIErrorFactory::makeErrorObject(gContext, JSWebAPIErrorFactory::INVALID_STATE_ERROR, "Connection is disconnected.");
+                       break;
                default:
                        error = JSWebAPIErrorFactory::makeErrorObject(gContext, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown error");
                        break;
index 9ba6cbe..86249e7 100755 (executable)
@@ -456,7 +456,13 @@ std::string StatusNotification::getTitle()
                        throw UnknownException("get notification title error");
                }
 
-               std::string notiTitle(title);
+               std::string notiTitle;
+               if (title)
+               {               
+                       notiTitle = title;
+                       LoggerI(" get title : " << title);
+               }
+
                return notiTitle;       
        }
        else
@@ -577,8 +583,12 @@ std::string StatusNotification::getIconPath()
                        throw UnknownException("get notification icon path error");
                }
 
-               std::string notiIconPath(iconPath);
-               LoggerI("icon Path = " << iconPath);
+               std::string notiIconPath;
+               if (iconPath)
+               {
+                       notiIconPath = iconPath;
+                       LoggerI("icon Path = " << iconPath);
+               }
                
                //if icon path invalid, return empty string.
                if ( notiIconPath.find(DEFAULT_ICON_PATH,0) == std::string::npos)
@@ -630,7 +640,7 @@ std::string StatusNotification::getSoundPath()
                }
 
                LoggerI(" sound type = " << type << " path = " << soundPath);
-               if ( type == NOTIFICATION_SOUND_TYPE_USER_DATA )
+               if ( type == NOTIFICATION_SOUND_TYPE_USER_DATA  && soundPath)
                {
                        LoggerI("soundPath = " << soundPath);
                        return std::string(soundPath); 
index ce039df..1f20876 100755 (executable)
@@ -69,7 +69,7 @@ class BaseProperty
     {
     }
 
-    virtual JSValueRef getValue(JSContextRef context, void* handle) const = 0;
+    virtual JSValueRef getValue(JSContextRef context, void* handle, void* tapiHandle) const = 0;
     virtual const char* getProperty() const = 0;
     virtual const int getWatchType() const = 0;    
 };
old mode 100644 (file)
new mode 100755 (executable)
index e302b9d..f6dd721
@@ -27,17 +27,89 @@ namespace Systeminfo {
 
 EventGetSysteminfo::EventGetSysteminfo()
 {
+    m_simValueCnt = 0;
 }
 
 EventGetSysteminfo::~EventGetSysteminfo()
 {
 }
 
+void EventGetSysteminfo::setSimState(char* state)
+{
+    m_simProperty.state = state;
+}
+
+void EventGetSysteminfo::setSimImsi(char* mcc, char* mnc, char* msin)
+{
+    m_simProperty.mcc = atoi(mcc);
+    m_simProperty.mnc = atoi(mnc);
+    m_simProperty.msin = msin;
+}
+
+int EventGetSysteminfo::addSimValueCnt()
+{
+    return ++m_simValueCnt;
+}
+
+int EventGetSysteminfo::setSimValue(const int attribute, char* value)
+{
+    switch(attribute) {
+        case 0 :
+            m_simProperty.operatorName = value;
+            break;
+        case 1 :
+            m_simProperty.msisdn = value;
+            break; 
+        case 2 :
+            m_simProperty.iccid = value;
+            break; 
+        case 3 :
+            m_simProperty.spn = value;
+            break; 
+    }
+
+    return ++m_simValueCnt;
+}
+
+void EventGetSysteminfo::setTapiHandle(void* handle)
+{
+    m_tapiHandle = handle;
+}
+
 void EventGetSysteminfo::setBasePropertyPtr(const BasePropertyPtr& baseProperty)
 {
     m_BaseProperty = baseProperty;
 }
 
+void EventGetSysteminfo::makeSimObject()
+{
+    LoggerD("enter");
+    SIMPropertiesPtr SIM(new SIMProperties());
+
+    if (!m_BaseProperty) {
+        LoggerE("property is not set");
+        setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::ConversionException);
+    } else {
+        WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr m_callbackManager = DPL::StaticPointerCast<WrtDeviceApis::CommonsJavaScript::JSCallbackManager >(getPrivateData());
+        if (!m_callbackManager) {
+            LoggerE("property is not set");
+            setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::NullPointerException);
+        } else {
+            JSContextRef context = m_callbackManager->getContext();
+            SIM->state = m_simProperty.state;
+            SIM->mcc = m_simProperty.mcc;
+            SIM->mnc = m_simProperty.mnc;
+            SIM->msin = m_simProperty.msin;
+            SIM->operatorName = m_simProperty.operatorName;
+            SIM->msisdn = m_simProperty.msisdn;
+            SIM->iccid = m_simProperty.iccid;
+            SIM->spn = m_simProperty.spn;
+            m_value = JSSIMInfo::createJSObject(context, SIM);
+        }
+    }
+}
+
+
 JSValueRef EventGetSysteminfo::getValue() const
 {
     return m_value;
@@ -61,10 +133,10 @@ void EventGetSysteminfo::processGetValue(void* handle)
             setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::NullPointerException);
         } else {
             JSContextRef context = m_callbackManager->getContext();
-            m_value = m_BaseProperty->getValue(context, handle);
+            m_value = m_BaseProperty->getValue(context, handle, m_tapiHandle);
         }
     }
 }
 
 }
-}
\ No newline at end of file
+}
index 1294211..5a1f9a8 100755 (executable)
@@ -33,12 +33,20 @@ class EventGetSysteminfo : public WrtDeviceApis::Commons::IEvent<EventGetSystemi
   private :
     BasePropertyPtr m_BaseProperty;
     JSValueRef m_value;
+    void* m_tapiHandle;
+    SIMProperties m_simProperty;
+    int m_simValueCnt;
 
   public :
     EventGetSysteminfo();
     ~EventGetSysteminfo();
-
+    int addSimValueCnt();
+    void setSimState(char* state);
+    void setSimImsi(char* mcc, char* mnc, char* msin);
+    int setSimValue(const int attribute, char* value);
+    void setTapiHandle(void* handle);
     void setBasePropertyPtr(const BasePropertyPtr& baseProperty);
+    void makeSimObject();
     JSValueRef getValue() const;
     const char * getProperty() const;
     void processGetValue(void* handle);
index 174f0c8..1da11d0 100755 (executable)
@@ -48,6 +48,7 @@ EventWatchSysteminfo::EventWatchSysteminfo() : m_id(m_uniqId)
     m_tmpStorageCnt = 0;
     m_Systeminfo = NULL;
     m_setLastValue = false;
+    m_tapiHandle = NULL;
     ++m_uniqId;
 }
 
@@ -57,6 +58,11 @@ EventWatchSysteminfo::~EventWatchSysteminfo()
     removeTimer();
 }
 
+void EventWatchSysteminfo::setTapiHandle(void* handle)
+{
+    m_tapiHandle = handle;
+}
+
 void EventWatchSysteminfo::setWatchOption(const WatchOption& watchoption) {
     m_WatchOption = watchoption;
 }
@@ -136,7 +142,7 @@ void EventWatchSysteminfo::processGetValue()
     JSContextRef context = m_cbm->getContext();
 
     if (!m_setLastValue) {
-        lastValue = m_BaseProperty->getValue(context, (void*)((Systeminfo*)m_Systeminfo)->getConnectionHandle());
+        lastValue = m_BaseProperty->getValue(context, (void*)((Systeminfo*)m_Systeminfo)->getConnectionHandle(), (void*)m_tapiHandle);
         switch(watchType) {
             case WATCH_TYPE_BATTERY :
                 key = "level";
@@ -201,7 +207,7 @@ void EventWatchSysteminfo::processGetValue()
     if (watchType == WATCH_TYPE_CPU) {
         tmpValue = ((Systeminfo*)m_Systeminfo)->getCpuValue(context);
     } else {
-        tmpValue = m_BaseProperty->getValue(context, (void*)((Systeminfo*)m_Systeminfo)->getConnectionHandle());
+        tmpValue = m_BaseProperty->getValue(context, (void*)((Systeminfo*)m_Systeminfo)->getConnectionHandle(), (void*)m_tapiHandle);
     }
 
     if (!tmpValue) {
index 075e8ac..c03e78f 100755 (executable)
@@ -70,11 +70,13 @@ class EventWatchSysteminfo : public WrtDeviceApis::Commons::IEvent<EventWatchSys
        int m_tmpStorageCnt;
        PropertyValue m_propertyValue;
        bool m_setLastValue;
+       void* m_tapiHandle;
 
   public :
         EventWatchSysteminfo();
        ~EventWatchSysteminfo();
 
+       void setTapiHandle(void* handle);
        void setWatchOption(const WatchOption& watchoption);
        WatchOption getWatchOption();
        WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr getCallbackManager();
index 4bce852..e2117d7 100755 (executable)
@@ -31,6 +31,8 @@
 
 #define MAXBUFSIZE 256
 #define DEVICE_PROFILE "MOBILE_FULL"
+#define DUID_KEY_STRING 28
+#define DUID_BUFFER_SIZE 100
 
 namespace DeviceAPI {
 namespace Systeminfo {
@@ -682,6 +684,23 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR
             }
             return convert.toJSValueRef(deviceCapabilitiesInfo->sipVoip);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_DUID)) {
+            FILE *fp = NULL;
+            char duid[DUID_BUFFER_SIZE] = {0,};
+            fp = fopen("/opt/usr/etc/system_info_cache.ini", "r");
+
+            if(fp == NULL) {
+                LoggerD("fail file open.");
+                return convert.toJSValueRef(deviceCapabilitiesInfo->duid);
+            }
+
+            while(fgets(duid, DUID_BUFFER_SIZE-1, fp)) {
+                if (strncmp(duid, "http://tizen.org/system/duid", DUID_KEY_STRING) == 0) {
+                    LoggerD("duid : " << duid);
+                    deviceCapabilitiesInfo->duid = duid;                    
+                    break;
+                }
+            }
+            fclose(fp);
             return convert.toJSValueRef(deviceCapabilitiesInfo->duid);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_ROCOGNITION)) {
             bool speechRecognition = false;
index 4182e26..05fc1a3 100755 (executable)
 #include <CommonsJavaScript/Converter.h>
 #include <CommonsJavaScript/PrivateObject.h>
 #include <TimeTracer.h>
-#include <tapi_common.h>
-#include <ITapiModem.h>
-#include <sim.h>
 #include "Systeminfo.h"
 #include <Logger.h>
 
 using namespace WrtDeviceApis::CommonsJavaScript;
 using namespace WrtDeviceApis::Commons;
-
+#define SIM_VALUE_MAX    4
 
 namespace DeviceAPI {
 namespace Systeminfo {
@@ -114,7 +111,109 @@ void localeChangedCallback(runtime_info_key_e key, void* event_ptr)
 {
     if(event_ptr) {
         ((Systeminfo*)event_ptr)->getWatchValue(WATCH_TYPE_LOCALE);
-    }    
+    }
+}
+
+void SimCphsValueCallback(TapiHandle *handle, int result, void *data, void *user_data)
+{
+       TelSimAccessResult_t access_rt = (TelSimAccessResult_t)result;
+       TelSimCphsNetName_t *cphsInfo = (TelSimCphsNetName_t *)data;
+
+    LoggerD("access_rt : " << access_rt);
+
+    if (user_data != NULL){
+        SysteminfoAsyncPendingEvent *pendingEvent = (SysteminfoAsyncPendingEvent *)user_data;
+        Systeminfo *systeminfo = (Systeminfo *)pendingEvent->getThisObject();
+        EventGetSysteminfoPtr event = pendingEvent->getEvent();
+
+        if (access_rt == TAPI_SIM_ACCESS_SUCCESS) {
+            if (cphsInfo->full_name) {
+            systeminfo->setSimValue(SIM_CPHS_VALUE, (char *)cphsInfo->full_name, event);
+            } else if (cphsInfo->short_name) {
+                systeminfo->setSimValue(SIM_CPHS_VALUE, (char *)cphsInfo->short_name, event);
+            } else {
+                systeminfo->setSimValue(SIM_CPHS_VALUE, NULL, event);                    
+            }
+        } else {
+            systeminfo->setSimValue(SIM_CPHS_VALUE, NULL, event);        
+        }
+
+        delete pendingEvent;
+        pendingEvent = NULL;
+        user_data = NULL;
+    }
+}
+
+void SimMsisdnValueCallback(TapiHandle *handle, int result, void *data, void *user_data)
+{
+       TelSimAccessResult_t access_rt = (TelSimAccessResult_t)result;
+       TelSimMsisdnList_t *msisdnInfo = (TelSimMsisdnList_t *)data;
+
+    LoggerD("access_rt : " << access_rt);
+
+    if (user_data != NULL){
+        SysteminfoAsyncPendingEvent *pendingEvent = (SysteminfoAsyncPendingEvent *)user_data;
+        Systeminfo *systeminfo = (Systeminfo *)pendingEvent->getThisObject();
+        EventGetSysteminfoPtr event = pendingEvent->getEvent();
+
+        if (access_rt == TAPI_SIM_ACCESS_SUCCESS) {
+            systeminfo->setSimValue(SIM_MSISDN_VALUE, (char *)msisdnInfo->list[0].num, event);
+        } else {
+            systeminfo->setSimValue(SIM_MSISDN_VALUE, NULL, event);        
+        }
+
+        delete pendingEvent;
+        pendingEvent = NULL;
+        user_data = NULL;
+    }
+}
+
+void SimIccidValueCallback(TapiHandle *handle, int result, void *data, void *user_data)
+{
+    TelSimAccessResult_t access_rt = (TelSimAccessResult_t)result;
+       TelSimIccIdInfo_t *iccidInfo = (TelSimIccIdInfo_t *)data;
+
+    LoggerD("access_rt : " << access_rt);
+
+    if (user_data != NULL){
+        SysteminfoAsyncPendingEvent *pendingEvent = (SysteminfoAsyncPendingEvent *)user_data;
+        Systeminfo *systeminfo = (Systeminfo *)pendingEvent->getThisObject();
+        EventGetSysteminfoPtr event = pendingEvent->getEvent();
+
+        if (access_rt == TAPI_SIM_ACCESS_SUCCESS) {
+            systeminfo->setSimValue(SIM_ICCID_VALUE, (char *)iccidInfo->icc_num, event);
+        } else {
+            systeminfo->setSimValue(SIM_ICCID_VALUE, NULL, event);        
+        }
+
+        delete pendingEvent;
+        pendingEvent = NULL;
+        user_data = NULL;
+    }
+}
+
+void SimSpnValueCallback(TapiHandle *handle, int result, void *data, void *user_data)
+{
+    TelSimAccessResult_t access_rt = (TelSimAccessResult_t)result;
+    TelSimSpn_t *spnInfo = (TelSimSpn_t *)data;
+
+    LoggerD("access_rt : " << access_rt);
+
+    if (user_data != NULL){
+        SysteminfoAsyncPendingEvent *pendingEvent = (SysteminfoAsyncPendingEvent *)user_data;
+        Systeminfo *systeminfo = (Systeminfo *)pendingEvent->getThisObject();
+        EventGetSysteminfoPtr event = pendingEvent->getEvent();
+        
+        if (access_rt == TAPI_SIM_ACCESS_SUCCESS) {
+            systeminfo->setSimValue(SIM_SPN_VALUE, (char *)spnInfo->spn, event);
+        } else {
+            systeminfo->setSimValue(SIM_ICCID_VALUE, NULL, event);        
+        }
+
+        delete pendingEvent;
+        pendingEvent = NULL;
+        user_data = NULL;
+    }
 }
 
 }
@@ -181,6 +280,11 @@ Systeminfo::Systeminfo() : m_networkRegist(REGIST_NOT),
             LoggerD("failed");
         }
     }
+
+    m_tapiHandle = tel_init(0);
+    if (m_tapiHandle == NULL) {
+        LoggerE ("tel init fail");
+    }
 }
 
 Systeminfo::~Systeminfo()
@@ -205,6 +309,10 @@ Systeminfo::~Systeminfo()
         LoggerD("Network Client deregistration failed");
     }
 
+    if (m_tapiHandle != NULL) {
+        tel_deinit(m_tapiHandle);
+    }
+
        state = sf_stop(m_sensorHandle);
        LoggerD("handle 1  state = " << state);
 
@@ -221,6 +329,7 @@ DeviceCapabilitiesPropertiesPtr Systeminfo::getCapabilities()
 
 void Systeminfo::get(const EventGetSysteminfoPtr& event)
 {
+    event->setTapiHandle((void*)m_tapiHandle);
     EventRequestReceiver<EventGetSysteminfo>::PostRequest(event);
 }
 
@@ -233,6 +342,7 @@ void Systeminfo::watch(const EventWatchSysteminfoPtr& event)
     }
 
     event->setSysteminfoPtr(this);
+    event->setTapiHandle((void*)m_tapiHandle);
     m_EventMgrPtr->addEvent(event, event->getWatchType());
 
     EventRequestReceiver<EventWatchSysteminfo>::PostRequest(event);
@@ -464,10 +574,91 @@ JSValueRef Systeminfo::getCpuValue(JSContextRef context)
     return JSCpuInfo::createJSObject(context, cpuPtr);
 }
 
+void Systeminfo::setSimValue(const int simAttribute, char* value, const EventGetSysteminfoPtr &event)
+{
+    int ret = 0;
+    if (!value) {
+        ret = event->addSimValueCnt();
+    } else {
+        ret = event->setSimValue(simAttribute, value);
+    }
+
+    if (ret == SIM_VALUE_MAX) {
+        event->makeSimObject();
+        EventRequestReceiver<EventGetSysteminfo>::ManualAnswer(event);
+    }
+}
+
 void Systeminfo::OnRequestReceived(const EventGetSysteminfoPtr& event)
 {
     LoggerD("enter");
-    event->processGetValue((void *)m_connectionHandle);
+
+    if (strcmp(event->getProperty(), (const char*)"SIM") == 0) {
+        int cardChanged = 0;
+        TelSimCardStatus_t simCardState;
+        TelSimImsiInfo_t imsi;
+        char* simState = NULL;
+
+        event->switchToManualAnswer();
+        event->setCancelAllowed(true);        
+        
+        if (tel_get_sim_init_info(m_tapiHandle, &simCardState, &cardChanged) == TAPI_API_SUCCESS) {
+            switch(simCardState) {
+                case TAPI_SIM_STATUS_CARD_NOT_PRESENT :
+                case TAPI_SIM_STATUS_CARD_REMOVED : 
+                    simState = "ABSENT";
+                    break;
+                case TAPI_SIM_STATUS_SIM_INITIALIZING :
+                    simState = "INITIALIZING";
+                    break;
+                case TAPI_SIM_STATUS_SIM_INIT_COMPLETED :
+                    simState = "READY";
+                    break;
+                case TAPI_SIM_STATUS_SIM_PIN_REQUIRED :
+                    simState = "PIN_REQUIRED";
+                    break;
+                case TAPI_SIM_STATUS_SIM_PUK_REQUIRED :
+                    simState = "PUK_REQUIRED";
+                    break;
+                case TAPI_SIM_STATUS_SIM_LOCK_REQUIRED :
+                case TAPI_SIM_STATUS_CARD_BLOCKED :
+                    simState = "SIM_LOCKED";
+                    break;
+                case TAPI_SIM_STATUS_SIM_NCK_REQUIRED :
+                case TAPI_SIM_STATUS_SIM_NSCK_REQUIRED :
+                    simState = "NETWORK_LOCKED";
+                    break;                
+                case TAPI_SIM_STATUS_UNKNOWN :
+                case TAPI_SIM_STATUS_CARD_ERROR :
+                //case TAPI_SIM_STATUS_CARD_CRASHED :
+               default:
+                    simState = "UNKNOWN";
+                   break;
+            }
+            event->setSimState(simState);
+            if(strcmp(simState, "READY") == 0) {
+                if (tel_get_sim_imsi(m_tapiHandle, &imsi) == TAPI_API_SUCCESS) {
+                    LoggerD("mcc : " << imsi.szMcc << \r" mnc : " << imsi.szMnc << " msin : " << imsi.szMsin);
+                    event->setSimImsi(imsi.szMcc, imsi.szMnc, imsi.szMsin);
+                } else {
+                    LoggerE("get fail sim imsi");
+                }
+                SysteminfoAsyncPendingEvent *cphsPendingEvent = new SysteminfoAsyncPendingEvent((void *)this, event);
+                tel_get_sim_cphs_netname(m_tapiHandle, SimCphsValueCallback, cphsPendingEvent);
+                SysteminfoAsyncPendingEvent *msisdnPendingEvent = new SysteminfoAsyncPendingEvent((void *)this, event);
+                tel_get_sim_msisdn(m_tapiHandle, SimMsisdnValueCallback, msisdnPendingEvent);
+                SysteminfoAsyncPendingEvent *iccidPendingEvent = new SysteminfoAsyncPendingEvent((void *)this, event);
+                tel_get_sim_iccid(m_tapiHandle, SimIccidValueCallback, iccidPendingEvent);
+                SysteminfoAsyncPendingEvent *spnPendingEvent = new SysteminfoAsyncPendingEvent((void *)this, event);
+                tel_get_sim_spn(m_tapiHandle, SimSpnValueCallback, spnPendingEvent);
+            }
+            LoggerD("test");
+        } else {
+            LoggerE("get fail sim state");
+        }
+    } else {
+        event->processGetValue((void *)m_connectionHandle);
+    }
 }
 
 void Systeminfo::OnRequestReceived(const EventWatchSysteminfoPtr& event)
@@ -1128,11 +1319,11 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Display) {
         display->dotsPerInchHeight = dotsPerInch;        
     }
 
-    if(system_info_get_platform_int("tizen.org/feature/screen.width", &physicalW) == SYSTEM_INFO_ERROR_NONE) {
+    if(system_info_get_value_int(SYSTEM_INFO_KEY_PHYSICAL_SCREEN_WIDTH, &physicalW) == SYSTEM_INFO_ERROR_NONE) {
         display->physicalWidth = physicalW;
     }
 
-    if(system_info_get_platform_int("tizen.org/feature/screen.height", &physicalH) == SYSTEM_INFO_ERROR_NONE) {
+    if(system_info_get_value_int(SYSTEM_INFO_KEY_PHYSICAL_SCREEN_HEIGHT, &physicalH) == SYSTEM_INFO_ERROR_NONE) {
         display->physicalHeight = physicalH;
     }
 
@@ -1232,7 +1423,6 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) {
     char* apn = NULL;
     char* imei = NULL;
     int plmn = 0, cellId = 0, lac = 0, isRoaming = 0, isFlightMode = 0;
-    TapiHandle *tapiHandle = NULL;    
 
     TIME_TRACER_ITEM_BEGIN("(cellular)mcc", 0);
     if (vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &plmn) == 0) {
@@ -1307,20 +1497,15 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) {
             connection_profile_destroy(profileHandle);
         }
     }
-  
-    tapiHandle = tel_init(0);
+   
+    imei = tel_get_misc_me_imei_sync((TapiHandle*)tapiHandle);
     
-    if (tapiHandle != NULL) {
-        imei = tel_get_misc_me_imei_sync(tapiHandle);
-        
-        if (imei == NULL) {
-            tel_deinit(tapiHandle);
-            return JSCellularNetworkInfo::createJSObject(context, cellularNetwork);
-        }
-        
+    if (imei != NULL) {
+        LoggerD("imei : " << imei);
         cellularNetwork->imei = imei;
         free(imei);
-        tel_deinit(tapiHandle);
+    } else {
+        LoggerD("get fail imei");
     }
 
     return JSCellularNetworkInfo::createJSObject(context, cellularNetwork);
@@ -1330,98 +1515,6 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(SIM) {
     Converter converter(context);
     SIMPropertiesPtr SIM(new SIMProperties());
 
-    sim_state_e state;
-    char* fullName = NULL;
-    char* shortName = NULL;
-    char* msisdn = NULL;
-    char* iccId = NULL;
-    char* mcc = NULL;
-    char* mnc = NULL;
-    char* msin = NULL;
-    char* spn = NULL;
-    int ret = SIM_ERROR_NONE;    
-
-    ret = sim_get_state(&state);
-    if (ret == SIM_ERROR_NONE) {
-        if (state == SIM_STATE_UNAVAILABLE) {
-            SIM->state = "ABSENT";
-        } else if (state == SIM_STATE_LOCKED) {
-            SIM->state = "PIN_REQUIRED";
-        } else if (state == SIM_STATE_AVAILABLE) {
-            SIM->state = "READY";
-        } else if (state == SIM_STATE_UNKNOWN) {
-            SIM->state = "INITIALIZING";
-        }
-    }
-
-    ret = sim_get_cphs_operator_name(&fullName, &shortName);
-    if (ret == SIM_ERROR_NONE) {
-        if (fullName) {
-            SIM->operatorName = fullName;
-            LoggerD("operatorName : " << SIM->operatorName);
-            free(fullName);
-        } else if (shortName) {
-            SIM->operatorName = shortName;
-            LoggerD("operatorName : " << SIM->operatorName);
-            free(shortName);
-        }
-    }
-
-
-    ret = sim_get_subscriber_number(&msisdn);
-    if (ret == SIM_ERROR_NONE) {
-        if (msisdn) {
-            SIM->msisdn = msisdn;
-            LoggerD("msisdn : " << SIM->msisdn);
-            free(msisdn);
-        }
-    }
-
-    ret = sim_get_icc_id(&iccId);
-    if (ret == SIM_ERROR_NONE) {
-        if (iccId) {
-            SIM->iccid = iccId;
-            LoggerD("iccid : " << SIM->iccid);
-            free(iccId);
-        }
-    }
-
-    ret = sim_get_mcc(&mcc);
-    if (ret == SIM_ERROR_NONE) {
-        if (mcc) {
-            SIM->mcc = atoi(mcc);
-            LoggerD("mcc : " << SIM->mcc);
-            free(mcc);
-        }
-    }
-
-    ret = sim_get_mnc(&mnc);
-    if (ret == SIM_ERROR_NONE) {
-        if (mnc) {
-            SIM->mnc = atoi(mnc);
-            LoggerD("mnc : " << SIM->mnc);
-            free(mnc);
-        }
-    }
-
-    ret = sim_get_msin(&msin);
-    if (ret == SIM_ERROR_NONE) {
-        if (msin) {
-            SIM->msin = msin;
-            LoggerD("msin : " << SIM->msin);
-            free(msin);
-        }
-    }
-
-    ret = sim_get_spn(&spn);
-    if (ret == SIM_ERROR_NONE) {
-        if (spn) {
-            SIM->spn = spn;
-            LoggerD("spn : " << SIM->spn);
-            free(spn);
-        }
-    }
-
     return JSSIMInfo::createJSObject(context, SIM);
 }
 
index 01d0b89..fde871f 100755 (executable)
@@ -36,6 +36,9 @@
 #include "EventGetSysteminfo.h"
 #include "EventWatchSysteminfo.h"
 #include "BaseProperties.h"
+#include <tapi_common.h>
+#include <ITapiModem.h>
+#include <ITapiSim.h>
 #include <Commons/Emitters.h>
 #include <CommonsJavaScript/Converter.h>
 
@@ -65,6 +68,13 @@ enum {
     REGIST_ALL = 3
 };
 
+enum {
+    SIM_CPHS_VALUE = 0,
+    SIM_MSISDN_VALUE = 1,
+    SIM_ICCID_VALUE = 2,
+    SIM_SPN_VALUE = 3
+};
+
 struct cpuInfo {
     unsigned long long usr;
     unsigned long long nice;
@@ -83,7 +93,7 @@ typedef DPL::Atomic::ValueType WatchId;
       public: \
         explicit className() : BaseProperty() { \
         } \
-        JSValueRef getValue(JSContextRef context, void* handle) const; \
+        JSValueRef getValue(JSContextRef context, void* handle, void* tapiHandle) const; \
         const char* getProperty() const \
         { \
             return propertyName; \
@@ -95,7 +105,7 @@ typedef DPL::Atomic::ValueType WatchId;
     };
 
 #define PROPERTY_GET_SYSTEMINFO_DEFINITION(className) JSValueRef className::getValue( \
-        JSContextRef context, void* handle) const
+        JSContextRef context, void* handle, void* tapiHandle) const
 
 PROPERTY_DECLARATION(Battery, "BATTERY", WATCH_TYPE_BATTERY)
 PROPERTY_DECLARATION(Cpu, "CPU", WATCH_TYPE_CPU)
@@ -138,6 +148,7 @@ class Systeminfo : public ISysteminfo
     void getWatchValue(const int watchType);
     connection_h getConnectionHandle();
     JSValueRef getCpuValue(JSContextRef context);
+    void setSimValue(const int simAttribute, char* value, const EventGetSysteminfoPtr &event);
 
        class EventMgr
        {
@@ -195,6 +206,7 @@ class Systeminfo : public ISysteminfo
     int m_sensorHandle;
     connection_h m_connectionHandle;
     cpuInfo m_cpuInfo;
+    TapiHandle *m_tapiHandle;
 };
 
 class SysteminfoAsyncPendingEvent
index bb154f6..781ac8b 100755 (executable)
@@ -314,13 +314,13 @@ struct CellularNetworkProperties
 struct SIMProperties
 {
     std::string     state;
-       std::string             operatorName;
-       std::string             msisdn;
-       std::string             iccid;
+       std::string     operatorName;
+       std::string     msisdn;
+       std::string     iccid;
        unsigned short  mcc;
        unsigned short  mnc;
-       std::string             msin;
-       std::string             spn;
+       std::string     msin;
+       std::string     spn;
 
        SIMProperties() :
         state(""),
index 533f828..e656b09 100644 (file)
@@ -166,8 +166,6 @@ JSValueRef JSTizen::convertToType(JSContextRef context, JSObjectRef object,
 bool JSTizen::hasProperty(JSContextRef context,
         JSObjectRef object, JSStringRef propertyName)
 {
-    LoggerD("entered");
-
     Try
     {
         TizenPrivate* priv = static_cast<TizenPrivate*>(JSObjectGetPrivate(object));
@@ -192,8 +190,6 @@ bool JSTizen::hasProperty(JSContextRef context,
 JSValueRef JSTizen::getProperty(JSContextRef context, JSObjectRef object,
         JSStringRef propertyName, JSValueRef* exception)
 {
-    LoggerD("entered");
-
     Try
     {
         TizenPrivate* priv =
@@ -219,7 +215,6 @@ JSValueRef JSTizen::getProperty(JSContextRef context, JSObjectRef object,
 bool JSTizen::setProperty(JSContextRef context, JSObjectRef object,
         JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
 {
-    LoggerD("entered");
     Try
     {
         TizenPrivate* priv =
index a9fdb8d..3584a6d 100755 (executable)
@@ -3,7 +3,9 @@ SET(TARGET_NAME ${websetting_target})
 SET(DESTINATION_NAME ${websetting_dest})
 SET(TARGET_IMPL_NAME ${websetting_impl})
 
-#PKG_CHECK_MODULES(websetting REQUIRED [.. required package name ..])
+PKG_CHECK_MODULES(platform_pkgs_websetting REQUIRED
+       wrt-plugins-ipc-message
+)
 
 INCLUDE_DIRECTORIES(
        ${INCLUDE_COMMON}
index 90d45d5..fb19d37 100755 (executable)
@@ -23,6 +23,7 @@
 #include <GlobalContextManager.h>
 #include <MultiCallbackUserData.h>
 #include <PlatformException.h>
+#include <Logger.h>
 
 #include "plugin_config.h"
 
@@ -77,6 +78,7 @@ const JSClassDefinition* JSWebSettingManager::getClassInfo()
 
 void JSWebSettingManager::initialize(JSContextRef context, JSObjectRef object)
 {
+    SLoggerI("JSWebSettingManager::initialize: called once when the .so loaded for the web app");
     if (!JSObjectGetPrivate(object)) {
         WebSettingManager *priv = new WebSettingManager();
         if (!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
@@ -87,6 +89,7 @@ void JSWebSettingManager::initialize(JSContextRef context, JSObjectRef object)
 
 void JSWebSettingManager::finalize(JSObjectRef object)
 {
+    SLoggerI("JSWebSettingManager::initialize: called once when the .so unloaded for the web app");
     WebSettingManager *priv = static_cast<WebSettingManager*>(JSObjectGetPrivate(object));
     if (priv) {
         JSObjectSetPrivate(object, NULL);
@@ -131,11 +134,11 @@ JSValueRef JSWebSettingManager::setUserAgentString(JSContextRef context,
         priv->setUserAgentString(userAgent, callbacks);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
-           LoggerE("%s: %s", err.getName().c_str(), err.getMessage().c_str());
+           SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
            return JSWebAPIErrorFactory::postException(context, exception, err);                
     } catch (...) {
         DeviceAPI::Common::UnknownException err("Unknown Error in WebSettingManager.setUserAgentString().");
-           LoggerE("%s: %s", err.getName().c_str(), err.getMessage().c_str());
+           SLoggerE(err.getName().c_str() << ":" <<  err.getMessage().c_str());
            return JSWebAPIErrorFactory::postException(context, exception, err);                
     }
 }
@@ -147,7 +150,6 @@ JSValueRef JSWebSettingManager::removeAllCookies(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-    //TODO: Need to implement ACE check
     //AceSecurityStatus status = WEB_SETTING_CHECK_ACCESS(WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES);
     //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -177,11 +179,11 @@ JSValueRef JSWebSettingManager::removeAllCookies(JSContextRef context,
         priv->removeAllCookies(callbacks);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
-           LoggerE("%s: %s", err.getName().c_str(), err.getMessage().c_str());
+           SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
            return JSWebAPIErrorFactory::postException(context, exception, err);                
     } catch (...) {
         DeviceAPI::Common::UnknownException err("Unknown Error in WebSettingManager.removeAllCookies().");
-           LoggerE("%s: %s", err.getName().c_str(), err.getMessage().c_str());
+           SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
            return JSWebAPIErrorFactory::postException(context, exception, err);                
     }
 }
index f056fdf..ce64957 100755 (executable)
@@ -24,6 +24,7 @@
 #include <JSWebAPIError.h>
 #include <PlatformException.h>
 
+#include <plugins-ipc-message/ipc_message_support.h>
 
 namespace DeviceAPI {
 namespace WebSetting {
@@ -36,78 +37,80 @@ WebSettingManager::~WebSettingManager()
 {
 }
 
-static gboolean asyncUserAgentStringResult(void *data)
-{
-    LoggerD("[asyncUserAgentStringResult] entered in Mainloop");
-
-    WebSettingManager* object = static_cast<WebSettingManager*>(data);
-    if(object == NULL)
-    {
-               //TBD : JSWebAPIErrorFactory::postException(context, exception, err);                
-        LoggerD("[asyncUserAgentStringResult] User data is NULL");
-        return true;
+void WebSettingManager::onAsyncUAStringReplyCallback(unsigned int num, void* user_data, const char* result) 
+{    
+    WebSettingManager* object = static_cast<WebSettingManager*>(user_data);    
+
+    if (strncmp(result,"success", strlen("success")) == 0) {
+        //invoke success callback here.
+        if (object->mSetUserAgentCallbacks != NULL ){
+                   SLoggerI("[WebSettingManager::onAsyncReplyCallback] onsuccess start. ");
+            object->mSetUserAgentCallbacks->invokeCallback("onsuccess", NULL);
+                   SLoggerI("[WebSettingManager::onAsyncReplyCallback] onsuccess end. ");
+           }
+        else {
+                   SLoggerI("[WebSettingManager::onAsyncReplyCallback] object->mSetUserAgentCallbacks is NULL so no callback can be invoked." << __LINE__);;
+        }
     }
-
-    MultiCallbackUserDataPtr callback = (MultiCallbackUserDataPtr)object->mSetUserAgentCallbacks;
-
-       if (callback)
-       {
-           JSContextRef context = callback->getContext();
-           callback->invokeCallback("onsuccess");
-       }
-
-    return false;
-}
-
-static gboolean asyncRemoveAllCookiesResult(void *data)
-{
-    LoggerD("[asyncRemoveAllCookiesResult] entered in Mainloop");
-
-    WebSettingManager* object = static_cast<WebSettingManager*>(data);
-    if(object == NULL)
-    {
-               //TBD : JSWebAPIErrorFactory::postException(context, exception, err);                
-        LoggerD("[asyncRemoveAllCookiesResult] User data is NULL");
-        return true;
+    else {
+        if (object->mSetUserAgentCallbacks != NULL ) {
+            SLoggerI("[WebSettingManager::onAsyncReplyCallback] onerror start. ");                     
+            UnknownException error("Unknown");
+            JSObjectRef errorObj = JSWebAPIErrorFactory::makeErrorObject(object->mSetUserAgentCallbacks->getContext(), error);
+                       object->mSetUserAgentCallbacks->invokeCallback("onerror", errorObj);
+                       SLoggerI("[WebSettingManager::onAsyncReplyCallback] onerror end. ");                    
+        }
+        else {
+            SLoggerI("[WebSettingManager::onAsyncReplyCallback] object->mSetUserAgentCallbacks is NULL so no callback can be invoked." << __LINE__);;
+        }
     }
-
-    MultiCallbackUserDataPtr callback = (MultiCallbackUserDataPtr)object->mRemoveAllCookiesCallbacks;
-       if (callback)
-       {
-       JSContextRef context = callback->getContext();
-           callback->invokeCallback("onsuccess");
-       }
-
-    return false;
 }
 
-static void checkSetUserAgentString(void *data, Ecore_Thread *thread)
-{
-    LoggerD("WebSettingManager::checkUserAgentString");
-    g_idle_add(asyncUserAgentStringResult, data);
-}
-
-static void checkRemoveAllCookies(void *data, Ecore_Thread *thread)
-{
-    LoggerD("WebSettingManager::checkRemoveAllCookies");
-    g_idle_add(asyncRemoveAllCookiesResult, data);
+void WebSettingManager::onAsyncReplyRemoveAllCookiesCallback(unsigned int num, void* user_data, const char* result) 
+{    
+    WebSettingManager* object = static_cast<WebSettingManager*>(user_data);    
+
+    if (strncmp(result,"success", strlen("success")) == 0) {
+    //invoke success callback here.
+        if (object->mRemoveAllCookiesCallbacks != NULL ) {
+            SLoggerI("[WebSettingManager::onAsyncReplyCallback] onsuccess start. ");
+            object->mRemoveAllCookiesCallbacks->invokeCallback("onsuccess", NULL);
+            SLoggerI("[WebSettingManager::onAsyncReplyCallback] onsuccess end. ");
+        }
+        else {
+            SLoggerI("[WebSettingManager::onAsyncReplyCallback] object->mSetUserAgentCallbacks is NULL so no callback can be invoked." << __LINE__);;
+        }
+    }
+    else {
+        if (object->mRemoveAllCookiesCallbacks != NULL) {
+            SLoggerI("[WebSettingManager::onAsyncReplyCallback] onerror start. ");                     
+            UnknownException error("Unknown");
+            JSObjectRef errorObj = JSWebAPIErrorFactory::makeErrorObject(object->mSetUserAgentCallbacks->getContext(), error);
+                       object->mRemoveAllCookiesCallbacks->invokeCallback("onerror", errorObj);
+                       SLoggerI("[WebSettingManager::onAsyncReplyCallback] onerror end. ");                    
+        }
+        else {
+               SLoggerI("[WebSettingManager::onAsyncReplyCallback] object->mSetUserAgentCallbacks is NULL so no callback can be invoked." << __LINE__);;
+           }
+    }
 }
 
 void WebSettingManager::setUserAgentString(std::string userAgent, MultiCallbackUserDataPtr callbacks)
 {
-    LoggerD("WebSetting:setUserAgentString: " << userAgent);
-       mSetUserAgentCallbacks = callbacks;
-    ecore_thread_run(checkSetUserAgentString, NULL, NULL, this);
-    //throw UnknownException("Not Implemented.");
+    SLoggerI("WebSetting:setUserAgentString: " << userAgent);
+    mSetUserAgentCallbacks = callbacks;
+    IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_CHANGE_USERAGENT, userAgent.c_str(), WebSettingManager::onAsyncUAStringReplyCallback, this);
+    //IPCMessageSupport::sendAsyncMessageToUiProcess("tizen://changeUA", "Mozilla/5.0 ~", WebSettingManager::onAsyncReplyCallback, this);
+    SLoggerI("WebSetting:setUserAgentString done");
 }
 
 void WebSettingManager::removeAllCookies(MultiCallbackUserDataPtr callbacks)
 {
-    LoggerD("WebSetting:removeAllCookies: ");
-       mRemoveAllCookiesCallbacks = callbacks;
-    ecore_thread_run(checkRemoveAllCookies, NULL, NULL, this); 
-    //throw UnknownException("Not Implemented.");
-}
-
+    SLoggerI("WebSetting:removeAllCookies: ");
+    mRemoveAllCookiesCallbacks = callbacks;
+    IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_DELETE_ALL_COOKIES, NULL, WebSettingManager::onAsyncReplyRemoveAllCookiesCallback, this);
+    SLoggerI("WebSetting:removeAllCookies done");
 } // WebSetting
+
 } // DeviceAPI
+}
index b859614..a3942af 100755 (executable)
@@ -32,19 +32,16 @@ class WebSettingManager
 public:
     WebSettingManager();
     virtual ~WebSettingManager();
-
-       void setUserAgentString(std::string userAgent, MultiCallbackUserDataPtr callbacks);
-
-       void removeAllCookies(MultiCallbackUserDataPtr callbacks);
-
-       Common::MultiCallbackUserDataPtr mSetUserAgentCallbacks;
-       
-       Common::MultiCallbackUserDataPtr mRemoveAllCookiesCallbacks;
-
+    void setUserAgentString(std::string userAgent, MultiCallbackUserDataPtr callbacks);
+    void removeAllCookies(MultiCallbackUserDataPtr callbacks);
+    Common::MultiCallbackUserDataPtr mSetUserAgentCallbacks;
+    Common::MultiCallbackUserDataPtr mRemoveAllCookiesCallbacks;
+    static void onAsyncUAStringReplyCallback(unsigned int num, void* user_data, const char* result);
+    static void onAsyncReplyRemoveAllCookiesCallback(unsigned int num, void* user_data, const char* result);
 private:
 };
 
 } // WebSetting
 } // DeviceAPI
 
-#endif // __TIZEN_WEB_SETTING_MANAGER_H__
\ No newline at end of file
+#endif // __TIZEN_WEB_SETTING_MANAGER_H__
old mode 100644 (file)
new mode 100755 (executable)
index 9a3ed7f..539d902
@@ -23,6 +23,9 @@
 
 #include "plugin_config.h"
 
+#define WEBSETTING_FEATURE_API "http://tizen.org/privilege/websetting"
+#define WEBSETTING_DEVICE_CAP "websetting"
+
 using namespace WrtDeviceApis::Commons;
 
 namespace DeviceAPI {
@@ -31,14 +34,48 @@ namespace WebSetting {
 static FunctionMapping createWebSettingFunctions();
 static FunctionMapping WebSettingFunctions = createWebSettingFunctions();
 
+#pragma GCC visibility push(default)
+
 DEFINE_FUNCTION_GETTER(WebSetting, WebSettingFunctions);
 
+#pragma GCC visibility pop
+
 static FunctionMapping createWebSettingFunctions()
 {
     FunctionMapping webSettingMapping;
-    // TODO: implement here
+    /**
+     * Device capabilities
+     */ 
+    ACE_CREATE_DEVICE_CAP(DEVICE_CAP_WEBSETTING, WEBSETTING_DEVICE_CAP);
+    ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_WEBSETTING);
+    ACE_ADD_DEVICE_CAP(DEVICE_LIST_WEBSETTING, DEVICE_CAP_WEBSETTING);
+               
+    /**
+     * Api Features
+     */
+    ACE_CREATE_FEATURE(FEATURE_WEBSETTING, WEBSETTING_FEATURE_API);
+    ACE_CREATE_FEATURE_LIST(WEBSETTING_FEATURES);
+    ACE_ADD_API_FEATURE(WEBSETTING_FEATURES, FEATURE_WEBSETTING);        
+       
+    /**
+     * Functions
+     */
+    FunctionMapping websettingMapping;
+               
+       // remove cookies
+       AceFunction removeAllCookiesFunc = ACE_CREATE_FUNCTION(
+                               FUNCTION_ADD,
+                               WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES,
+                               WEBSETTING_FEATURES,
+                               DEVICE_LIST_WEBSETTING);
+               
+       websettingMapping.insert(std::make_pair(
+            WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES,
+            removeAllCookiesFunc));
+
     return webSettingMapping;
 }
 
 } // WebSetting
 } // DeviceAPI
+
index 85a702b..db1fca2 100755 (executable)
@@ -35,33 +35,33 @@ namespace WebSetting {
 
 void on_widget_start_callback(int widgetId)
 {
-    LoggerD("[Tizen\\WebSetting] on_widget_start_callback (%d)", widgetId);
+    SLoggerD("[Tizen\\WebSetting] on_widget_start_callback (%d)", widgetId);
     try {
         WrtAccessSingleton::Instance().initialize(widgetId);
     } catch (...) {
-        LoggerE("WrtAccess initialization failed");
+        SLoggerE("WrtAccess initialization failed");
     }
 }
 
 void on_widget_stop_callback(int widgetId)
 {
-    LoggerD("[Tizen\\WebSetting] on_widget_stop_callback (%d)", widgetId);
+    SLoggerD("[Tizen\\WebSetting] on_widget_stop_callback (%d)", widgetId);
     try {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
     } catch (...) {
-        LoggerE("WrtAccess deinitialization failed");
+        SLoggerE("WrtAccess deinitialization failed");
     }
 }
 
 void on_frame_load_callback(const void * context)
 {
-    LoggerD("[Tizen\\WebSetting] on_frame_load_callback (%p)", context);
+    SLoggerD("[Tizen\\WebSetting] on_frame_load_callback (%p)", context);
     GlobalContextManager::getInstance()->addGlobalContext(static_cast<JSContextRef>(context));
 }
 
 void on_frame_unload_callback(const void * context)
 {
-    LoggerD("[Tizen\\WebSetting] on_frame_unload_callback (%p)", context);
+    SLoggerD("[Tizen\\WebSetting] on_frame_unload_callback (%p)", context);
     GlobalContextManager::getInstance()->removeGlobalContext(static_cast<JSContextRef>(context));
 }