apply appcontrol change
authorjungmin76.park <jungmin76.park@samsung.com>
Mon, 7 Jan 2013 12:52:48 +0000 (21:52 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Fri, 11 Jan 2013 10:06:56 +0000 (19:06 +0900)
Change-Id: Ic3a4bd8ec8ecf461eab72d86834582b1d996e122
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
inc/FShellIILiveboxAddRequestListener.h
src/FShell_LiveboxProviderManagerImpl.cpp
src/inc/FShell_LiveboxProviderManagerImpl.h

index 7a20e65..8e7f2d3 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef _FSHELL_ILIVEBOX_ADD_REQUEST_LISTENER_H_
 #define _FSHELL_ILIVEBOX_ADD_REQUEST_LISTENER_H_
 
+#include <FBaseRtIEventListener.h>
 #include <FBaseString.h>
 #include <FAppTypes.h>
 
@@ -40,6 +41,7 @@ namespace Tizen { namespace Shell
  * The %ILiveboxAddRequestListener interface defines a listener for a Livebox viewer(eg, Home screen, Lock screen) that receives request to add Livebox
  */
 class _OSP_EXPORT_ ILiveboxAddRequestListener
+ : public Tizen::Base::Runtime::IEventListener
 {
 public:
        /**
index f51df4f..8f27ab7 100644 (file)
@@ -23,7 +23,6 @@
 #include <unique_ptr.h>
 
 #include <shortcut.h>
-//#include <livebox-service/livebox-service.h>
 
 #include <FBaseSysLog.h>
 #include <FBase.h>
@@ -70,6 +69,16 @@ const char LIVEBOX_ON_TOUCH[] = "Livebox='event=touch'";
 const char LIVEBOX_TRAY_ON_CREATE[] = "LiveboxTray='event=create'";
 const char LIVEBOX_TRAY_ON_DESTROY[] = "LiveboxTray='event=destroy'";
 const char LIVEBOX_TRAY_ON_TOUCH[] = "LiveboxTray='event=touch'";
+
+const String ARG_KEY_INSTANCE_ID = L"_InstanceId";
+const String ARG_KEY_PROVIDER_NAME = L"_ProviderName";
+const String ARG_KEY_USER_INFO = L"_UserInfo";
+const String ARG_KEY_WIDTH = L"_Width";
+const String ARG_KEY_HEIGHT = L"_Height";
+const String ARG_KEY_EVENT_TYPE = L"_EventType";
+const String ARG_KEY_TIME_STAMP = L"_TimeStamp";
+const String ARG_KEY_X = L"_X";
+const String ARG_KEY_Y = L"_Y";
 }
 
 _LiveboxProviderManagerImpl::_LiveboxProviderManagerImpl()
@@ -149,9 +158,9 @@ result
 _LiveboxProviderManagerImpl::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
 {
 
-       /*if( appId == App::App::GetInstance()->GetAppId()) //TODO: optimazing
+       /*if( appId == App::App::GetInstance()->GetAppId())
        {
-
+                //TODO: optimazing for local request
        }
        else*/
        {
@@ -241,22 +250,20 @@ _LiveboxProviderManagerImpl::TerminateAppIfInvalidState()
 void
 _LiveboxProviderManagerImpl::OnAppControlRequestReceived(RequestId reqId, const String& operationId, const String* pUri, const String* pMimeType, const IMap* pArgs)
 {
-       if( pArgs == null && pArgs->GetCount() == 0)
-       {
-               SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null.");
-               return;
-       }
+       SysAssertf( pArgs, "[E_SYSTEN] pArgs should not be null.");
+       SysAssertf( pArgs->GetCount() > 0, "[E_SYSTEN] pArgs should have one more key-values.");
+
        __messageReceived = true;
 
        SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount());
 
-       const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(String(L"Id")));
+       const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
        SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null.");
 
-       const String* pName = dynamic_cast<const String*>(pArgs->GetValue(String(L"Name")));
+       const String* pName = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_PROVIDER_NAME));
        SysTryReturnVoidResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pName is null");
 
-       const String* pParam = dynamic_cast<const String*>(pArgs->GetValue(String(L"Param")));
+       const String* pParam = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_USER_INFO));
        SysTryReturnVoidResult(NID_APP, pParam, E_FAILURE, "[E_FAILURE] pParam is null");
 
        SysLog(NID_APP, "id(%ls), name(%ls), param(%ls)", pInstanceId->GetPointer(), pName->GetPointer(), pParam->GetPointer());
@@ -267,11 +274,11 @@ _LiveboxProviderManagerImpl::OnAppControlRequestReceived(RequestId reqId, const
 
                int width = 0;
                int height = 0;
-               const String* pValue = dynamic_cast<const String*>(pArgs->GetValue(String(L"Width")));
+               const String* pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_WIDTH));
                SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, width);
 
-               pValue = dynamic_cast<const String*>(pArgs->GetValue(String(L"Height")));
+               pValue = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_HEIGHT));
                SysTryReturnVoidResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, height);
 
