From: jungmin76.park Date: Fri, 1 Feb 2013 06:05:07 +0000 (+0900) Subject: change class name '_Livebox -> _LiveboxContext' X-Git-Tag: submit/tizen_2.1/20130424.232341~11^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=997f2fcbf18d8fd0cbd2b74ca6062c48da821e1f;p=platform%2Fframework%2Fnative%2Fappwidget-service.git change class name '_Livebox -> _LiveboxContext' Change-Id: Ic14dca71bd7bf98e8c48810de27261a6f3642260 Signed-off-by: jungmin76.park --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 7449ac4..3355a21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,11 +26,11 @@ INCLUDE_DIRECTORIES ( SET (${this_target}_SOURCE_FILES src/OspLiveboxService.cpp src/OspLiveboxServiceEntry.cpp - src/FShell_Livebox.cpp - src/FShell_LiveboxBase.cpp + src/FShell_LiveboxContext.cpp + src/FShell_LiveboxContextBase.cpp src/FShell_LiveboxManagerService.cpp src/FShell_LiveboxManagerStub.cpp - src/FShell_LiveboxPopup.cpp + src/FShell_LiveboxPopupContext.cpp ) ## SET EXTRA COMPILER FLAGS diff --git a/inc/FShell_Livebox.h b/inc/FShell_Livebox.h deleted file mode 100644 index ec90989..0000000 --- a/inc/FShell_Livebox.h +++ /dev/null @@ -1,87 +0,0 @@ -// -// Open Service Platform -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. -// -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. -// - -/** - * @file FShell_Livebox.h - * @brief This is the header file for the _Livebox class. - * - * This header file contains the declarations of the _Livebox class. - */ - -#ifndef FShell_Livebox_H_ -#define FShell_Livebox_H_ - -#include -#include - -#include -#include -#include -#include - -#include "FShell_LiveboxBase.h" - - -#define MAX_PACKAGENAME 512 - - -namespace Tizen { namespace Shell { namespace App -{ -class _LiveboxPopup; - -class _Livebox - : public _LiveboxBase - ,public Tizen::Base::Runtime::ITimerEventListener -{ -public: - _Livebox(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, - int width, int height, int period, int priority); - virtual ~_Livebox(); - void OnAdded(void); - void OnUpdate(const Tizen::Base::String& argument); - void OnResize(int width, int height); - void OnRemoved(); - void OnForeground(); - void OnBackground(); - virtual void OnPopupCreated(int width, int height); - virtual void OnPopupDestoyed(void); - - result RequestUpdateRemote(int width, int height); - - _LiveboxPopup* GetLiveboxPopup() const; - virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y); - - void RestartLifeDurationTimer(); - -private: - result SendAddRequest(int width, int height); - result SendUpdateRequest(int width, int height, const Tizen::Base::String& argument); - result SendResizeRequest(int width, int height); - result SendRemoveRequest(); - - 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); - -private: - _LiveboxPopup* __pLiveboxPopup; - Tizen::Base::Runtime::Timer __lifeDurationTimer; - Tizen::Base::Runtime::Timer __UpdateTimer; - int __UpdateMillis; - -}; - - -} } } // Tizen::Shell::App { - - -#endif /* FShell_Livebox_H_ */ diff --git a/inc/FShell_LiveboxBase.h b/inc/FShell_LiveboxBase.h deleted file mode 100644 index 976aedc..0000000 --- a/inc/FShell_LiveboxBase.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * FShell_LiveboxBase.h - * - * Created on: Oct 20, 2012 - * Author: jungmin76park - */ - -#ifndef _FSHL_LIVEBOXBASE_H_ -#define _FSHL_LIVEBOXBASE_H_ - -#include - -#include -#include -#include - -#define LIVEBOX_PROVIDER_ID_ENABLE true - -typedef struct _bundle_t bundle;//TODO move code to osp-appfw - -namespace Tizen { namespace Shell { namespace App -{ - -class _LiveboxBase: - public Tizen::Base::Object -{ -public: - _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; - virtual void OnPopupDestoyed(void) = 0; - - virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0; - - void SetClientId(int clientId); - bool HasValidClientId() const; - // for buffered livebox - int GetSharedMemId(int w, int h); - result ReleaseSharedMem(); - - -protected: - 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 __userInfo; - Tizen::Base::String __appId; - Tizen::Base::String __providerName; - Tizen::Base::String __providerId; - Tizen::Base::String __instanceId; - int __width; - int __height; - int __priority; - -protected: - bool __isForeground;// LB only? - int __ipcClientId; - -private: - void *__buffer; - struct livebox_buffer *__buffer_info; -}; - -class _LiveboxRequestHelper -{ -public: - 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); -}; - -} /* namespace App */ -} /* namespace Livebox */ -} /* namespace Samsung */ -#endif /* _FSHL_LIVEBOXBASE_H_ */ diff --git a/inc/FShell_LiveboxContext.h b/inc/FShell_LiveboxContext.h new file mode 100644 index 0000000..bd9f32a --- /dev/null +++ b/inc/FShell_LiveboxContext.h @@ -0,0 +1,92 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FShell_LiveboxContext.h + * @brief This is the header file for the _LiveboxContext class. + * + * This header file contains the declarations of the _LiveboxContext class. + */ + +#ifndef _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_ +#define _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_ + +#include +#include + +#include +#include +#include +#include + +#include "FShell_LiveboxContextBase.h" + + +#define MAX_PACKAGENAME 512 + + +namespace Tizen { namespace Shell { namespace App +{ +class _LiveboxPopupContext; + +class _LiveboxContext + : public _LiveboxContextBase + ,public Tizen::Base::Runtime::ITimerEventListener +{ +public: + _LiveboxContext(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, + int width, int height, int period, int priority); + virtual ~_LiveboxContext(); + void OnAdded(void); + void OnUpdate(const Tizen::Base::String& argument); + void OnResize(int width, int height); + void OnRemoved(); + void OnForeground(); + void OnBackground(); + virtual void OnPopupCreated(int width, int height); + virtual void OnPopupDestoyed(void); + + result RequestUpdateRemote(int width, int height); + + _LiveboxPopupContext* GetLiveboxPopup() const; + virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y); + + void RestartLifeDurationTimer(); + +private: + result SendAddRequest(int width, int height); + result SendUpdateRequest(int width, int height, const Tizen::Base::String& argument); + result SendResizeRequest(int width, int height); + result SendRemoveRequest(); + + 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); + +private: + _LiveboxPopupContext* __pLiveboxPopup; + Tizen::Base::Runtime::Timer __lifeDurationTimer; + Tizen::Base::Runtime::Timer __UpdateTimer; + int __UpdateMillis; + +}; + + +} } } // Tizen::Shell::App { + + +#endif // _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_ diff --git a/inc/FShell_LiveboxContextBase.h b/inc/FShell_LiveboxContextBase.h new file mode 100644 index 0000000..2968b58 --- /dev/null +++ b/inc/FShell_LiveboxContextBase.h @@ -0,0 +1,95 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FShell_LiveboxContextBase.h + * @brief This is the header file for the _LiveboxContextBase class. + * + * This header file contains the declarations of the _LiveboxContextBase class. + */ + +#ifndef _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_ +#define _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_ + +#include + +#include +#include +#include + +#define LIVEBOX_PROVIDER_ID_ENABLE true + +typedef struct _bundle_t bundle;//TODO move code to osp-appfw + +namespace Tizen { namespace Shell { namespace App +{ + +class _LiveboxContextBase: + public Tizen::Base::Object +{ +public: + _LiveboxContextBase(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 ~_LiveboxContextBase(); + + virtual void OnPopupCreated(int width, int height) = 0; + virtual void OnPopupDestoyed(void) = 0; + + virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0; + + void SetClientId(int clientId); + bool HasValidClientId() const; + // for buffered livebox + int GetSharedMemId(int w, int h); + result ReleaseSharedMem(); + + +protected: + 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 __userInfo; + Tizen::Base::String __appId; + Tizen::Base::String __providerName; + Tizen::Base::String __providerId; + Tizen::Base::String __instanceId; + int __width; + int __height; + int __priority; + +protected: + bool __isForeground;// LB only? + int __ipcClientId; + +private: + void *__buffer; + struct livebox_buffer *__buffer_info; +}; + +class _LiveboxRequestHelper +{ +public: + 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); +}; + +} /* namespace App */ +} /* namespace Livebox */ +} /* namespace Samsung */ +#endif // _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_ diff --git a/inc/FShell_LiveboxManagerService.h b/inc/FShell_LiveboxManagerService.h index 05a5cd2..f47721d 100644 --- a/inc/FShell_LiveboxManagerService.h +++ b/inc/FShell_LiveboxManagerService.h @@ -1,13 +1,18 @@ // // Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. // -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // /** @@ -17,16 +22,15 @@ * This header file contains the declarations of the %LiveboxManagerService class. */ -#ifndef FShell_LiveboxMANAGERSERVICE_H_ -#define FShell_LiveboxMANAGERSERVICE_H_ +#ifndef _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_ +#define _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_ #include #include #include -//#include -#include -//#include #include + +#include "FShell_LiveboxContext.h" #include "FShell_LiveboxManagerStub.h" namespace Tizen { namespace Shell { namespace App { @@ -34,12 +38,11 @@ namespace Tizen { namespace Shell { namespace App { class LiveboxManagerService :public Tizen::Shell::App::_LiveboxManagerStub -// ,public Tizen::App::_IAppManagerEventListener ,public Tizen::Base::Runtime::ITimerEventListener { public: static LiveboxManagerService* GetInstance(void); - result AddLivebox(_Livebox* pLivebox); + result AddLivebox(_LiveboxContext* pLivebox); result RemoveLivebox(const char* pPackageName, const char* pId, bool free); private: @@ -75,9 +78,6 @@ private: LiveboxManagerService(); virtual ~LiveboxManagerService(); -// virtual void OnApplicationLaunched(const Tizen::App::AppId& appId, Tizen::App::_AppType type); -// virtual void OnApplicationTerminated(const Tizen::App::AppId& appId, Tizen::App::_AppType type); - virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId); virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId); @@ -87,7 +87,7 @@ private: void StartPingTimer(); virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); - _Livebox* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const; + _LiveboxContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const; class _TaskHandlerThread @@ -100,11 +100,11 @@ private: }; private: - Tizen::Base::Collection::ArrayListT<_Livebox*> __liveboxes; + Tizen::Base::Collection::ArrayListT<_LiveboxContext*> __liveboxContextList; Tizen::Base::Runtime::Timer __pingTimer; _TaskHandlerThread __handlerThread; }; } } } // Tizen::Shell::App { -#endif /* FShell_LiveboxMANAGERSERVICE_H_ */ +#endif // _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_ diff --git a/inc/FShell_LiveboxManagerStub.h b/inc/FShell_LiveboxManagerStub.h index 6a54d54..b4d8770 100644 --- a/inc/FShell_LiveboxManagerStub.h +++ b/inc/FShell_LiveboxManagerStub.h @@ -1,24 +1,29 @@ // // Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. // -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // /** - * @file FAppAppManager.h - * @brief This is the header file for the %AppManager class. + * @file FShell_LiveboxManagerStub.h + * @brief This is the header file for the %_LiveboxManagerStub class. * - * This header file contains the declarations of the %AppManager class. + * This header file contains the declarations of the %_LiveboxManagerStub class. */ -#ifndef _FAPP_INTERNAL_APP_MANAGER_STUB_H_ -#define _FAPP_INTERNAL_APP_MANAGER_STUB_H_ +#ifndef _FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_ +#define _FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_ #include #include @@ -91,4 +96,4 @@ protected: }}} -#endif//_FAPP_INTERNAL_APP_MANAGER_STUB_H_ +#endif//_FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_ diff --git a/inc/FShell_LiveboxPopup.h b/inc/FShell_LiveboxPopup.h deleted file mode 100644 index 03f791a..0000000 --- a/inc/FShell_LiveboxPopup.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * FShell_LiveboxPopup.h - * - * Created on: Oct 19, 2012 - * Author: jungmin76park - */ - -#ifndef _FSHL_LiveboxPopup_H_ -#define _FSHL_LiveboxPopup_H_ - -#include "FShell_LiveboxBase.h" - -namespace Tizen { namespace Shell { namespace App -{ - -class _LiveboxPopup - :public Tizen::Shell::App::_LiveboxBase -{ -public: - _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 - void OnPopupCreated(int width, int height); - void OnPopupDestoyed(void); - - // request to app - result SendPopupCreateRequest(int width, int height); - result SendPopupDestroyRequest(); - virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y); - - result RequestUpdateRemote(); -}; - - -} /* namespace App */ -} /* namespace Livebox */ -} /* namespace Samsung */ -#endif /* _FSHL_LiveboxPopup_H_ */ diff --git a/inc/FShell_LiveboxPopupContext.h b/inc/FShell_LiveboxPopupContext.h new file mode 100644 index 0000000..8b72e61 --- /dev/null +++ b/inc/FShell_LiveboxPopupContext.h @@ -0,0 +1,56 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FShell_LiveboxPopupContext.h + * @brief This is the header file for the %_LiveboxPopupContext class. + * + * This header file contains the declarations of the %_LiveboxPopupContext class. + */ + +#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_ +#define _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_ + +#include "FShell_LiveboxContextBase.h" + +namespace Tizen { namespace Shell { namespace App +{ + +class _LiveboxPopupContext + :public Tizen::Shell::App::_LiveboxContextBase +{ +public: + _LiveboxPopupContext(const Tizen::Base::String& userInfo, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int priority); + virtual ~_LiveboxPopupContext(); + + // event handler + void OnPopupCreated(int width, int height); + void OnPopupDestoyed(void); + + // request to app + result SendPopupCreateRequest(int width, int height); + result SendPopupDestroyRequest(); + virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y); + + result RequestUpdateRemote(); +}; + + +} /* namespace App */ +} /* namespace Livebox */ +} /* namespace Samsung */ +#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_ diff --git a/inc/OspLiveboxService.h b/inc/OspLiveboxService.h index 695afb7..6bc93eb 100644 --- a/inc/OspLiveboxService.h +++ b/inc/OspLiveboxService.h @@ -17,20 +17,18 @@ * This header file contains the declarations of the OspLiveboxService class. */ -#ifndef _OSPLIVEBOXSERVICE_H_ -#define _OSPLIVEBOXSERVICE_H_ +#ifndef _OSP_LIVEBOX_SERVICE_H_ +#define _OSP_LIVEBOX_SERVICE_H_ #include #include #include -//#include /** * [OspLiveboxService] ServiceApp must inherit from ServiceApp class * which provides basic features necessary to define an ServiceApp. */ class OspLiveboxService -// : public Tizen::App::ServiceApp : public Tizen::App::ServiceApp { public: diff --git a/src/FShell_Livebox.cpp b/src/FShell_Livebox.cpp deleted file mode 100644 index 3d92247..0000000 --- a/src/FShell_Livebox.cpp +++ /dev/null @@ -1,289 +0,0 @@ -// -// Open Service Platform -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. -// -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. -// - -/** - * @file FShell_Livebox.cpp - * @brief This is the implementation for the Livebox class. - */ - -#include -#include - -#include "provider_buffer.h" - -#include -#include -#include - -#include - -#include "FShell_LiveboxManagerService.h" -#include "FShell_LiveboxPopup.h" -#include "FShell_LiveboxBase.h" -#include "FShell_Livebox.h" - - -namespace Tizen { namespace Shell { namespace App -{ - -using namespace Tizen::App; -using namespace Tizen::Base; -using namespace Tizen::Base::Collection; - - - -const String LIVEBOX_ON_ADD(L"Livebox='event=add'"); -const String LIVEBOX_ON_REMOVE(L"Livebox='event=remove'"); -const String LIVEBOX_ON_UPDATE(L"Livebox='event=update'"); -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) -:_LiveboxBase(TYPE_LB, info, providerId, instanceId, width, height, priority) -,__pLiveboxPopup(null), __UpdateMillis(period) -{ - SysLog(NID_APP, "period(%d)", period); - - __lifeDurationTimer.Construct(*this);//, true); - __lifeDurationTimer.Start(LIVE_DURATION_MSEC); - - SysLog(NID_APP, "period(%d)", __UpdateMillis); - if( __UpdateMillis > 0) - { - __UpdateTimer.Construct(*this);//, false); - __UpdateTimer.StartAsRepeatable(__UpdateMillis); - } -} - -_Livebox::~_Livebox() -{ - SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); - __lifeDurationTimer.Cancel(); - __UpdateTimer.Cancel(); -} - -_LiveboxPopup* -_Livebox::GetLiveboxPopup() const -{ - return __pLiveboxPopup; -} - -void -_Livebox::OnAdded(void) -{ - SendAddRequest(__width, __height); -} - -void -_Livebox::OnRemoved() -{ - SendRemoveRequest(); -} - -void -_Livebox::OnUpdate(const String& argument) -{ - SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); - - SendUpdateRequest(__width, __height, argument); -} - -void -_Livebox::OnResize(int width, int height) -{ - SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); - - __width = width; - __height = height; - SendResizeRequest(__width, __height); -} - -void -_Livebox::OnForeground() -{ - SysLog(NID_APP, ""); - __isForeground = true; - - __UpdateTimer.Cancel(); - __UpdateTimer.StartAsRepeatable(__UpdateMillis); -} - -void -_Livebox::OnBackground() -{ - SysLog(NID_APP, ""); - __isForeground = false; - __UpdateTimer.Cancel(); -} - -void -_Livebox::OnPopupCreated(int width, int height) -{ - __pLiveboxPopup = new (std::nothrow) _LiveboxPopup(__userInfo, __providerId, __instanceId, width, height, __priority); - __pLiveboxPopup->SetClientId(__ipcClientId); - __pLiveboxPopup->OnPopupCreated(width, height); - - __lifeDurationTimer.Cancel(); -} - -void -_Livebox::OnPopupDestoyed(void) -{ - if (__pLiveboxPopup) - { - __pLiveboxPopup->OnPopupDestoyed(); - delete __pLiveboxPopup; - __pLiveboxPopup = null; - } - RestartLifeDurationTimer(); -} - -result -_Livebox::SendAddRequest(int width, int height) -{ -/* std::unique_ptr 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 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, const String& argument) -{ - std::unique_ptr 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 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 pArgs (CreateRequestArgs() ); - - return SendRequestToApp( __appId, LIVEBOX_ON_REMOVE, pArgs.get()); -} - -result -_Livebox::SendTouchEvent(buffer_event event, double timestamp, double x, double y) -{ - SysLog(NID_APP, ""); - if( HasValidClientId() == false ) - { - std::unique_ptr pArgs (CreateRequestArgs() ); - - 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()); - } - else - { -// SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running"); - LiveboxManagerService::GetInstance()->SendTouchEvent(__ipcClientId, __instanceId, event, timestamp, x, y); - } - return E_SUCCESS; -} - -result -_Livebox::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs) -{ - result r = _LiveboxBase::SendRequestToApp(appId, operation, pArgs); - RestartLifeDurationTimer(); - - return r; -} - -result -_Livebox::RequestUpdateRemote(int width, int height) -{ - /*if( GetLiveboxPopup() != null) - { - SysLog(NID_APP, "LiveboxPopup is appeared, so livebox doesn't need to update"); - return E_SUCCESS; - }*/ - std::unique_ptr packageName(_StringConverter::CopyToCharArrayN(__providerId)); - std::unique_ptr id(_StringConverter::CopyToCharArrayN(__instanceId)); - std::unique_ptr 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, "Done"); - return E_SUCCESS; -} - -void -_Livebox::RestartLifeDurationTimer() -{ - __lifeDurationTimer.Cancel(); - __lifeDurationTimer.Start(LIVE_DURATION_MSEC); - SysLog(NID_APP, "lifeDuration timer restarted (%d)msec", LIVE_DURATION_MSEC); -} - -void -_Livebox::OnTimerExpired(Tizen::Base::Runtime::Timer& timer) -{ - SysLog(NID_APP, ""); - - if( &timer == &__lifeDurationTimer) - { - SysLog(NID_APP, "lifeDuration timer is expired, so terminating livebox app(%ls)..", __providerId.GetPointer() ); - - ReleaseSharedMem(); - AppManager::GetInstance()->TerminateApplication(__appId); - - } - else if( &timer == &__UpdateTimer) - { - SysLog(NID_APP, "update timer is expired for livebox app(%ls)..", __providerId.GetPointer() ); - OnUpdate(L""); - } -} - - -} } } // Tizen::Shell::App { - diff --git a/src/FShell_LiveboxBase.cpp b/src/FShell_LiveboxBase.cpp deleted file mode 100644 index 8476845..0000000 --- a/src/FShell_LiveboxBase.cpp +++ /dev/null @@ -1,334 +0,0 @@ -// -// Open Service Platform -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. -// -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. -// - -/** - * @file FShell_LiveboxBase.cpp - * @brief This is the implementation for the Livebox class. - */ - -#include -#include - -#include "provider_buffer.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "FShell_LiveboxBase.h" - -// provider/src/fb.c -struct fb_info { - char *id; - int w; - int h; - int bufsz; - void *buffer; - - int handle; -}; - -// provider/inc/provider_buffer_internal.h -struct livebox_buffer { - enum { - BUFFER_CREATED = 0x00beef00, - BUFFER_DESTROYED = 0x00dead00, - } state; - - enum target_type type; - - union { - int fd; /* File handle(descriptor) */ - int id; /* SHM handle(id) */ - } handle; - - char *pkgname; - char *id; - int width; - int height; - int pixel_size; - - struct fb_info *fb; - - int (*handler)(struct livebox_buffer *info, enum buffer_event event, double timestamp, double x, double y, void *data); - void *data; -}; - -static int LiveboxHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event, - double timestamp, double x, double y, void* data); - -namespace Tizen { namespace Shell { namespace App -{ - -using namespace Tizen::App; -using namespace Tizen::Base; -using namespace Tizen::Base::Collection; - - -const String LIVEBOX_ON_ADD(L"Livebox='event=add'"); -const String LIVEBOX_ON_REMOVE(L"Livebox='event=remove'"); -const String LIVEBOX_ON_UPDATE(L"Livebox='event=update'"); -const String LIVEBOX_ON_RESIZE(L"Livebox='event=resize'"); -const String LIVEBOX_ON_TOUCH(L"Livebox='event=touch'"); -const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'"); -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& userInfo, const String& providerId, const String& instanceId, int width, int height, int priority) - :__type(type) - ,__userInfo(userInfo) - ,__providerId(providerId) - ,__instanceId(instanceId) - ,__width(width) - ,__height(height) - ,__priority(priority) - ,__isForeground(true) - ,__ipcClientId(-1) - ,__buffer_info(null) - ,__buffer(null) // __pEcoreEvas(null), __pEvas(null), __current(0) -{ - _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, __appId, __providerName); - - 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() -{ - SysLog(NID_APP, "providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); -} - - -void -_LiveboxBase::SetClientId(int clientId) -{ - __ipcClientId = clientId; -} - -bool -_LiveboxBase::HasValidClientId() const -{ - SysLog(NID_APP, "%d", __ipcClientId); - return (__ipcClientId > -1); -} - -int -_LiveboxBase::GetSharedMemId(int w, int h) -{ - SysLog(NID_APP, "Enter"); - - if( __buffer_info == null) - { - std::unique_ptr packageName(_StringConverter::CopyToCharArrayN(__providerId)); - std::unique_ptr id(_StringConverter::CopyToCharArrayN(__instanceId)); - - __buffer_info = provider_buffer_acquire(__type, packageName.get(), id.get(), w, h, sizeof(int), LiveboxHandleBufferEventCallback, this); - SysTryReturnResult(NID_APP, __buffer_info , -1, "[E_SYSTEM] failed to provider_buffer_acquire"); - SysLog(NID_APP, "provider_buffer_acquire successed"); - - __buffer = provider_buffer_ref(__buffer_info); - SysTryReturnResult(NID_APP, __buffer , -1, "[E_SYSTEM] failed to provider_buffer_ref"); - SysLog(NID_APP, "provider_buffer_ref successed"); - } - - int bufferId = __buffer_info->fb->handle; - - SysLog(NID_APP, "(%d) Exit", bufferId); - return bufferId; -} - -result -_LiveboxBase::ReleaseSharedMem() -{ - SysLog(NID_APP, "Enter"); - - int ret; - - if( __buffer) - { - ret = provider_buffer_unref(__buffer); - __buffer = null; - SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_buffer_unref"); - SysLog(NID_APP, "provider_buffer_unref successed"); - } - - if( __buffer_info) - { - ret = provider_buffer_release(__buffer_info); - __buffer_info = null; - SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_buffer_release"); - SysLog(NID_APP, "provider_buffer_release successed"); - } - - SysLog(NID_APP, "Exit."); - - 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, HashMap* pArgs) -{ - if( __isForeground == false) - { - SysLog(NID_APP, "livebox isn't foreground, so, message skip"); - return E_SUCCESS; - } - - return _LiveboxRequestHelper::SendRequestToApp(appId, operation, pArgs); -} - -result -_LiveboxRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs) -{ - SysLog(NID_APP, "appId(%ls), operation(%ls), arg count(%d)", appId.GetPointer(), operation.GetPointer(), pArgs->GetCount() ); - - _AppMessageImpl msg; - msg.AddData(OSP_K_APPCONTROL_INTERNAL_OPERATION, L"livebox"); - Tizen::App::_AppArg::AddStrMap(msg.GetBundle(), pArgs); - - std::unique_ptr pAppId(_StringConverter::CopyToCharArrayN(appId) ); - std::unique_ptr pOperation(_StringConverter::CopyToCharArrayN(operation) ); - - return Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null); -} - -/*result -_LiveboxRequestHelper::ExtractPackageIdAndExecutableName(AppId appId, AppId& outPackageId, String& outExecutableName) -{ - const int APP_ID_LEN = 10; - - if (appId.GetLength() > APP_ID_LEN) - { - result r = appId.SubString(APP_ID_LEN + 1, appId.GetLength() - (APP_ID_LEN + 1), outExecutableName); - SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "invalid AppId(%ls)", appId.GetPointer()); - - r = appId.SubString(0, APP_ID_LEN, outPackageId); - SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "invalid AppId(%ls)", appId.GetPointer()); - - return E_SUCCESS; - } - return E_SYSTEM; -}*/ - -/* -// helper for bundle -result -_LiveboxRequestHelper::AddStrArrayToBundle(bundle* b, const char* key, const IList* pList) -{ - bundle* pb = b; - SysTryReturnResult(NID_APP, pb != NULL, E_INVALID_ARG, "Empty bundle."); - - if (pList == null || pList->GetCount() == 0) - { - SysLog(NID_APP, "No element added for bundle."); - return E_SUCCESS; - } - - int i = 0; - const int count = pList->GetCount(); - - const char** pSa = new (std::nothrow) const char*[count]; - SysTryReturnResult(NID_APP, pSa != null, E_OUT_OF_MEMORY, "Memory allocation failure with cound %d.", count); - - for (i = 0; i < count; i++) - { - pSa[i] = null; - - const String* pStr = static_cast(pList->GetAt(i)); - if (pStr) - { - pSa[i] = _StringConverter::CopyToCharArrayN(*pStr); - } - } - - result r = E_SUCCESS; - - int ret = bundle_add_str_array(pb, key, pSa, count); - SysTryReturnResult(NID_APP, ret >= 0, E_SYSTEM, "Bundle add failre with %d.", strerror(errno)); - -//CATCH: - for (i = 0; i < count; i++) - { - delete[] pSa[i]; - } - - delete[] pSa; - - return r; -} -*/ - -} } } // Tizen::Shell::App { - - -//////////////////////////////////////////// -// callback -//////////////////////////////////////////// -static int LiveboxHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event, - double timestamp, double x, double y, void* data) -{ - SysLog(NID_APP, "timestamp(%f), x(%f), y(%f)", timestamp, x, y); - - Tizen::Shell::App::_LiveboxBase *pLiveboxBase = static_cast(data); - SysTryReturn(NID_APP, pLiveboxBase != null, 0, E_SYSTEM, "[E_SYSTEM] retrieved pLiveboxBase is null"); - -// const char *pkgname = provider_buffer_pkgname(info); -// const char *id = provider_buffer_id(info); -// enum target_type type = provider_buffer_type(info); - - if( event == BUFFER_EVENT_ENTER) - { - SysLog(NID_APP, "BUFFER_EVENT_ENTER"); - } - else if( event == BUFFER_EVENT_LEAVE) - { - SysLog(NID_APP, "BUFFER_EVENT_LEAVE"); - } - else if( event == BUFFER_EVENT_DOWN) - { - SysLog(NID_APP, "BUFFER_EVENT_DOWN"); - } - else if( event == BUFFER_EVENT_MOVE) - { - SysLog(NID_APP, "BUFFER_EVENT_MOVE"); - } - else if( event == BUFFER_EVENT_UP) - { - SysLog(NID_APP, "BUFFER_EVENT_UP"); - } - - pLiveboxBase->SendTouchEvent(event, timestamp, x, y); - - return 0; -} diff --git a/src/FShell_LiveboxContext.cpp b/src/FShell_LiveboxContext.cpp new file mode 100644 index 0000000..5178dd7 --- /dev/null +++ b/src/FShell_LiveboxContext.cpp @@ -0,0 +1,294 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FShell_LiveboxContext.cpp + * @brief This is the implementation for the _LiveboxContext class. + */ + +#include +#include + +#include "provider_buffer.h" + +#include +#include +#include + +#include + +#include "FShell_LiveboxManagerService.h" +#include "FShell_LiveboxPopupContext.h" +#include "FShell_LiveboxContextBase.h" +#include "FShell_LiveboxContext.h" + + +namespace Tizen { namespace Shell { namespace App +{ + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; + + + +const String LIVEBOX_ON_ADD(L"Livebox='event=add'"); +const String LIVEBOX_ON_REMOVE(L"Livebox='event=remove'"); +const String LIVEBOX_ON_UPDATE(L"Livebox='event=update'"); +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 + +_LiveboxContext::_LiveboxContext(const String& info, const String& providerId, const String& instanceId, int width, int height, int period, int priority) +:_LiveboxContextBase(TYPE_LB, info, providerId, instanceId, width, height, priority) +,__pLiveboxPopup(null), __UpdateMillis(period) +{ + SysLog(NID_APP, "period(%d)", period); + + __lifeDurationTimer.Construct(*this);//, true); + __lifeDurationTimer.Start(LIVE_DURATION_MSEC); + + SysLog(NID_APP, "period(%d)", __UpdateMillis); + if( __UpdateMillis > 0) + { + __UpdateTimer.Construct(*this);//, false); + __UpdateTimer.StartAsRepeatable(__UpdateMillis); + } +} + +_LiveboxContext::~_LiveboxContext() +{ + SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); + __lifeDurationTimer.Cancel(); + __UpdateTimer.Cancel(); +} + +_LiveboxPopupContext* +_LiveboxContext::GetLiveboxPopup() const +{ + return __pLiveboxPopup; +} + +void +_LiveboxContext::OnAdded(void) +{ + SendAddRequest(__width, __height); +} + +void +_LiveboxContext::OnRemoved() +{ + SendRemoveRequest(); +} + +void +_LiveboxContext::OnUpdate(const String& argument) +{ + SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); + + SendUpdateRequest(__width, __height, argument); +} + +void +_LiveboxContext::OnResize(int width, int height) +{ + SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); + + __width = width; + __height = height; + SendResizeRequest(__width, __height); +} + +void +_LiveboxContext::OnForeground() +{ + SysLog(NID_APP, ""); + __isForeground = true; + + __UpdateTimer.Cancel(); + __UpdateTimer.StartAsRepeatable(__UpdateMillis); +} + +void +_LiveboxContext::OnBackground() +{ + SysLog(NID_APP, ""); + __isForeground = false; + __UpdateTimer.Cancel(); +} + +void +_LiveboxContext::OnPopupCreated(int width, int height) +{ + __pLiveboxPopup = new (std::nothrow) _LiveboxPopupContext(__userInfo, __providerId, __instanceId, width, height, __priority); + __pLiveboxPopup->SetClientId(__ipcClientId); + __pLiveboxPopup->OnPopupCreated(width, height); + + __lifeDurationTimer.Cancel(); +} + +void +_LiveboxContext::OnPopupDestoyed(void) +{ + if (__pLiveboxPopup) + { + __pLiveboxPopup->OnPopupDestoyed(); + delete __pLiveboxPopup; + __pLiveboxPopup = null; + } + RestartLifeDurationTimer(); +} + +result +_LiveboxContext::SendAddRequest(int width, int height) +{ +/* std::unique_ptr 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 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 +_LiveboxContext::SendUpdateRequest(int width, int height, const String& argument) +{ + std::unique_ptr 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 +_LiveboxContext::SendResizeRequest(int width, int height) +{ + std::unique_ptr 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 +_LiveboxContext::SendRemoveRequest() +{ + std::unique_ptr pArgs (CreateRequestArgs() ); + + return SendRequestToApp( __appId, LIVEBOX_ON_REMOVE, pArgs.get()); +} + +result +_LiveboxContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y) +{ + SysLog(NID_APP, ""); + if( HasValidClientId() == false ) + { + std::unique_ptr pArgs (CreateRequestArgs() ); + + 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()); + } + else + { +// SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running"); + LiveboxManagerService::GetInstance()->SendTouchEvent(__ipcClientId, __instanceId, event, timestamp, x, y); + } + return E_SUCCESS; +} + +result +_LiveboxContext::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs) +{ + result r = _LiveboxContextBase::SendRequestToApp(appId, operation, pArgs); + RestartLifeDurationTimer(); + + return r; +} + +result +_LiveboxContext::RequestUpdateRemote(int width, int height) +{ + /*if( GetLiveboxPopup() != null) + { + SysLog(NID_APP, "LiveboxPopup is appeared, so livebox doesn't need to update"); + return E_SUCCESS; + }*/ + std::unique_ptr packageName(_StringConverter::CopyToCharArrayN(__providerId)); + std::unique_ptr id(_StringConverter::CopyToCharArrayN(__instanceId)); + std::unique_ptr 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, "Done"); + return E_SUCCESS; +} + +void +_LiveboxContext::RestartLifeDurationTimer() +{ + __lifeDurationTimer.Cancel(); + __lifeDurationTimer.Start(LIVE_DURATION_MSEC); + SysLog(NID_APP, "lifeDuration timer restarted (%d)msec", LIVE_DURATION_MSEC); +} + +void +_LiveboxContext::OnTimerExpired(Tizen::Base::Runtime::Timer& timer) +{ + SysLog(NID_APP, ""); + + if( &timer == &__lifeDurationTimer) + { + SysLog(NID_APP, "lifeDuration timer is expired, so terminating livebox app(%ls)..", __providerId.GetPointer() ); + + ReleaseSharedMem(); + AppManager::GetInstance()->TerminateApplication(__appId); + + } + else if( &timer == &__UpdateTimer) + { + SysLog(NID_APP, "update timer is expired for livebox app(%ls)..", __providerId.GetPointer() ); + OnUpdate(L""); + } +} + + +} } } // Tizen::Shell::App { + diff --git a/src/FShell_LiveboxContextBase.cpp b/src/FShell_LiveboxContextBase.cpp new file mode 100644 index 0000000..dd19d59 --- /dev/null +++ b/src/FShell_LiveboxContextBase.cpp @@ -0,0 +1,339 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FShell_LiveboxContextBase.cpp + * @brief This is the implementation for the _LiveboxContextBase class. + */ + +#include +#include + +#include "provider_buffer.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "FShell_LiveboxContextBase.h" + +// provider/src/fb.c +struct fb_info { + char *id; + int w; + int h; + int bufsz; + void *buffer; + + int handle; +}; + +// provider/inc/provider_buffer_internal.h +struct livebox_buffer { + enum { + BUFFER_CREATED = 0x00beef00, + BUFFER_DESTROYED = 0x00dead00, + } state; + + enum target_type type; + + union { + int fd; /* File handle(descriptor) */ + int id; /* SHM handle(id) */ + } handle; + + char *pkgname; + char *id; + int width; + int height; + int pixel_size; + + struct fb_info *fb; + + int (*handler)(struct livebox_buffer *info, enum buffer_event event, double timestamp, double x, double y, void *data); + void *data; +}; + +static int LiveboxHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event, + double timestamp, double x, double y, void* data); + +namespace Tizen { namespace Shell { namespace App +{ + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; + + +const String LIVEBOX_ON_ADD(L"Livebox='event=add'"); +const String LIVEBOX_ON_REMOVE(L"Livebox='event=remove'"); +const String LIVEBOX_ON_UPDATE(L"Livebox='event=update'"); +const String LIVEBOX_ON_RESIZE(L"Livebox='event=resize'"); +const String LIVEBOX_ON_TOUCH(L"Livebox='event=touch'"); +const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'"); +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"; + + +_LiveboxContextBase::_LiveboxContextBase(target_type type, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int priority) + :__type(type) + ,__userInfo(userInfo) + ,__providerId(providerId) + ,__instanceId(instanceId) + ,__width(width) + ,__height(height) + ,__priority(priority) + ,__isForeground(true) + ,__ipcClientId(-1) + ,__buffer_info(null) + ,__buffer(null) // __pEcoreEvas(null), __pEvas(null), __current(0) +{ + _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, __appId, __providerName); + + SysLog(NID_APP, "appId(%ls), providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __appId.GetPointer(), __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); +} + +_LiveboxContextBase::~_LiveboxContextBase() +{ + SysLog(NID_APP, "providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority); +} + + +void +_LiveboxContextBase::SetClientId(int clientId) +{ + __ipcClientId = clientId; +} + +bool +_LiveboxContextBase::HasValidClientId() const +{ + SysLog(NID_APP, "%d", __ipcClientId); + return (__ipcClientId > -1); +} + +int +_LiveboxContextBase::GetSharedMemId(int w, int h) +{ + SysLog(NID_APP, "Enter"); + + if( __buffer_info == null) + { + std::unique_ptr packageName(_StringConverter::CopyToCharArrayN(__providerId)); + std::unique_ptr id(_StringConverter::CopyToCharArrayN(__instanceId)); + + __buffer_info = provider_buffer_acquire(__type, packageName.get(), id.get(), w, h, sizeof(int), LiveboxHandleBufferEventCallback, this); + SysTryReturnResult(NID_APP, __buffer_info , -1, "[E_SYSTEM] failed to provider_buffer_acquire"); + SysLog(NID_APP, "provider_buffer_acquire successed"); + + __buffer = provider_buffer_ref(__buffer_info); + SysTryReturnResult(NID_APP, __buffer , -1, "[E_SYSTEM] failed to provider_buffer_ref"); + SysLog(NID_APP, "provider_buffer_ref successed"); + } + + int bufferId = __buffer_info->fb->handle; + + SysLog(NID_APP, "(%d) Exit", bufferId); + return bufferId; +} + +result +_LiveboxContextBase::ReleaseSharedMem() +{ + SysLog(NID_APP, "Enter"); + + int ret; + + if( __buffer) + { + ret = provider_buffer_unref(__buffer); + __buffer = null; + SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_buffer_unref"); + SysLog(NID_APP, "provider_buffer_unref successed"); + } + + if( __buffer_info) + { + ret = provider_buffer_release(__buffer_info); + __buffer_info = null; + SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_buffer_release"); + SysLog(NID_APP, "provider_buffer_release successed"); + } + + SysLog(NID_APP, "Exit."); + + return E_SUCCESS; +} + +Tizen::Base::Collection::HashMap* +_LiveboxContextBase::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 +_LiveboxContextBase::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs) +{ + if( __isForeground == false) + { + SysLog(NID_APP, "livebox isn't foreground, so, message skip"); + return E_SUCCESS; + } + + return _LiveboxRequestHelper::SendRequestToApp(appId, operation, pArgs); +} + +result +_LiveboxRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs) +{ + SysLog(NID_APP, "appId(%ls), operation(%ls), arg count(%d)", appId.GetPointer(), operation.GetPointer(), pArgs->GetCount() ); + + _AppMessageImpl msg; + msg.AddData(OSP_K_APPCONTROL_INTERNAL_OPERATION, L"livebox"); + Tizen::App::_AppArg::AddStrMap(msg.GetBundle(), pArgs); + + std::unique_ptr pAppId(_StringConverter::CopyToCharArrayN(appId) ); + std::unique_ptr pOperation(_StringConverter::CopyToCharArrayN(operation) ); + + return Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null); +} + +/*result +_LiveboxRequestHelper::ExtractPackageIdAndExecutableName(AppId appId, AppId& outPackageId, String& outExecutableName) +{ + const int APP_ID_LEN = 10; + + if (appId.GetLength() > APP_ID_LEN) + { + result r = appId.SubString(APP_ID_LEN + 1, appId.GetLength() - (APP_ID_LEN + 1), outExecutableName); + SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "invalid AppId(%ls)", appId.GetPointer()); + + r = appId.SubString(0, APP_ID_LEN, outPackageId); + SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "invalid AppId(%ls)", appId.GetPointer()); + + return E_SUCCESS; + } + return E_SYSTEM; +}*/ + +/* +// helper for bundle +result +_LiveboxRequestHelper::AddStrArrayToBundle(bundle* b, const char* key, const IList* pList) +{ + bundle* pb = b; + SysTryReturnResult(NID_APP, pb != NULL, E_INVALID_ARG, "Empty bundle."); + + if (pList == null || pList->GetCount() == 0) + { + SysLog(NID_APP, "No element added for bundle."); + return E_SUCCESS; + } + + int i = 0; + const int count = pList->GetCount(); + + const char** pSa = new (std::nothrow) const char*[count]; + SysTryReturnResult(NID_APP, pSa != null, E_OUT_OF_MEMORY, "Memory allocation failure with cound %d.", count); + + for (i = 0; i < count; i++) + { + pSa[i] = null; + + const String* pStr = static_cast(pList->GetAt(i)); + if (pStr) + { + pSa[i] = _StringConverter::CopyToCharArrayN(*pStr); + } + } + + result r = E_SUCCESS; + + int ret = bundle_add_str_array(pb, key, pSa, count); + SysTryReturnResult(NID_APP, ret >= 0, E_SYSTEM, "Bundle add failre with %d.", strerror(errno)); + +//CATCH: + for (i = 0; i < count; i++) + { + delete[] pSa[i]; + } + + delete[] pSa; + + return r; +} +*/ + +} } } // Tizen::Shell::App { + + +//////////////////////////////////////////// +// callback +//////////////////////////////////////////// +static int LiveboxHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event, + double timestamp, double x, double y, void* data) +{ + SysLog(NID_APP, "timestamp(%f), x(%f), y(%f)", timestamp, x, y); + + Tizen::Shell::App::_LiveboxContextBase *pLiveboxBase = static_cast(data); + SysTryReturn(NID_APP, pLiveboxBase != null, 0, E_SYSTEM, "[E_SYSTEM] retrieved pLiveboxBase is null"); + +// const char *pkgname = provider_buffer_pkgname(info); +// const char *id = provider_buffer_id(info); +// enum target_type type = provider_buffer_type(info); + + if( event == BUFFER_EVENT_ENTER) + { + SysLog(NID_APP, "BUFFER_EVENT_ENTER"); + } + else if( event == BUFFER_EVENT_LEAVE) + { + SysLog(NID_APP, "BUFFER_EVENT_LEAVE"); + } + else if( event == BUFFER_EVENT_DOWN) + { + SysLog(NID_APP, "BUFFER_EVENT_DOWN"); + } + else if( event == BUFFER_EVENT_MOVE) + { + SysLog(NID_APP, "BUFFER_EVENT_MOVE"); + } + else if( event == BUFFER_EVENT_UP) + { + SysLog(NID_APP, "BUFFER_EVENT_UP"); + } + + pLiveboxBase->SendTouchEvent(event, timestamp, x, y); + + return 0; +} diff --git a/src/FShell_LiveboxManagerService.cpp b/src/FShell_LiveboxManagerService.cpp index 4339da2..7ebb33b 100644 --- a/src/FShell_LiveboxManagerService.cpp +++ b/src/FShell_LiveboxManagerService.cpp @@ -1,18 +1,23 @@ // // Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. // -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // /** - * @file FAppAppManager.cpp - * @brief This is the implementation for the AppManager class. + * @file FShell_LiveboxManagerService.cpp + * @brief This is the implementation for the LiveboxManagerService class. */ #include @@ -28,8 +33,8 @@ #include #include -#include "FShell_Livebox.h" -#include "FShell_LiveboxPopup.h" +#include "FShell_LiveboxContext.h" +#include "FShell_LiveboxPopupContext.h" #include "FShell_LiveboxManagerStub.h" #include "FShell_LiveboxManagerService.h" @@ -132,19 +137,19 @@ LiveboxManagerService::OnTimerExpired(Timer& timer) provider_send_ping(); } -_Livebox* +_LiveboxContext* LiveboxManagerService::Find(const String& appId, const String& instanceId) const { - for( int i = 0; i < __liveboxes.GetCount(); i++ ) + for( int i = 0; i < __liveboxContextList.GetCount(); i++ ) { - _Livebox* pLivebox = null; - __liveboxes.GetAt(i, pLivebox); -// SysLog(NID_APP, "%ls", pLivebox->__instanceId.GetPointer()); + _LiveboxContext* pLiveboxContext = null; + __liveboxContextList.GetAt(i, pLiveboxContext); +// SysLog(NID_APP, "%ls", pLiveboxContext->__instanceId.GetPointer()); - if ( pLivebox->__instanceId == instanceId ) + if ( pLiveboxContext->__instanceId == instanceId ) { -// SysAssert(pLivebox->__appId == appId) - return pLivebox; +// SysAssert(pLiveboxContext->__appId == appId) + return pLiveboxContext; } } return null; @@ -153,23 +158,23 @@ LiveboxManagerService::Find(const String& appId, const String& instanceId) const result LiveboxManagerService::SetClientIds(const Tizen::App::AppId& appId, int clientId) { - for( int i = 0; i < __liveboxes.GetCount(); i++ ) + for( int i = 0; i < __liveboxContextList.GetCount(); i++ ) { - _Livebox* pLivebox = null; - __liveboxes.GetAt(i, pLivebox); - SysLog(NID_APP, "%ls", pLivebox->__instanceId.GetPointer()); - SysLog(NID_APP, "%ls, %ls", pLivebox->__providerId.GetPointer(), appId.GetPointer()); + _LiveboxContext* pLiveboxContext = null; + __liveboxContextList.GetAt(i, pLiveboxContext); + SysLog(NID_APP, "%ls", pLiveboxContext->__instanceId.GetPointer()); + SysLog(NID_APP, "%ls, %ls", pLiveboxContext->__providerId.GetPointer(), appId.GetPointer()); - if ( pLivebox->__appId == appId ) + if ( pLiveboxContext->__appId == appId ) { - pLivebox->SetClientId(clientId); + pLiveboxContext->SetClientId(clientId); SysLog(NID_APP, "client is registered.(%d)", clientId); if( clientId == -1) { - pLivebox->ReleaseSharedMem(); - if(pLivebox->GetLiveboxPopup()) + pLiveboxContext->ReleaseSharedMem(); + if(pLiveboxContext->GetLiveboxPopup()) { - pLivebox->OnPopupDestoyed(); + pLiveboxContext->OnPopupDestoyed(); } } } @@ -177,25 +182,13 @@ LiveboxManagerService::SetClientIds(const Tizen::App::AppId& appId, int clientId return E_SUCCESS; } -//void -//LiveboxManagerService::OnApplicationLaunched(const AppId& appId, _AppType type) -//{ -// -//} -// -//void -//LiveboxManagerService::OnApplicationTerminated(const AppId& appId, _AppType type) -//{ -// this->SetClientIds(appId, -1); -//} - void LiveboxManagerService::OnIpcClientConnected(const _IpcServer& server, int clientId) { //SysLog(NID_APP, "(clientId:%d)\n", clientId); String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName(); SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer()); -// this->SetClientIds(fullAppId, clientId); +// this->SetClientIds(fullAppId, clientId);//Todo } @@ -208,27 +201,27 @@ LiveboxManagerService::OnIpcClientDisconnected(const _IpcServer& server, int cli } result -LiveboxManagerService::AddLivebox(_Livebox* pLivebox) +LiveboxManagerService::AddLivebox(_LiveboxContext* pLiveboxContext) { - SysLog(NID_APP, "%ls, %ls, count(%d)", pLivebox->__providerId.GetPointer(), pLivebox->__instanceId.GetPointer(), __liveboxes.GetCount()); + SysLog(NID_APP, "%ls, %ls, count(%d)", pLiveboxContext->__providerId.GetPointer(), pLiveboxContext->__instanceId.GetPointer(), __liveboxContextList.GetCount()); - return __liveboxes.Add(pLivebox); + return __liveboxContextList.Add(pLiveboxContext); } result LiveboxManagerService::RemoveLivebox(const char* pPackageName, const char* pId, bool free) { - SysLog(NID_APP, "%s, %s, count(%d)", pPackageName, pId, __liveboxes.GetCount()); + SysLog(NID_APP, "%s, %s, count(%d)", pPackageName, pId, __liveboxContextList.GetCount()); SysTryReturn(NID_APP, ( pPackageName != null && pId != null), null, E_INVALID_ARG, "[E_INVALID_ARG]"); SysLog(NID_APP, "%s, %s", pPackageName, pId); - _Livebox* pLivebox = Find(pPackageName, pId); - SysTryReturn(NID_APP, pLivebox, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]"); + _LiveboxContext* pLiveboxContext = Find(pPackageName, pId); + SysTryReturn(NID_APP, pLiveboxContext, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]"); - result r = __liveboxes.Remove(pLivebox); + result r = __liveboxContextList.Remove(pLiveboxContext); - if( __liveboxes.GetCount() == 0 ) + if( __liveboxContextList.GetCount() == 0 ) { SysLog(NID_APP, "No running native livebox app remains, terminating osp livebox service..."); Tizen::App::App::GetInstance()->Terminate(); @@ -253,19 +246,19 @@ LiveboxManagerService::OnLiveboxCreate(struct event_arg *arg, int *width, int *h SysTryReturn (NID_APP, LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id) == null, -EBUSY, E_SUCCESS,"already exist"); double default_priority = 1.0f; - _Livebox* pLivebox = new (std::nothrow)_Livebox( arg->info.lb_create.content, arg->pkgname, arg->id, + _LiveboxContext* pLiveboxContext = new (std::nothrow)_LiveboxContext( arg->info.lb_create.content, arg->pkgname, arg->id, arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority); - SysTryReturn(NID_APP, pLivebox, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); + SysTryReturn(NID_APP, pLiveboxContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); LiveboxManagerService* pLiveboxService = LiveboxManagerService::GetInstance(); - pLiveboxService->AddLivebox(pLivebox); - pLivebox->OnAdded(); + pLiveboxService->AddLivebox(pLiveboxContext); + pLiveboxContext->OnAdded(); - *priority = pLivebox->__priority; - *height= pLivebox->__height; - *width = pLivebox->__width; + *priority = pLiveboxContext->__priority; + *height= pLiveboxContext->__height; + *width = pLiveboxContext->__width; - SysLog(NID_APP, "Exit. %d livebox(es)", pLiveboxService->__liveboxes.GetCount()); + SysLog(NID_APP, "Exit. %d livebox(es)", pLiveboxService->__liveboxContextList.GetCount()); return 0; } @@ -279,10 +272,10 @@ LiveboxManagerService::OnLiveboxUpdate(struct event_arg *arg, void* data) } else { - _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); + _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); - pLivebox->OnUpdate(L""); + pLiveboxContext->OnUpdate(L""); } return 0; @@ -291,14 +284,14 @@ LiveboxManagerService::OnLiveboxUpdate(struct event_arg *arg, void* data) int LiveboxManagerService::UpdateAllLiveboxesByAppId(const String& providerId) { - for( int i = 0; i < __liveboxes.GetCount(); i++ ) + for( int i = 0; i < __liveboxContextList.GetCount(); i++ ) { - _Livebox* pLivebox = null; - __liveboxes.GetAt(i, pLivebox); + _LiveboxContext* pLiveboxContext = null; + __liveboxContextList.GetAt(i, pLiveboxContext); - if ( pLivebox->__providerId == providerId ) + if ( pLiveboxContext->__providerId == providerId ) { - pLivebox->OnUpdate(L""); + pLiveboxContext->OnUpdate(L""); } } return E_SUCCESS; @@ -312,12 +305,12 @@ LiveboxManagerService::OnLiveboxDestroy(struct event_arg *arg, void* data) LiveboxManagerService* pLiveboxManagerService = LiveboxManagerService::GetInstance(); - _Livebox* pLivebox = pLiveboxManagerService->Find(arg->pkgname, arg->id); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); + _LiveboxContext* pLiveboxContext = pLiveboxManagerService->Find(arg->pkgname, arg->id); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); - pLivebox->OnRemoved(); + pLiveboxContext->OnRemoved(); pLiveboxManagerService->RemoveLivebox( arg->pkgname, arg->id, true); - delete pLivebox; + delete pLiveboxContext; SysLog(NID_APP, "Exit"); return 0; @@ -329,14 +322,14 @@ LiveboxManagerService::OnLiveboxPopupCreate(struct event_arg *arg, void* data) SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_CREATE, -EPERM, E_SUCCESS, "invalid argument from master"); SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id); - _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); + _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); - /*if( pLivebox->GetLiveboxPopup() ) + /*if( pLiveboxContext->GetLiveboxPopup() ) { - pLivebox->OnPopupDestoyed(); + pLiveboxContext->OnPopupDestoyed(); }*/ - pLivebox->OnPopupCreated(arg->info.pd_create.w, arg->info.pd_create.h); + pLiveboxContext->OnPopupCreated(arg->info.pd_create.w, arg->info.pd_create.h); return 0; } @@ -346,10 +339,10 @@ LiveboxManagerService::OnLiveboxPopupCreate(struct event_arg *arg, void* data) { SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_DESTROY, -EPERM, E_SUCCESS, "invalid argument from master"); SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id); - _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); + _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); - pLivebox->OnPopupDestoyed(); + pLiveboxContext->OnPopupDestoyed(); return 0; } @@ -359,11 +352,11 @@ LiveboxManagerService::OnLiveboxPopupCreate(struct event_arg *arg, void* data) { SysTryReturn(NID_APP, arg, 0, E_SUCCESS, "arg is null!"); - _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); - SysTryReturnResult(NID_APP, pLivebox , 0, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); + _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); + SysTryReturnResult(NID_APP, pLiveboxContext , 0, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id); - pLivebox->OnBackground(); + pLiveboxContext->OnBackground(); return 0; } @@ -372,11 +365,11 @@ LiveboxManagerService::OnLiveboxResume(struct event_arg *arg, void* data) { SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!"); - _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); + _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id); - pLivebox->OnForeground(); + pLiveboxContext->OnForeground(); return 0; } @@ -398,10 +391,10 @@ LiveboxManagerService::OnLiveboxResize(struct event_arg *arg, void* data) SysLog(NID_APP, "packageName(%s), id(%s), resize.w(%d), resize.h(%d)", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h); - _Livebox* pLivebox = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); + _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id); - pLivebox->OnResize(arg->info.resize.w, arg->info.resize.h); + pLiveboxContext->OnResize(arg->info.resize.w, arg->info.resize.h); return 0; } @@ -420,7 +413,7 @@ LiveboxManagerService::InitializeMasterDaemonEventReceiver(const char *pServiceE SysTryReturnResult(NID_APP, pServiceExecutableName != null, E_INVALID_ARG, ""); SysLog(NID_APP, "Enter."); - __liveboxes.Construct(); + __liveboxContextList.Construct(); /*! * \note @@ -473,20 +466,20 @@ LiveboxManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen SysLog(NID_APP, "%ls, %ls", appId.GetPointer(), providerName.GetPointer() ); bool found = false; - for( int i = 0; i < __liveboxes.GetCount(); i++ ) + for( int i = 0; i < __liveboxContextList.GetCount(); i++ ) { - _Livebox* pLivebox = null; - __liveboxes.GetAt(i, pLivebox); + _LiveboxContext* pLiveboxContext = null; + __liveboxContextList.GetAt(i, pLiveboxContext); - if ( pLivebox->__appId == appId && pLivebox->__providerName == providerName) + if ( pLiveboxContext->__appId == appId && pLiveboxContext->__providerName == providerName) { SysLog(NID_APP, "OK"); - ArrayList* pArray = new ArrayList(); + ArrayList* pArray = new (std::nothrow) ArrayList(); SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); pArray->Construct(); - pArray->Add(pLivebox); + pArray->Add(pLiveboxContext); pArray->Add(new String(argument)); result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray); @@ -505,20 +498,20 @@ LiveboxManagerService::RequestUpdateInstance(const Tizen::Base::String& instance { SysLog(NID_APP, "%ls, %ls", instanceId.GetPointer(), argument.GetPointer() ); - for( int i = 0; i < __liveboxes.GetCount(); i++ ) + for( int i = 0; i < __liveboxContextList.GetCount(); i++ ) { - _Livebox* pLivebox = null; - __liveboxes.GetAt(i, pLivebox); + _LiveboxContext* pLiveboxContext = null; + __liveboxContextList.GetAt(i, pLiveboxContext); - if ( pLivebox->__instanceId == instanceId) + if ( pLiveboxContext->__instanceId == instanceId) { SysLog(NID_APP, "OK"); - ArrayList* pArray = new ArrayList(); + ArrayList* pArray = new (std::nothrow) ArrayList(); SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); pArray->Construct(); - pArray->Add(pLivebox); + pArray->Add(pLiveboxContext); pArray->Add(new String(argument)); result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray); @@ -534,27 +527,27 @@ LiveboxManagerService::RequestUpdateInstance(const Tizen::Base::String& instance result LiveboxManagerService::RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId) { - _Livebox* pLivebox = this->Find(appId, instanceId); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); - if(pLivebox->HasValidClientId() == false) + if(pLiveboxContext->HasValidClientId() == false) { String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName(); this->SetClientIds(fullAppId, __pIpcServer->GetClientId()); } - shmId = pLivebox->GetSharedMemId(width, height); - SysTryReturnResult(NID_APP, pLivebox , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + shmId = pLiveboxContext->GetSharedMemId(width, height); + SysTryReturnResult(NID_APP, pLiveboxContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); return E_SUCCESS; } result LiveboxManagerService::RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId) { - _Livebox* pLivebox = this->Find(appId, instanceId); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); - _LiveboxPopup* pPd = pLivebox->GetLiveboxPopup(); + _LiveboxPopupContext* pPd = pLiveboxContext->GetLiveboxPopup(); SysTryReturnResult(NID_APP, pPd , E_SYSTEM, "[E_SYSTEM] pPd is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); if(pPd->HasValidClientId() == false) @@ -564,7 +557,7 @@ LiveboxManagerService::RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId } shmId = pPd->GetSharedMemId(width, height); - SysTryReturnResult(NID_APP, pLivebox , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + SysTryReturnResult(NID_APP, pLiveboxContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); return E_SUCCESS; } @@ -572,20 +565,20 @@ LiveboxManagerService::RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId result LiveboxManagerService::RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height) { - _Livebox* pLivebox = this->Find(appId, instanceId); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); - return pLivebox->RequestUpdateRemote(width, height); + return pLiveboxContext->RequestUpdateRemote(width, height); } result LiveboxManagerService::RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) { - _Livebox* pLivebox = this->Find(appId, instanceId); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); - SysTryReturnResult(NID_APP, pLivebox->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + SysTryReturnResult(NID_APP, pLiveboxContext->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); - return pLivebox->GetLiveboxPopup()->RequestUpdateRemote(); + return pLiveboxContext->GetLiveboxPopup()->RequestUpdateRemote(); } result @@ -594,10 +587,10 @@ LiveboxManagerService::RequestReleaseSharedMemory(const Tizen::App::AppId& appId std::unique_ptr pkgname(_StringConverter::CopyToCharArrayN(appId)); std::unique_ptr id(_StringConverter::CopyToCharArrayN(instanceId)); - _Livebox* pLivebox = this->Find(appId, instanceId); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); - return pLivebox->ReleaseSharedMem(); + return pLiveboxContext->ReleaseSharedMem(); } result @@ -606,11 +599,11 @@ LiveboxManagerService::RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& std::unique_ptr pkgname(_StringConverter::CopyToCharArrayN(appId)); std::unique_ptr id(_StringConverter::CopyToCharArrayN(instanceId)); - _Livebox* pLivebox = this->Find(appId, instanceId); - SysTryReturnResult(NID_APP, pLivebox , E_SYSTEM, "[E_SYSTEM] pLivebox is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); - SysTryReturnResult(NID_APP, pLivebox->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId); + SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); + SysTryReturnResult(NID_APP, pLiveboxContext->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer()); -// return pLivebox->GetLiveboxPopup()->ReleaseSharedMem(); +// return pLiveboxContext->GetLiveboxPopup()->ReleaseSharedMem(); return E_SUCCESS; } @@ -630,13 +623,13 @@ LiveboxManagerService::_TaskHandlerThread::OnUserEventReceivedN(RequestId reqId, { case LOCAL_EVENT_REQUEST_UPDATE: { - _Livebox* pLivebox = dynamic_cast<_Livebox*>( pArgs->GetAt(0) ); - SysTryReturnVoidResult(NID_APP, pLivebox != null, E_INVALID_STATE, "_Livebox is null!."); + _LiveboxContext* pLiveboxContext = dynamic_cast<_LiveboxContext*>( pArgs->GetAt(0) ); + SysTryReturnVoidResult(NID_APP, pLiveboxContext != null, E_INVALID_STATE, "_Livebox is null!."); String* pArgument = dynamic_cast( pArgs->GetAt(1) ); SysTryReturnVoidResult(NID_APP, pArgument != null, E_INVALID_STATE, "pArgument is null!."); - pLivebox->OnUpdate(*pArgument); + pLiveboxContext->OnUpdate(*pArgument); delete pArgument; pArgs->RemoveAll(); diff --git a/src/FShell_LiveboxManagerStub.cpp b/src/FShell_LiveboxManagerStub.cpp index ad7747e..1b14470 100644 --- a/src/FShell_LiveboxManagerStub.cpp +++ b/src/FShell_LiveboxManagerStub.cpp @@ -1,18 +1,23 @@ // // Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. // -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // /** - * @file FAppAppManager.cpp - * @brief This is the implementation for the AppManager class. + * @file FShell_LiveboxManagerStub.cpp + * @brief This is the implementation for the _LiveboxManagerStub class. */ #include diff --git a/src/FShell_LiveboxPopup.cpp b/src/FShell_LiveboxPopup.cpp deleted file mode 100644 index e7860c8..0000000 --- a/src/FShell_LiveboxPopup.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// -// Open Service Platform -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. -// -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. -// - -/** - * @file FShell_Livebox.cpp - * @brief This is the implementation for the Livebox class. - */ - -#include -#include - -#include "provider_buffer.h" - -#include -#include -#include - -#include - -#include "FShell_LiveboxManagerService.h" -#include "FShell_LiveboxPopup.h" - -namespace Tizen { namespace Shell { namespace App -{ - -using namespace Tizen::Base; -using namespace Tizen::Base::Collection; - - -const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'"); -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) -{ - SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height); -} - -_LiveboxPopup::~_LiveboxPopup() -{ - SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height); - ReleaseSharedMem(); -} - - -void -_LiveboxPopup::OnPopupCreated(int width, int height) -{ - SysLog(NID_APP, "width(%d), height(%d)", width, height); - SendPopupCreateRequest(width, height); -} - -void -_LiveboxPopup::OnPopupDestoyed() -{ - SysLog(NID_APP, ""); - SendPopupDestroyRequest(); -} - -result -_LiveboxPopup::SendPopupCreateRequest(int width, int height) -{ - std::unique_ptr 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_TRAY_ON_CREATE, pArgs.get()); -} - -result -_LiveboxPopup::SendPopupDestroyRequest() -{ - std::unique_ptr pArgs (CreateRequestArgs() ); - - return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_DESTROY, pArgs.get()); -} - -result -_LiveboxPopup::SendTouchEvent(buffer_event event, double timestamp, double x, double y) -{ - SysLog(NID_APP, ""); - /*if( HasValidClientId() == false ) - { - std::unique_ptr pArgs (new (std::nothrow) ArrayList); - pArgs->Construct(); - pArgs->Add(*new String(__instanceId)); - pArgs->Add(*new String(__info)); - 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))); - - return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_TOUCH, pArgs.get()); - } - else*/ - { -// SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running"); - LiveboxManagerService::GetInstance()->SendTouchEventForPD(__ipcClientId, __instanceId, event, timestamp, x, y); - } - return E_SUCCESS; -} - -result -_LiveboxPopup::RequestUpdateRemote() -{ - std::unique_ptr packageName(_StringConverter::CopyToCharArrayN(__providerId)); - std::unique_ptr id(_StringConverter::CopyToCharArrayN(__instanceId)); - - int ret = provider_send_desc_updated(packageName.get(), id.get(), null); - SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated"); - - SysLog(NID_APP, "Done"); - return E_SUCCESS; -} - -} } } // Tizen::Shell::App { - diff --git a/src/FShell_LiveboxPopupContext.cpp b/src/FShell_LiveboxPopupContext.cpp new file mode 100644 index 0000000..ad16a00 --- /dev/null +++ b/src/FShell_LiveboxPopupContext.cpp @@ -0,0 +1,137 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FShell_LiveboxPopupContext.cpp + * @brief This is the implementation for the _LiveboxPopupContext class. + */ + +#include +#include + +#include "provider_buffer.h" + +#include +#include +#include + +#include + +#include "FShell_LiveboxManagerService.h" +#include "FShell_LiveboxPopupContext.h" + +namespace Tizen { namespace Shell { namespace App +{ + +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; + + +const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'"); +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"; + + +_LiveboxPopupContext::_LiveboxPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority) +:_LiveboxContextBase(TYPE_PD, info, appId, instanceId, width, height, priority) +{ + SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height); +} + +_LiveboxPopupContext::~_LiveboxPopupContext() +{ + SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height); + ReleaseSharedMem(); +} + + +void +_LiveboxPopupContext::OnPopupCreated(int width, int height) +{ + SysLog(NID_APP, "width(%d), height(%d)", width, height); + SendPopupCreateRequest(width, height); +} + +void +_LiveboxPopupContext::OnPopupDestoyed() +{ + SysLog(NID_APP, ""); + SendPopupDestroyRequest(); +} + +result +_LiveboxPopupContext::SendPopupCreateRequest(int width, int height) +{ + std::unique_ptr 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_TRAY_ON_CREATE, pArgs.get()); +} + +result +_LiveboxPopupContext::SendPopupDestroyRequest() +{ + std::unique_ptr pArgs (CreateRequestArgs() ); + + return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_DESTROY, pArgs.get()); +} + +result +_LiveboxPopupContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y) +{ + SysLog(NID_APP, ""); + /*if( HasValidClientId() == false ) + { + std::unique_ptr pArgs (new (std::nothrow) ArrayList); + pArgs->Construct(); + pArgs->Add(*new String(__instanceId)); + pArgs->Add(*new String(__info)); + 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))); + + return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_TOUCH, pArgs.get()); + } + else*/ + { +// SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running"); + LiveboxManagerService::GetInstance()->SendTouchEventForPD(__ipcClientId, __instanceId, event, timestamp, x, y); + } + return E_SUCCESS; +} + +result +_LiveboxPopupContext::RequestUpdateRemote() +{ + std::unique_ptr packageName(_StringConverter::CopyToCharArrayN(__providerId)); + std::unique_ptr id(_StringConverter::CopyToCharArrayN(__instanceId)); + + int ret = provider_send_desc_updated(packageName.get(), id.get(), null); + SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated"); + + SysLog(NID_APP, "Done"); + return E_SUCCESS; +} + +} } } // Tizen::Shell::App { + diff --git a/src/OspLiveboxService.cpp b/src/OspLiveboxService.cpp index fb8cc5e..d3e71f7 100644 --- a/src/OspLiveboxService.cpp +++ b/src/OspLiveboxService.cpp @@ -1,13 +1,18 @@ // // Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. // -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // /** @@ -36,7 +41,7 @@ ServiceApp* OspLiveboxService::CreateInstance(void) { // Create the instance through the constructor. - return new OspLiveboxService(); + return new (std::nothrow) OspLiveboxService(); } bool diff --git a/src/OspLiveboxServiceEntry.cpp b/src/OspLiveboxServiceEntry.cpp index 615a5d3..18e2cca 100644 --- a/src/OspLiveboxServiceEntry.cpp +++ b/src/OspLiveboxServiceEntry.cpp @@ -1,13 +1,18 @@ // // Open Service Platform // Copyright (c) 2012 Samsung Electronics Co., Ltd. -// All rights reserved. // -// This software contains confidential and proprietary information -// of Samsung Electronics Co., Ltd. -// The user of this software agrees not to disclose, disseminate or copy such -// Confidential Information and shall use the software only in accordance with -// the terms of the license agreement the user entered into with Samsung. +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // /** @@ -44,7 +49,7 @@ OspMain(int argc, char *pArgv[]) result r = E_SUCCESS; AppLog("Application started."); - ArrayList* pArgs = new ArrayList(); + ArrayList* pArgs = new (std::nothrow) ArrayList(); pArgs->Construct(); for (int i = 0; i < argc; i++) pArgs->Add(*(new String(pArgv[i])));