2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FApp_AppManagerEvent.cpp
19 * @brief This is the implementation for the _AppManagerEvent.cpp class.
22 #include <FBaseSysLog.h>
24 #include "FApp_Types.h"
25 #include "FApp_AppManagerEvent.h"
26 #include "FApp_AppManagerEventArg.h"
27 #include "FApp_IAppManagerEventListener.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Runtime;
33 namespace Tizen { namespace App
36 _AppManagerEventArg::_AppManagerEventArg(void)
37 : __appType(_APP_TYPE_UI_APP)
38 , __eventType(_AppManagerEvent::_APP_MANAGER_EVENT_INVALID)
42 _AppManagerEventArg::_AppManagerEventArg(const AppId& appId, _AppType appType, _AppManagerEvent::_Type eventType)
45 , __eventType(eventType)
49 _AppManagerEventArg::_AppManagerEventArg(const _AppManagerEventArg& value)
52 __appId = value.__appId;
53 __appType = value.__appType;
54 __eventType = value.__eventType;
57 _AppManagerEventArg::~_AppManagerEventArg(void)
62 _AppManagerEventArg::GetAppId(void) const
68 _AppManagerEventArg::GetAppType(void) const
73 _AppManagerEvent::_Type
74 _AppManagerEventArg::GetEventType(void) const
80 _AppManagerEventArg::operator =(const _AppManagerEventArg& source)
87 __appId = source.__appId;
88 __appType = source.__appType;
89 __eventType = source.__eventType;
95 ///////////////////////////////////////////////////////
97 ///////////////////////////////////////////////////////
99 _AppManagerEvent::Construct(void)
101 return _Event::Initialize();
105 _AppManagerEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
107 _IAppManagerEventListener* pListener = dynamic_cast<_IAppManagerEventListener*>(&listener);
108 SysTryReturnVoidResult(NID_APP, pListener != null, E_INVALID_STATE, "Invalid listener : listener(0x%x), arg(0x%x)", &listener, &arg);
110 const _AppManagerEventArg* pEventArg = dynamic_cast<const _AppManagerEventArg*>(&arg);
111 SysTryReturnVoidResult(NID_APP, pEventArg != null, E_INVALID_STATE, "Invalid arg : listener(0x%x), arg(0x%x)", &listener, &arg);
113 switch (pEventArg->GetEventType())
115 case _APP_MANAGER_EVENT_LAUNCHED:
116 pListener->OnApplicationLaunched(pEventArg->GetAppId(), pEventArg->GetAppType());
119 case _APP_MANAGER_EVENT_TERMINATED:
120 pListener->OnApplicationTerminated(pEventArg->GetAppId(), pEventArg->GetAppType());
124 SysLog(NID_APP, "Invalid event type(%d)!!", pEventArg->GetEventType());