@@ -287,22 +294,20 @@ _LiveboxProviderManagerImpl::OnAppControlRequestReceived(RequestId reqId, const
        if(operationId.StartsWith(L"LiveboxTray", 0) == true)
        {
                SysTryReturnVoidResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_FAILURE] __pLiveboxPopupProviderFactory is null");
-               //HandleLiveboxPopupRequest(operationId, pArgs);
-               HandleLiveboxPopupRequest(operationId, null);
+               HandleLiveboxPopupRequest(operationId, pArgs);
        }
        else
        {
                SysTryReturnVoidResult(NID_APP, __pLiveboxFactory, E_FAILURE, "[E_FAILURE] __pLiveboxFactory is null");
-               //HandleLiveboxRequest(operationId, pArgs);
-               HandleLiveboxRequest(operationId, null);
+               HandleLiveboxRequest(operationId, pArgs);
        }
        SysLog(NID_APP, "Exit");
 }
 
 result
-_LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs)
+_LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs)
 {
-       if( pArgs == null && pArgs->GetCount() < 3)
+       if( pArgs == null || pArgs->GetCount() < 3)
        {
                SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null.");
                return E_SYSTEM;
@@ -310,7 +315,7 @@ _LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& ope
 
        SysLog(NID_APP, "operationId(%ls), argc(%d)", operationId.GetPointer(), pArgs->GetCount());
 
-       String *pInstanceId =  dynamic_cast<String*>(pArgs->GetAt(0));
+       const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
        SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null.");
 
        /*String *pName =  dynamic_cast<String*>(pArgs->GetAt(1));
@@ -340,11 +345,11 @@ _LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& ope
        {
                int width = 0;
                int height = 0;
-               String* pValue =  dynamic_cast<String*>(pArgs->GetAt(3));
+               const String* pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_WIDTH));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, width);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(4));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_HEIGHT));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, height);
 
@@ -354,11 +359,11 @@ _LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& ope
        {
                int width = 0;
                int height = 0;
-               String* pValue =  dynamic_cast<String*>(pArgs->GetAt(3));
+               const String* pValue =  dynamic_cast<const String*>( pArgs->GetValue(ARG_KEY_WIDTH));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE], ");
                Integer::Parse(*pValue, width);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(4));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_HEIGHT));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, height);
 
@@ -377,19 +382,19 @@ _LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& ope
                double  x = 0.0f;
                double  y = 0.0f;
 
-               String* pValue =  dynamic_cast<String*>(pArgs->GetAt(3));
+               const String* pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_EVENT_TYPE));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, eventType);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(4));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_TIME_STAMP));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Double::Parse(*pValue, timeStamp);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(5));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_X));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Double::Parse(*pValue, x);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(6));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_Y));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Double::Parse(*pValue, y);
 
@@ -400,16 +405,16 @@ _LiveboxProviderManagerImpl::HandleLiveboxRequest(const Tizen::Base::String& ope
 }
 
 result
-_LiveboxProviderManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs)
+_LiveboxProviderManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs)
 {
        SysTryReturnResult(NID_APP, __pLiveboxPopupProviderFactory, E_FAILURE, "[E_FAILURE] __pLiveboxPopupProviderFactory is null");
-       if( pArgs == null && pArgs->GetCount() < 3)
+       if( pArgs == null || pArgs->GetCount() < 3)
        {
                SysAssertf(pArgs, "[E_SYSTEN] pArgs should not be null.");
                return E_SYSTEM;
        }
 
-       String *pInstanceId =  dynamic_cast<String*>(pArgs->GetAt(0));
+       const String* pInstanceId = dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_INSTANCE_ID));
        SysTryReturnResult(NID_APP, pInstanceId, E_FAILURE, "[E_FAILURE] pId is null.");
 
        /*String *pName =  dynamic_cast<String*>(pArgs->GetAt(1));
@@ -425,11 +430,11 @@ _LiveboxProviderManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String
                int width = 0;
                int height = 0;
 
-               String* pValue =  dynamic_cast<String*>(pArgs->GetAt(3));
+               const String* pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_WIDTH));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, width);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(4));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_HEIGHT));;
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, height);
 
@@ -450,19 +455,19 @@ _LiveboxProviderManagerImpl::HandleLiveboxPopupRequest(const Tizen::Base::String
                double  x = 0.0f;
                double  y = 0.0f;
 
-               String* pValue =  dynamic_cast<String*>(pArgs->GetAt(2));
+               const String* pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_EVENT_TYPE));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Integer::Parse(*pValue, eventType);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(3));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_TIME_STAMP));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Double::Parse(*pValue, timeStamp);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(4));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_X));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Double::Parse(*pValue, x);
 
-               pValue =  dynamic_cast<String*>(pArgs->GetAt(5));
+               pValue =  dynamic_cast<const String*>(pArgs->GetValue(ARG_KEY_Y));
                SysTryReturnResult(NID_APP, pValue, E_FAILURE, "[E_FAILURE]");
                Double::Parse(*pValue, y);
 
index b4f75d1..47b8de9 100644 (file)
@@ -28,7 +28,7 @@
 #include <unique_ptr.h>
 #include <FBaseObject.h>
 #include <FBaseColHashMapT.h>
-#include <FBaseColIListT.h>
+#include <FBaseColIMap.h>
 #include <FAppTypes.h>
 #include <FAppIAppControlProviderEventListener.h>
 
@@ -95,8 +95,8 @@ private:
 
        virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData);
 
-       result HandleLiveboxRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs);
-       result HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, Tizen::Base::Collection::IList* pArgs);
+       result HandleLiveboxRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs);
+       result HandleLiveboxPopupRequest(const Tizen::Base::String& operationId, const Tizen::Base::Collection::IMap* pArgs);
 
 private:
        // for livebox