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 FNetWifiWifiDirectDeviceManager.cpp
20 * @brief This is the implementation file for the WifiDirectDeviceManager
23 * This file contains implementation of the WifiDirectDeviceManager Class.
26 #include <FNetWifiWifiDirectDeviceManager.h>
27 #include <FNetWifiWifiDirectDeviceInfo.h>
28 #include <FNetWifiWifiDirectDevice.h>
29 #include <FBaseColArrayList.h>
30 #include <FBaseString.h>
31 #include <FBaseSysLog.h>
32 #include "FSys_SystemInfoImpl.h"
33 #include "FNetWifi_WifiDirectDeviceManagerImpl.h"
35 static const wchar_t* _WIFI_DIRECT_FEATURE_INFO_KEY = L"http://tizen.org/feature/network.wifi.direct";
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Collection;
39 using namespace Tizen::System;
41 namespace Tizen { namespace Net { namespace Wifi {
43 WifiDirectDeviceManager::WifiDirectDeviceManager(void)
44 : __pWifiDirectDeviceManagerImpl(null)
48 WifiDirectDeviceManager::~WifiDirectDeviceManager(void)
50 if (__pWifiDirectDeviceManagerImpl != null)
52 delete __pWifiDirectDeviceManagerImpl;
53 __pWifiDirectDeviceManagerImpl = null;
58 WifiDirectDeviceManager::GetAllDeviceInfoN(void)
60 bool isWifiDirectSupported = false;
62 result r = _SystemInfoImpl::GetSysInfo(_WIFI_DIRECT_FEATURE_INFO_KEY, isWifiDirectSupported);
64 SysTryReturn(NID_NET_WIFI, r == E_SUCCESS && isWifiDirectSupported == true, null, E_UNSUPPORTED_OPERATION,
65 "[E_UNSUPPORTED_OPERATION] No WifiDirectDeviceInfo available since the device don't support the Wi-Fi Direct.");
67 pList = _WifiDirectDeviceManagerImpl::GetAllDeviceInfoN();
72 SysLogException(NID_NET_WIFI, r, "[%s] Propagating.", GetErrorMessage(r));
79 WifiDirectDeviceManager::GetWifiDirectDeviceN(const WifiDirectDeviceInfo* pLocalDeviceInfo)
81 bool isWifiDirectSupported = false;
82 WifiDirectDevice* pWifiDirectDevice = null;
83 result r = _SystemInfoImpl::GetSysInfo(_WIFI_DIRECT_FEATURE_INFO_KEY, isWifiDirectSupported);
85 SysTryReturn(NID_NET_WIFI, r == E_SUCCESS && isWifiDirectSupported == true, null, E_UNSUPPORTED_OPERATION,
86 "[E_UNSUPPORTED_OPERATION] No WifiDirectDeviceInfo available since the device don't support the Wi-Fi Direct.");
88 pWifiDirectDevice = _WifiDirectDeviceManagerImpl::GetWifiDirectDeviceN(pLocalDeviceInfo);
91 if (pWifiDirectDevice == null)
93 SysLogException(NID_NET_WIFI, r, "[%s] Propagating.", GetErrorMessage(r));
96 return pWifiDirectDevice;
99 }}}// Tizen::Net::Wifi