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_WifiDirectGroupOwnerEvent.cpp
20 * @brief This is the implementation file for the _WifiDirectGroupOwnerEvent Class.
22 * This header file contains implementation of the _WifiDirectGroupOwner Class.
25 #include <FBaseRtIEventListener.h>
26 #include <FNetWifiIWifiDirectGroupOwnerListener.h>
27 #include <FNetWifiWifiDirectDeviceInfo.h>
28 #include <FNetNetConnection.h>
29 #include <FBaseSysLog.h>
30 #include "FNetWifi_WifiDirectGroupOwnerEvent.h"
31 #include "FNetWifi_WifiDirectEventArg.h"
33 using namespace Tizen::Base::Collection;
35 namespace Tizen { namespace Net { namespace Wifi
38 _WifiDirectGroupOwnerEvent::_WifiDirectGroupOwnerEvent(void)
42 _WifiDirectGroupOwnerEvent::~_WifiDirectGroupOwnerEvent(void)
48 _WifiDirectGroupOwnerEvent::Construct(void)
50 return _Event::Initialize();
54 _WifiDirectGroupOwnerEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
56 const _WifiDirectEventArg* pArg = dynamic_cast< const _WifiDirectEventArg* >(&arg);
57 SysTryReturnVoidResult(NID_NET_WIFI, pArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is a null pointer.");
59 result r = pArg->GetError();
60 SysLog(NID_NET_WIFI, "The result value of IEventArg is %s.", GetErrorMessage(r));
62 IWifiDirectGroupOwnerListener* pGroupOwnerListener = dynamic_cast< IWifiDirectGroupOwnerListener* >(&listener);
63 SysTryReturnVoidResult(NID_NET_WIFI, pGroupOwnerListener != null, E_INVALID_ARG, "[E_INVALID_ARG] The listener argument is invalid.");
65 _WifiDirectEventType eventType = pArg->GetEventType();
66 WifiDirectDeviceId localDeviceId = pArg->GetDeviceId();
70 case WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED:
71 SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED)");
73 WifiDirectDeviceInfo* pClientDeviceInfo = pArg->GetDeviceInfo();
74 pGroupOwnerListener->OnWifiDirectClientAssociated(localDeviceId, *pClientDeviceInfo);
78 case WIFI_DIRECT_GO_EVENT_CLIENT_DISASSOCIATED:
79 SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_GO_EVENT_CLIENT_DISASSOCIATED)");
81 WifiDirectAssociationTerminationReason reason = pArg->GetDisassociationReason();
82 WifiDirectDeviceInfo* pClientDeviceInfo = pArg->GetDeviceInfo();
83 pGroupOwnerListener->OnWifiDirectClientDisassociated(localDeviceId, *pClientDeviceInfo, reason);
87 case WIFI_DIRECT_GO_EVENT_GROUP_DESTROYED:
88 case WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT:
90 SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_GO_EVENT_GROUP_DESTROYED)");
91 pGroupOwnerListener->OnWifiDirectGroupDestroyed(localDeviceId, r);
94 case WIFI_DIRECT_GO_EVENT_SERVICE_STARTED:
95 SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_GO_EVENT_SERVICE_STARTED)");
97 const Tizen::Net::NetConnection* pNetConnection = pArg->GetNetConnection();
98 pGroupOwnerListener->OnWifiDirectGroupMemberInfoServiceStarted(localDeviceId, pNetConnection, r);
102 case WIFI_DIRECT_GO_EVENT_SERVICE_STOPPED:
103 SysLog(NID_NET_WIFI, "Firing External Event (Type: WIFI_DIRECT_GO_EVENT_SERVICE_STOPPED)");
104 pGroupOwnerListener->OnWifiDirectGroupMemberInfoServiceStopped(localDeviceId, r);
108 SysLog(NID_NET_WIFI, "An undefined external WifiDirectGroupOwner event occurs. (Type: %d)", eventType);
113 } } } // Tizen::Net::Wifi