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 FBaseRt_EventDrivenThreadEvent.cpp
20 * @brief This is the implementation file for the _EventDrivenThreadEvent class.
25 #include <FBaseSysLog.h>
26 #include "FBaseRt_EventDrivenThreadEvent.h"
27 #include "FBaseRt_EventDrivenThreadEventArg.h"
28 #include "FBaseRt_IEventDrivenThreadEventListener.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
33 using namespace Tizen::Base::Runtime;
35 namespace Tizen { namespace Base { namespace Runtime
38 _EventDrivenThreadEvent::_EventDrivenThreadEvent(void)
43 _EventDrivenThreadEvent::~_EventDrivenThreadEvent(void)
49 _EventDrivenThreadEvent::Construct(_IEventDrivenThreadEventListener& listener)
54 SysTryReturn(NID_BASE_RT, !IsFailed(r), r, r, "[%s] Failed to initialize.", GetErrorMessage(r));
56 r = AddListener(listener);
57 SysTryReturn(NID_BASE_RT, !IsFailed(r), r, r, "[%s] Failed add listener.", GetErrorMessage(r));
63 _EventDrivenThreadEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
65 _IEventDrivenThreadEventListener* pEventDrivenThreadEventListener =
66 dynamic_cast <_IEventDrivenThreadEventListener*>(&listener);
67 const _EventDrivenThreadEventArg* pEventDrivenThreadEventArg = dynamic_cast <const _EventDrivenThreadEventArg*>(&arg);
68 SysTryReturnVoidResult(NID_BASE_RT, pEventDrivenThreadEventListener != null && pEventDrivenThreadEventArg != null, E_INVALID_ARG,
69 "[%s] listener or agr is null.",
72 if (pEventDrivenThreadEventArg->GetType() == EVENT_DRIVEN_THREAD_EVENT_TYPE_USER_EVENT)
74 pEventDrivenThreadEventListener->OnUserEventReceivedN(
75 pEventDrivenThreadEventArg->GetRequestId(), pEventDrivenThreadEventArg->GetArgs());
79 pEventDrivenThreadEventListener->OnStop();
83 } } } // Tizen::Base::Runtime