mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2024-11-23 15:10:16 +00:00
commit
2646cbfc14
@ -227,17 +227,25 @@ ErrCode WifiP2pServiceImpl::DiscoverDevices(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
IP2pService *pService = nullptr;
|
||||
if (CheckP2pCanOpt(pService) != WIFI_OPT_SUCCESS) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->DiscoverDevices();
|
||||
}
|
||||
|
||||
ErrCode WifiP2pServiceImpl::CheckP2pCanOpt(IP2pService *pService)
|
||||
{
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->DiscoverDevices();
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
ErrCode WifiP2pServiceImpl::StopDiscoverDevices(void)
|
||||
@ -248,14 +256,8 @@ ErrCode WifiP2pServiceImpl::StopDiscoverDevices(void)
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->StopDiscoverDevices();
|
||||
@ -269,14 +271,8 @@ ErrCode WifiP2pServiceImpl::DiscoverServices(void)
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->DiscoverServices();
|
||||
@ -289,14 +285,8 @@ ErrCode WifiP2pServiceImpl::StopDiscoverServices(void)
|
||||
WIFI_LOGE("StopDiscoverServices:NOT NATIVE PROCESS, PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->StopDiscoverServices();
|
||||
@ -310,14 +300,8 @@ ErrCode WifiP2pServiceImpl::RequestService(const WifiP2pDevice &device, const Wi
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->RequestService(device, request);
|
||||
@ -330,14 +314,8 @@ ErrCode WifiP2pServiceImpl::PutLocalP2pService(const WifiP2pServiceInfo &srvInfo
|
||||
WIFI_LOGE("PutLocalP2pService:VerifyGetWifiInfoInternalPermission PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->PutLocalP2pService(srvInfo);
|
||||
@ -350,14 +328,8 @@ ErrCode WifiP2pServiceImpl::DeleteLocalP2pService(const WifiP2pServiceInfo &srvI
|
||||
WIFI_LOGE("DeleteLocalP2pService:VerifyGetWifiInfoInternalPermission PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->DeleteLocalP2pService(srvInfo);
|
||||
@ -371,14 +343,8 @@ ErrCode WifiP2pServiceImpl::StartP2pListen(int period, int interval)
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->StartP2pListen(period, interval);
|
||||
@ -392,14 +358,8 @@ ErrCode WifiP2pServiceImpl::StopP2pListen()
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->StopP2pListen();
|
||||
@ -422,14 +382,8 @@ ErrCode WifiP2pServiceImpl::CreateGroup(const WifiP2pConfig &config)
|
||||
return WIFI_OPT_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->CreateGroup(config);
|
||||
@ -443,14 +397,8 @@ ErrCode WifiP2pServiceImpl::RemoveGroup()
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
WifiP2pGroupInfo config;
|
||||
@ -480,14 +428,8 @@ ErrCode WifiP2pServiceImpl::DeleteGroup(const WifiP2pGroupInfo &group)
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->DeleteGroup(group);
|
||||
@ -523,9 +465,8 @@ ErrCode WifiP2pServiceImpl::P2pConnect(const WifiP2pConfig &config)
|
||||
WIFI_LOGE("P2pConnect:VerifyPassphrase failed!");
|
||||
return WIFI_OPT_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
WifiP2pConfig updateConfig = config;
|
||||
@ -559,12 +500,6 @@ ErrCode WifiP2pServiceImpl::P2pConnect(const WifiP2pConfig &config)
|
||||
WIFI_LOGW("invalid mac address");
|
||||
}
|
||||
#endif
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
WriteP2pKpiCountHiSysEvent(static_cast<int>(P2P_CHR_EVENT::CONN_CNT));
|
||||
return pService->P2pConnect(updateConfig);
|
||||
}
|
||||
@ -577,14 +512,8 @@ ErrCode WifiP2pServiceImpl::P2pCancelConnect()
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->P2pCancelConnect();
|
||||
@ -599,14 +528,8 @@ ErrCode WifiP2pServiceImpl::QueryP2pLinkedInfo(WifiP2pLinkedInfo &linkedInfo)
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
@ -640,14 +563,8 @@ ErrCode WifiP2pServiceImpl::GetCurrentGroup(WifiP2pGroupInfo &group)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
ErrCode errCode = pService->GetCurrentGroup(group);
|
||||
@ -707,14 +624,8 @@ ErrCode WifiP2pServiceImpl::GetP2pDiscoverStatus(int &status)
|
||||
WIFI_LOGE("GetP2pDiscoverStatus:VerifyGetWifiInfoInternalPermission PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->GetP2pDiscoverStatus(status);
|
||||
@ -727,14 +638,8 @@ ErrCode WifiP2pServiceImpl::GetP2pConnectedStatus(int &status)
|
||||
WIFI_LOGE("GetP2pConnectedStatus:NOT NATIVE PROCESS, PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->GetP2pConnectedStatus(status);
|
||||
@ -758,14 +663,8 @@ ErrCode WifiP2pServiceImpl::QueryP2pDevices(std::vector<WifiP2pDevice> &devices)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
ErrCode errCode = pService->QueryP2pDevices(devices);
|
||||
@ -805,14 +704,8 @@ ErrCode WifiP2pServiceImpl::QueryP2pLocalDevice(WifiP2pDevice &device)
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not runing!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
@ -845,14 +738,8 @@ ErrCode WifiP2pServiceImpl::QueryP2pGroups(std::vector<WifiP2pGroupInfo> &groups
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
ErrCode errCode = pService->QueryP2pGroups(groups);
|
||||
@ -904,14 +791,8 @@ ErrCode WifiP2pServiceImpl::QueryP2pServices(std::vector<WifiP2pServiceInfo> &se
|
||||
WIFI_LOGE("QueryP2pServices:VerifyGetWifiInfoInternalPermission PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->QueryP2pServices(services);
|
||||
@ -971,13 +852,8 @@ ErrCode WifiP2pServiceImpl::SetP2pDeviceName(const std::string &deviceName)
|
||||
return WIFI_OPT_INVALID_PARAM;
|
||||
}
|
||||
WifiConfigCenter::GetInstance().SetP2pDeviceName(deviceName);
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->SetP2pDeviceName(deviceName);
|
||||
@ -990,13 +866,8 @@ ErrCode WifiP2pServiceImpl::SetP2pWfdInfo(const WifiP2pWfdInfo &wfdInfo)
|
||||
WIFI_LOGE("SetP2pWfdInfo:VerifyGetWifiInfoInternalPermission PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->SetP2pWfdInfo(wfdInfo);
|
||||
@ -1009,13 +880,8 @@ ErrCode WifiP2pServiceImpl::Hid2dRequestGcIp(const std::string& gcMac, std::stri
|
||||
WIFI_LOGE("Hid2dRequestGcIp:NOT NATIVE PROCESS, PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not runing!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->Hid2dRequestGcIp(gcMac, ipAddr);
|
||||
@ -1054,13 +920,8 @@ ErrCode WifiP2pServiceImpl::Hid2dSharedlinkDecrease()
|
||||
WIFI_LOGE("Hid2dSharedlinkDecrease:NOT NATIVE PROCESS, PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not runing!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
if (pService->GetSharedLinkCount() > 0) {
|
||||
@ -1081,14 +942,8 @@ ErrCode WifiP2pServiceImpl::Hid2dCreateGroup(const int frequency, FreqType type)
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
WifiSettings::GetInstance().SetP2pBusinessType(P2pBusinessType::P2P_TYPE_HID2D);
|
||||
@ -1110,14 +965,8 @@ ErrCode WifiP2pServiceImpl::Hid2dConnect(const Hid2dConnectConfig& config)
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not running!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
WifiSettings::GetInstance().SetP2pBusinessType(P2pBusinessType::P2P_TYPE_HID2D);
|
||||
@ -1156,13 +1005,8 @@ ErrCode WifiP2pServiceImpl::Hid2dGetRecommendChannel(const RecommendChannelReque
|
||||
WIFI_LOGE("Hid2dGetRecommendChannel:NOT NATIVE PROCESS, PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not runing!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
int channel = pService->GetP2pRecommendChannel();
|
||||
@ -1211,14 +1055,8 @@ ErrCode WifiP2pServiceImpl::Hid2dGetSelfWifiCfgInfo(SelfCfgType cfgType,
|
||||
WIFI_LOGE("Hid2dGetSelfWifiCfgInfo:NOT NATIVE PROCESS, PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not runing!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->Hid2dGetSelfWifiCfgInfo(cfgType, cfgData, getDatValidLen);
|
||||
@ -1232,14 +1070,8 @@ ErrCode WifiP2pServiceImpl::Hid2dSetPeerWifiCfgInfo(PeerCfgType cfgType,
|
||||
WIFI_LOGE("Hid2dSetPeerWifiCfgInfo:NOT NATIVE PROCESS, PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not runing!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->Hid2dSetPeerWifiCfgInfo(cfgType, cfgData, setDataValidLen);
|
||||
@ -1252,14 +1084,8 @@ ErrCode WifiP2pServiceImpl::Hid2dSetUpperScene(const std::string& ifName, const
|
||||
WIFI_LOGE("Hid2dSetUpperScene:NOT NATIVE PROCESS, PERMISSION_DENIED!");
|
||||
return WIFI_OPT_PERMISSION_DENIED;
|
||||
}
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not runing!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
WifiSettings::GetInstance().SetHid2dUpperScene(ifName, scene);
|
||||
@ -1269,14 +1095,8 @@ ErrCode WifiP2pServiceImpl::Hid2dSetUpperScene(const std::string& ifName, const
|
||||
ErrCode WifiP2pServiceImpl::MonitorCfgChange(void)
|
||||
{
|
||||
WIFI_LOGI("MonitorCfgChange");
|
||||
if (!IsP2pServiceRunning()) {
|
||||
WIFI_LOGE("P2pService is not runing!");
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
|
||||
IP2pService *pService = WifiServiceManager::GetInstance().GetP2pServiceInst();
|
||||
if (pService == nullptr) {
|
||||
WIFI_LOGE("Get P2P service failed!");
|
||||
IP2pService *pService = nullptr;
|
||||
if (!CheckP2pCanOpt(pService)) {
|
||||
return WIFI_OPT_P2P_NOT_OPENED;
|
||||
}
|
||||
return pService->MonitorCfgChange();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "system_ability.h"
|
||||
#include "wifi_p2p_stub.h"
|
||||
#include "iremote_object.h"
|
||||
#include "ip2p_service.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Wifi {
|
||||
@ -65,6 +66,7 @@ public:
|
||||
*/
|
||||
ErrCode StopDiscoverDevices(void) override;
|
||||
|
||||
ErrCode CheckP2pCanOpt(IP2pService *pService);
|
||||
/**
|
||||
* @Description Start the search for the Wi-Fi P2P service
|
||||
*
|
||||
|
@ -26,6 +26,7 @@ ohos_fuzztest("WifiP2pStubFuzzTest") {
|
||||
"$WIFI_ROOT_DIR/frameworks/native/include",
|
||||
"$WIFI_ROOT_DIR/frameworks/native/interfaces",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p_sa",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper",
|
||||
"$WIFI_ROOT_DIR/test/fuzztest/fuzz_common_func",
|
||||
|
Loading…
Reference in New Issue
Block a user