2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FApp_AppManagerEvent.cpp
20 * @brief This is the implementation for the _AppManagerEvent.cpp class.
23 #include <FBaseSysLog.h>
25 #include "FApp_Types.h"
26 #include "FApp_AppManagerEvent.h"
27 #include "FApp_AppManagerEventArg.h"
28 #include "FApp_IAppManagerEventListener.h"
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Runtime;
34 namespace Tizen { namespace App
37 _AppManagerEventArg::_AppManagerEventArg(void)
38 : __appType(_APP_TYPE_UI_APP)
39 , __eventType(_AppManagerEvent::_APP_MANAGER_EVENT_INVALID)
43 _AppManagerEventArg::_AppManagerEventArg(const AppId& appId, _AppType appType, _AppManagerEvent::_Type eventType)
46 , __eventType(eventType)
50 _AppManagerEventArg::_AppManagerEventArg(const _AppManagerEventArg& value)
53 __appId = value.__appId;
54 __appType = value.__appType;
55 __eventType = value.__eventType;
58 _AppManagerEventArg::~_AppManagerEventArg(void)
63 _AppManagerEventArg::GetAppId(void) const
69 _AppManagerEventArg::GetAppType(void) const
74 _AppManagerEvent::_Type
75 _AppManagerEventArg::GetEventType(void) const
81 _AppManagerEventArg::operator =(const _AppManagerEventArg& source)
88 __appId = source.__appId;
89 __appType = source.__appType;
90 __eventType = source.__eventType;
96 ///////////////////////////////////////////////////////
98 ///////////////////////////////////////////////////////
100 _AppManagerEvent::Construct(void)
102 return _Event::Initialize();
106 _AppManagerEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
108 _IAppManagerEventListener* pListener = dynamic_cast<_IAppManagerEventListener*>(&listener);
109 SysTryReturnVoidResult(NID_APP, pListener != null, E_INVALID_STATE, "Invalid listener : listener(0x%x), arg(0x%x)", &listener, &arg);
111 const _AppManagerEventArg* pEventArg = dynamic_cast<const _AppManagerEventArg*>(&arg);
112 SysTryReturnVoidResult(NID_APP, pEventArg != null, E_INVALID_STATE, "Invalid arg : listener(0x%x), arg(0x%x)", &listener, &arg);
114 switch (pEventArg->GetEventType())
116 case _APP_MANAGER_EVENT_LAUNCHED:
117 pListener->OnApplicationLaunched(pEventArg->GetAppId(), pEventArg->GetAppType());
120 case _APP_MANAGER_EVENT_TERMINATED:
121 pListener->OnApplicationTerminated(pEventArg->GetAppId(), pEventArg->GetAppType());
125 SysLog(NID_APP, "Invalid event type(%d)!!", pEventArg->GetEventType());