2 // Open Service Platform
3 // Copyright (c) 2012-2013 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 FNetWifi_WifiDirectGroupClientEvent.cpp
20 * @brief This is the implementation file for the _WifiDirectGroupClientEvent Class.
22 * This header file contains implementation of the _WifiDirectGroupClientEvent Class.
25 #include <FBaseRtIEventListener.h>
26 #include <FNetWifiIWifiDirectGroupClientListener.h>
27 #include <FBaseColArrayList.h>
28 #include <FNetWifiWifiDirectGroupMember.h>
29 #include <FNetWifiWifiDirectDeviceInfo.h>
30 #include <FNetWifiWifiDirectGroupInfo.h>
31 #include <FNetWifiWifiDirectGroupOwner.h>
32 #include <FNetWifiWifiDirectGroupClient.h>
33 #include <FBaseSysLog.h>
34 #include "FNetWifi_WifiDirectGroupClientEvent.h"
35 #include "FNetWifi_WifiDirectGroupOwnerImpl.h"
36 #include "FNetWifi_WifiDirectGroupClientImpl.h"
37 #include "FNetWifi_WifiDirectDeviceImpl.h"
38 #include "FNetWifi_WifiDirectEventArg.h"
40 using namespace Tizen::Base::Collection;
42 namespace Tizen { namespace Net { namespace Wifi
45 _WifiDirectGroupClientEvent::_WifiDirectGroupClientEvent(void)
49 _WifiDirectGroupClientEvent::~_WifiDirectGroupClientEvent(void)
55 _WifiDirectGroupClientEvent::Construct(void)
57 return _Event::Initialize();
61 _WifiDirectGroupClientEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
63 const _WifiDirectEventArg* pArg = dynamic_cast< const _WifiDirectEventArg* >(&arg);
64 SysTryReturnVoidResult(NID_NET_WIFI, pArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is a null pointer.");
66 result r = pArg->GetError();
67 SysLog(NID_NET_WIFI, "The result value of IEventArg is %s.", GetErrorMessage(r));
69 IWifiDirectGroupClientListener* pGroupClientListener = dynamic_cast< IWifiDirectGroupClientListener* >(&listener);
70 SysTryReturnVoidResult(NID_NET_WIFI, pGroupClientListener != null, E_INVALID_ARG, "[E_INVALID_ARG] The listener argument is invalid.");
72 _WifiDirectEventType eventType = pArg->GetEventType();
73 WifiDirectDeviceId localDeviceId = pArg->GetDeviceId();
77 case WIFI_DIRECT_GC_EVENT_DISASSOCIATED:
78 SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_GC_EVENT_DISASSOCIATED)");
80 WifiDirectAssociationTerminationReason reason = pArg->GetDisassociationReason();
81 pGroupClientListener->OnWifiDirectAssociationTerminated(localDeviceId, reason, r);
85 case WIFI_DIRECT_GC_EVENT_GROUP_OWNER_INFO_RESPONDED:
86 SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_GC_EVENT_GROUP_OWNER_INFO_RESPONDED)");
88 WifiDirectDeviceInfo* pGroupOwnerInfo = pArg->GetDeviceInfo();
89 pGroupClientListener->OnWifiDirectGroupOwnerInfoReceived(localDeviceId, *pGroupOwnerInfo, r);
93 case WIFI_DIRECT_GC_EVENT_GROUP_MEMBER_INFO_LIST_RESPONDED:
94 SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_GC_EVENT_GROUP_MEMBER_INFO_LIST_RESPONDED)");
96 IList* pGroupMemberInfoList = pArg->GetDeviceInfoList();
97 pGroupClientListener->OnWifiDirectAllGroupMemberInfoReceivedN(localDeviceId, pGroupMemberInfoList, r);
102 SysLog(NID_NET_WIFI, "An undefined external WifiDirectGroupClient event occurs. (Type: %d)", eventType);
107 } } } // Tizen::Net::Wifi