result SendResizeRequest(int width, int height);
result SendRemoveRequest();
- result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::ArrayList* pArgs);
+ result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
#include <FAppTypes.h>
#include <FBaseObject.h>
-#include <FBaseColArrayList.h>
+#include <FBaseColHashMap.h>
-#define TEST_MODE_ENABLE false // If this is enabled, appId of Livebox will be fixed to "EOE7JEjMWn.SampleLiveboxApp" for easy test
#define LIVEBOX_PROVIDER_ID_ENABLE true
typedef struct _bundle_t bundle;//TODO move code to osp-appfw
public Tizen::Base::Object
{
public:
- _LiveboxBase(target_type type, const Tizen::Base::String& info, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int priority);
+ _LiveboxBase(target_type type, const Tizen::Base::String& userInfo, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int priority);
virtual ~_LiveboxBase();
virtual void OnPopupCreated(int width, int height) = 0;
protected:
- result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::ArrayList* pArgs);
+ Tizen::Base::Collection::HashMap* CreateRequestArgs(void);
+ result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
public:
target_type __type;
- Tizen::Base::String __info;
+ Tizen::Base::String __userInfo;
Tizen::Base::String __appId;
Tizen::Base::String __providerName;
Tizen::Base::String __providerId;
class _LiveboxRequestHelper
{
public:
- static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::ArrayList* pArgs);
- static result AddStrArrayToBundle(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
+ static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
+// static result AddStrArrayToBundle(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
// static result ExtractPackageIdAndExecutableName(Tizen::App::AppId inAppId, Tizen::Base::String& outPackageId, Tizen::Base::String& outExecutableName);
};
:public Tizen::Shell::App::_LiveboxBase
{
public:
- _LiveboxPopup(const Tizen::Base::String& info, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int priority);
+ _LiveboxPopup(const Tizen::Base::String& userInfo, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int priority);
virtual ~_LiveboxPopup();
// event handler
const String LIVEBOX_ON_RESIZE(L"Livebox='event=resize'");
const String LIVEBOX_ON_TOUCH(L"Livebox='event=touch'");
+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";
+
const int LIVE_DURATION_MSEC= 30000;//30sec
_Livebox::_Livebox(const String& info, const String& providerId, const String& instanceId, int width, int height, int period, int priority)
void
_Livebox::OnPopupCreated(int width, int height)
{
- __pLiveboxPopup = new (std::nothrow) _LiveboxPopup(__info, __providerId, __instanceId, width, height, __priority);
+ __pLiveboxPopup = new (std::nothrow) _LiveboxPopup(__userInfo, __providerId, __instanceId, width, height, __priority);
__pLiveboxPopup->SetClientId(__ipcClientId);
__pLiveboxPopup->OnPopupCreated(width, height);
result
_Livebox::SendAddRequest(int width, int height)
{
- std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
+/* std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
pArgs->Construct();
pArgs->Add(*new String(__instanceId));
pArgs->Add(*new String(__providerId));
pArgs->Add(*new String(__info));
pArgs->Add(*new String(Integer::ToString(width)));
- pArgs->Add(*new String(Integer::ToString(height)));
+ pArgs->Add(*new String(Integer::ToString(height)));*/
+
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+ pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
+ pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
return SendRequestToApp( __appId, LIVEBOX_ON_ADD, pArgs.get());
}
result
_Livebox::SendUpdateRequest(int width, int height)
{
- std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
- pArgs->Construct();
- pArgs->Add(*new String(__instanceId));
- pArgs->Add(*new String(__providerId));
- pArgs->Add(*new String(__info));
- pArgs->Add(*new String(Integer::ToString(width)));
- pArgs->Add(*new String(Integer::ToString(height)));
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+ pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
+ pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
return SendRequestToApp( __appId, LIVEBOX_ON_UPDATE, pArgs.get());
}
result
_Livebox::SendResizeRequest(int width, int height)
{
- std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
- pArgs->Construct();
- pArgs->Add(*new String(__instanceId));
- pArgs->Add(*new String(__providerId));
- pArgs->Add(*new String(__info));
- pArgs->Add(*new String(Integer::ToString(width)));
- pArgs->Add(*new String(Integer::ToString(height)));
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+ pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
+ pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
return SendRequestToApp( __appId, LIVEBOX_ON_RESIZE, pArgs.get());
}
result
_Livebox::SendRemoveRequest()
{
- std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
- pArgs->Construct();
- pArgs->Add(*new String(__instanceId));
- pArgs->Add(*new String(__providerId));
- pArgs->Add(*new String(__info));
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
return SendRequestToApp( __appId, LIVEBOX_ON_REMOVE, pArgs.get());
}
SysLog(NID_APP, "");
if( HasValidClientId() == false )
{
- std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
- pArgs->Construct();
- pArgs->Add(*new String(__instanceId));
- pArgs->Add(*new String(__providerId));
- pArgs->Add(*new String(__info));
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
- pArgs->Add(*new String(Integer::ToString(event)));
- pArgs->Add(*new String(Double::ToString(timestamp)));
- pArgs->Add(*new String(Double::ToString(x)));
- pArgs->Add(*new String(Double::ToString(y)));
+ pArgs->Add(new String(ARG_KEY_EVENT_TYPE), new String(Integer::ToString(event)));
+ pArgs->Add(new String(ARG_KEY_TIME_STAMP), new String(Double::ToString(timestamp)));
+ pArgs->Add(new String(ARG_KEY_X), new String(Double::ToString(x)));
+ pArgs->Add(new String(ARG_KEY_Y), new String(Double::ToString(y)));
return SendRequestToApp( __appId, LIVEBOX_ON_TOUCH, pArgs.get());
}
}
result
-_Livebox::SendRequestToApp(const AppId& appId, const String& operation, ArrayList* pArgs)
+_Livebox::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
{
result r = _LiveboxBase::SendRequestToApp(appId, operation, pArgs);
RestartLifeDurationTimer();
}*/
std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
- std::unique_ptr<char[]> content_info(_StringConverter::CopyToCharArrayN(__info));
+ std::unique_ptr<char[]> content_info(_StringConverter::CopyToCharArrayN(__userInfo));
int ret = provider_send_updated(packageName.get(), id.get(), width, height, __priority, content_info.get(), null);
SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
{
SysLog(NID_APP, "lifeDuration timer is expired, so terminating livebox app(%ls)..", __providerId.GetPointer() );
-#if TEST_MODE_ENABLE
- AppManager::GetInstance()->TerminateApplication(L"EOE7JEjMWn.SampleLiveboxApp");//todo remove this
-#else
AppManager::GetInstance()->TerminateApplication(__appId);
-#endif
}
else if( &timer == &__UpdateTimer)
{
#include <FBase_StringConverter.h>
#include <FApp_AppMessageImpl.h>
+#include <FApp_AppArg.h>
#include <FApp_AppControlManager.h>
#include <FShell_TemplateUtil.h>
#include <FShell_LiveboxManagerImpl.h>
const String LIVEBOX_TRAY_ON_DESTROY(L"LiveboxTray='event=destroy'");
const String LIVEBOX_TRAY_ON_TOUCH(L"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";
-_LiveboxBase::_LiveboxBase(target_type type, const String& info, const String& providerId, const String& instanceId, int width, int height, int priority)
+
+_LiveboxBase::_LiveboxBase(target_type type, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int priority)
:__type(type)
- ,__info(info)
+ ,__userInfo(userInfo)
,__providerId(providerId)
,__instanceId(instanceId)
,__width(width)
,__isForeground(true)
,__ipcClientId(-1)
{
- /*providerId.IndexOf(".", 11, index);
- providerId.SubString(0, index, __appId);
- providerId.SubString(index+1, __providerName);*/
_LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, __appId, __providerName);
- SysLog(NID_APP, "providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
- SysLog(NID_APP, "appId(%ls)", __appId.GetPointer());
+ SysLog(NID_APP, "appId(%ls), providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __appId.GetPointer(), __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
}
_LiveboxBase::~_LiveboxBase()
return E_SUCCESS;
}
+Tizen::Base::Collection::HashMap*
+_LiveboxBase::CreateRequestArgs(void)
+{
+ HashMap* pArgs = new (std::nothrow) HashMap(SingleObjectDeleter);
+ pArgs->Construct();
+ pArgs->Add(new String(ARG_KEY_INSTANCE_ID), new String(__instanceId));
+ pArgs->Add(new String(ARG_KEY_PROVIDER_NAME), new String(__providerName));
+ pArgs->Add(new String(ARG_KEY_USER_INFO), new String(__userInfo));
+
+ return pArgs;
+}
+
result
-_LiveboxBase::SendRequestToApp(const AppId& appId, const String& operation, ArrayList* pArgs)
+_LiveboxBase::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
{
if( __isForeground == false)
{
return E_SUCCESS;
}
-#if TEST_MODE_ENABLE
- const String sampleLiveboxAppId(L"EOE7JEjMWn.SampleLiveboxApp"); //TODO: specify appid for temporary test
- return _LiveboxRequestHelper::SendRequestToApp(sampleLiveboxAppId, operation, pArgs);
-#else
return _LiveboxRequestHelper::SendRequestToApp(appId, operation, pArgs);
-#endif
-
}
result
-_LiveboxRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, ArrayList* pArgs)
+_LiveboxRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
{
- SysLog(NID_APP, "operation(%ls)", operation.GetPointer());
+ SysLog(NID_APP, "appId(%ls), operation(%ls), arg count(%d)", appId.GetPointer(), operation.GetPointer(), pArgs->GetCount() );
- String outAppId;
- String execName;
+/* std::unique_ptr<IMapEnumerator> pMapEnum(pArgs->GetMapEnumeratorN());
+ SysTryReturnResult(NID_APP, pMapEnum.get(), E_SYSTEM, "failed to get GetMapEnumeratorN");
-// ExtractPackageIdAndExecutableName(appId, outAppId, execName);
+ while( pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ const String* pKey = dynamic_cast<const String*>(pMapEnum->GetKey());
+ const String* pValue = dynamic_cast<const String*>(pMapEnum->GetValue());
- const char OSP_K_APPCONTROL_OPERATION[] = "__OSP_APPCONTROL_OPERATION__";
- const char OSP_K_APPCONTROL_INTERNAL_OPERATION[] = "__OSP_APPCONTROL_INTERNAL_INTERNAL_OPERATION__";
- const char OSP_K_ARG[] = "__OSP_ARGS__";
+ if( pKey == null)
+ {
+ SysLog(NID_APP, "key is null");
+ continue;
+ }
+ if( pValue == null)
+ {
+ SysLog(NID_APP, "pValue is null");
+ continue;
+ }
+
+ SysLog(NID_APP, "key(%ls), value(%ls)", pKey->GetPointer(), pValue->GetPointer() );
+
+ }*/
_AppMessageImpl msg;
- msg.AddData(OSP_K_APPCONTROL_OPERATION, operation);
msg.AddData(OSP_K_APPCONTROL_INTERNAL_OPERATION, L"livebox");
- AddStrArrayToBundle(msg.GetBundle(), OSP_K_ARG, pArgs);
-
+ // AddStrArrayToBundle(msg.GetBundle(), OSP_K_ARG, pArgs);
+ Tizen::App::_AppArg::AddStrMap(msg.GetBundle(), pArgs);
std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId) );
std::unique_ptr<char[]> pOperation(_StringConverter::CopyToCharArrayN(operation) );
return E_SYSTEM;
}*/
+/*
// helper for bundle
result
_LiveboxRequestHelper::AddStrArrayToBundle(bundle* b, const char* key, const IList* pList)
return r;
}
+*/
} } } // Tizen::Shell::App {
SysLog(NID_APP, "%ls", pLivebox->__instanceId.GetPointer());
SysLog(NID_APP, "%ls, %ls", pLivebox->__providerId.GetPointer(), appId.GetPointer());
-#if TEST_MODE_ENABLE
- String sampleAppId = L"EOE7JEjMWn.SampleLiveboxApp";
- if( sampleAppId == appId) //TODO: specify appid for temporary test
-#else
if ( pLivebox->__appId == appId )
-#endif
{
pLivebox->SetClientId(clientId);
SysLog(NID_APP, "client is registered.(%d)", clientId);
_Livebox* pLivebox = null;
__liveboxes.GetAt(i, pLivebox);
-#if TEST_MODE_ENABLE
- String sampleAppId = L"EOE7JEjMWn.SampleLiveboxApp";
- if( sampleAppId == appId) //TODO: specify appid for temporary test
-#else
if ( pLivebox->__providerId == providerId )
-#endif
{
pLivebox->OnUpdate();
}
result
LiveboxManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)//, const Tizen::Base::String& param)
{
- SysLog(NID_APP, "Enter.");
+ SysLog(NID_APP, "%ls, %ls", appId.GetPointer(), providerName.GetPointer() );
bool found = false;
for( int i = 0; i < __liveboxes.GetCount(); i++ )
{
_Livebox* pLivebox = null;
__liveboxes.GetAt(i, pLivebox);
- SysLog(NID_APP, "%ls", pLivebox->__instanceId.GetPointer());
if ( pLivebox->__appId == appId && pLivebox->__providerName == providerName)
{
SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
found = true;
-// pLivebox->OnUpdate();
}
}
SysLog(NID_APP, "Exit.");
case LOCAL_EVENT_REQUEST_UPDATE:
{
_Livebox* pLivebox = dynamic_cast<_Livebox*>( pArgs->GetAt(0) );
- SysLog(NID_APP, "111.");
SysTryReturnVoidResult(NID_APP, pLivebox != null, E_INVALID_STATE, "_Livebox is null!.");
- SysLog(NID_APP, "222.");
+
pLivebox->OnUpdate();
- SysLog(NID_APP, "333.");
+
pArgs->RemoveAll();
delete pArgs;
}
const String LIVEBOX_TRAY_ON_DESTROY(L"LiveboxTray='event=destroy'");
const String LIVEBOX_TRAY_ON_TOUCH(L"LiveboxTray='event=touch'");
+const String ARG_KEY_WIDTH = L"_Width";
+const String ARG_KEY_HEIGHT = L"_Height";
+
+
_LiveboxPopup::_LiveboxPopup(const String& info, const String& appId, const String& instanceId, int width, int height, int priority)
:_LiveboxBase(TYPE_PD, info, appId, instanceId, width, height, priority)
{
result
_LiveboxPopup::SendPopupCreateRequest(int width, int height)
{
- std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
- pArgs->Construct();
- pArgs->Add(*new String(__instanceId));
- pArgs->Add(*new String(__providerId));
- pArgs->Add(*new String(__info));
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
- pArgs->Add(*new String(Integer::ToString(width)));
- pArgs->Add(*new String(Integer::ToString(height)));
+ pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
+ pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_CREATE, pArgs.get());
}
result
_LiveboxPopup::SendPopupDestroyRequest()
{
- std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
- pArgs->Construct();
- pArgs->Add(*new String(__instanceId));
- pArgs->Add(*new String(__providerId));
- pArgs->Add(*new String(__info));
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_DESTROY, pArgs.get());
}