mirror of
https://github.com/openharmony/device_manager.git
synced 2026-07-01 21:44:51 -04:00
@@ -16,7 +16,8 @@ if (defined(ohos_lite)) {
|
||||
lite_component("devicemanager_mini") {
|
||||
features = [
|
||||
"utils:devicemanagerutils_mini",
|
||||
"services/devicemanagerservice:devicemanagerservice_mini",
|
||||
"services/service:devicemanagerservice_mini",
|
||||
"services/implementation:devicemanagerserviceimpl_mini",
|
||||
"interfaces/inner_kits/native_cpp:devicemanagersdk_mini",
|
||||
"interfaces/kits/js_mini:devicemanager_native_js",
|
||||
]
|
||||
@@ -29,7 +30,8 @@ if (defined(ohos_lite)) {
|
||||
lite_component("device_manager") {
|
||||
features = [
|
||||
"utils:devicemanagerutils",
|
||||
"services/devicemanagerservice:devicemanagerservice",
|
||||
"services/service:devicemanagerservice",
|
||||
"services/implementation:devicemanagerserviceimpl",
|
||||
"interfaces/inner_kits/native_cpp:devicemanagersdk",
|
||||
"ext/pin_auth:devicemanagerext_pin_auth",
|
||||
]
|
||||
@@ -46,12 +48,13 @@ if (defined(ohos_lite)) {
|
||||
"interfaces/inner_kits/native_cpp:devicemanagersdk",
|
||||
"interfaces/kits:devicemanager_native_js",
|
||||
"sa_profile:dm_sa_profile",
|
||||
"services/devicemanagerservice:devicemanagerservice",
|
||||
"services/service:devicemanagerservice",
|
||||
"services/implementation:devicemanagerserviceimpl",
|
||||
"utils:devicemanagerutils",
|
||||
]
|
||||
}
|
||||
group("device_manager_test") {
|
||||
testonly = true
|
||||
deps = [ "test:test" ]
|
||||
deps = []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
}
|
||||
],
|
||||
"test": [
|
||||
"//foundation/distributedhardware/device_manager:device_manager_test"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef __LP64__
|
||||
const std::string LIB_LOAD_PATH = "/system/lib64/";
|
||||
#else
|
||||
const std::string LIB_LOAD_PATH = "/system/lib/";
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
const std::string DM_PKG_NAME = "ohos.distributedhardware.devicemanager";
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@ devicemanager_path = "//foundation/distributedhardware/device_manager"
|
||||
|
||||
common_path = "${devicemanager_path}/common"
|
||||
utils_path = "${devicemanager_path}/utils"
|
||||
services_path = "${devicemanager_path}/services/devicemanagerservice"
|
||||
services_path = "${devicemanager_path}/services/service"
|
||||
servicesimpl_path = "${devicemanager_path}/services/implementation"
|
||||
innerkits_path = "${devicemanager_path}/interfaces/inner_kits"
|
||||
ext_path = "${devicemanager_path}/ext"
|
||||
aainnerkits_path = "//foundation/ability/ability_runtime/interfaces/inner_api"
|
||||
|
||||
@@ -26,23 +26,22 @@ if (defined(ohos_lite)) {
|
||||
"include",
|
||||
"${common_path}/include",
|
||||
"${ext_path}/pin_auth/include/ability",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/config",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/deviceinfo",
|
||||
"${services_path}/include/devicestate",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/commonevent",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/config",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/commonevent",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${services_path}/include/ipc",
|
||||
"${services_path}/include/ipc/standard",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/ipc/standard",
|
||||
"${services_path}/include",
|
||||
"${servicesimpl_path}/include",
|
||||
"${innerkits_path}/native_cpp/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
@@ -70,7 +69,8 @@ if (defined(ohos_lite)) {
|
||||
"${innerkits_path}/native_cpp:devicemanagersdk",
|
||||
"${utils_path}:devicemanagerutils",
|
||||
"//base/security/device_auth/services:deviceauth_sdk",
|
||||
"//foundation/distributedhardware/device_manager/services/devicemanagerservice:devicemanagerservice",
|
||||
"//foundation/distributedhardware/device_manager/services/service:devicemanagerservice",
|
||||
"//foundation/distributedhardware/device_manager/services/implementation:devicemanagerserviceimpl",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
||||
|
||||
+27
-31
@@ -25,24 +25,23 @@ if (defined(ohos_lite)) {
|
||||
"include/lite",
|
||||
"${common_path}/include",
|
||||
"${ext_path}/pin_auth/include/ability",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/config",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/authentication/showconfirm/lite",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/deviceinfo",
|
||||
"${services_path}/include/devicestate",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/commonevent",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/config",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/authentication/showconfirm/lite",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/commonevent",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${services_path}/include/ipc",
|
||||
"${services_path}/include/ipc/lite",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/ipc/lite",
|
||||
"${services_path}/include",
|
||||
"${servicesimpl_path}/include",
|
||||
"${innerkits_path}/native_cpp/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
@@ -70,7 +69,6 @@ if (defined(ohos_lite)) {
|
||||
"${innerkits_path}/native_cpp:devicemanagersdk",
|
||||
"${utils_path}:devicemanagerutils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//base/security/device_auth/services:deviceauth_sdk",
|
||||
"//foundation/communication/dsoftbus/sdk:softbus_client",
|
||||
"//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
@@ -93,24 +91,23 @@ if (defined(ohos_lite)) {
|
||||
"include/standard",
|
||||
"${common_path}/include",
|
||||
"${ext_path}/pin_auth/include/ability",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/config",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/authentication/showconfirm/standard",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/deviceinfo",
|
||||
"${services_path}/include/devicestate",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/commonevent",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/config",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/authentication/showconfirm/standard",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/commonevent",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${services_path}/include/ipc",
|
||||
"${services_path}/include/ipc/standard",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/ipc/standard",
|
||||
"${services_path}/include",
|
||||
"${servicesimpl_path}/include",
|
||||
"${innerkits_path}/native_cpp/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
@@ -140,9 +137,8 @@ if (defined(ohos_lite)) {
|
||||
"${ext_path}/pin_auth/show_pin_dialog/dialog_ui/js:dialog_js_files_etc",
|
||||
"${innerkits_path}/native_cpp:devicemanagersdk",
|
||||
"${utils_path}:devicemanagerutils",
|
||||
"//base/security/device_auth/services:deviceauth_sdk",
|
||||
"//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
|
||||
"//foundation/distributedhardware/device_manager/services/devicemanagerservice:devicemanagerservice",
|
||||
"//foundation/distributedhardware/device_manager/services/implementation:devicemanagerserviceimpl",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ if (defined(ohos_lite)) {
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
"${ext_path}/profile/include",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${services_path}/include/ipc/standard",
|
||||
"${services_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/ipc/standard",
|
||||
"${innerkits_path}/native_cpp/include",
|
||||
@@ -51,7 +51,7 @@ if (defined(ohos_lite)) {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${services_path}:devicemanagerservice",
|
||||
"${servicesimpl_path}:devicemanagerserviceimpl",
|
||||
"${utils_path}:devicemanagerutils",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
||||
@@ -30,7 +30,7 @@ if (defined(ohos_lite)) {
|
||||
"${common_path}/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
"${services_path}/include/dispatch",
|
||||
"${servicesimpl_path}/include/dispatch",
|
||||
]
|
||||
include_dirs += [
|
||||
"//utils/native/lite/include",
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_DM_SERVICE_H
|
||||
#define OHOS_DM_SERVICE_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "dm_ability_manager.h"
|
||||
#include "dm_auth_manager.h"
|
||||
#include "dm_device_info.h"
|
||||
#include "dm_device_info_manager.h"
|
||||
#include "dm_device_state_manager.h"
|
||||
#include "dm_discovery_manager.h"
|
||||
#include "single_instance.h"
|
||||
#include "softbus_connector.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class DeviceManagerService {
|
||||
DECLARE_SINGLE_INSTANCE_BASE(DeviceManagerService);
|
||||
public:
|
||||
int32_t Init();
|
||||
~DeviceManagerService();
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::GetTrustedDeviceList
|
||||
* @tc.desc: Get Trusted DeviceList of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
|
||||
std::vector<DmDeviceInfo> &deviceList);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::GetLocalDeviceInfo
|
||||
* @tc.desc: Get Local DeviceInfo of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t GetLocalDeviceInfo(DmDeviceInfo &info);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::GetUdidByNetworkId
|
||||
* @tc.desc: Get Udid By NetworkId of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &udid);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::GetUuidByNetworkId
|
||||
* @tc.desc: Get Uuid By NetworkId of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &uuid);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::StartDeviceDiscovery
|
||||
* @tc.desc: Start Device Discovery of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
|
||||
const std::string &extra);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::StopDeviceDiscovery
|
||||
* @tc.desc: Stop Device Discovery of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::AuthenticateDevice
|
||||
* @tc.desc: Authenticate Device of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId,
|
||||
const std::string &extra);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::UnAuthenticateDevice
|
||||
* @tc.desc: UnAuthenticate Device of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::VerifyAuthentication
|
||||
* @tc.desc: Verify Authentication of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t VerifyAuthentication(const std::string &authParam);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::GetFaParam
|
||||
* @tc.desc: Get FaParam of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t GetFaParam(std::string &pkgName, DmAuthParam &authParam);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::SetUserOperation
|
||||
* @tc.desc: Se tUser Operation of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t SetUserOperation(std::string &pkgName, int32_t action);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::RegisterDevStateCallback
|
||||
* @tc.desc: Register DevState Callback of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t RegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::UnRegisterDevStateCallback
|
||||
* @tc.desc: UnRegister DevState Callback of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerService::IsServiceInitialized
|
||||
* @tc.desc: IsServiceInitialized of the Device Manager Service
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
bool IsServiceInitialized();
|
||||
|
||||
private:
|
||||
DeviceManagerService() = default;
|
||||
bool intFlag_ = false;
|
||||
std::shared_ptr<DmAuthManager> authMgr_;
|
||||
std::shared_ptr<DmDeviceInfoManager> deviceInfoMgr_;
|
||||
std::shared_ptr<DmDeviceStateManager> deviceStateMgr_;
|
||||
std::shared_ptr<DmDiscoveryManager> discoveryMgr_;
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector_;
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener_;
|
||||
std::shared_ptr<DmAbilityManager> abilityMgr_;
|
||||
std::shared_ptr<HiChainConnector> hiChainConnector_;
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DM_SERVICE_H
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_DM_DEVICEINFO_MANAGER_H
|
||||
#define OHOS_DM_DEVICEINFO_MANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "dm_adapter_manager.h"
|
||||
#include "dm_device_info.h"
|
||||
#include "softbus_connector.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class DmDeviceInfoManager {
|
||||
public:
|
||||
explicit DmDeviceInfoManager(std::shared_ptr<SoftbusConnector> &softbusConnectorPtr);
|
||||
|
||||
/**
|
||||
* @tc.name: DmDeviceInfoManager::GetTrustedDeviceList
|
||||
* @tc.desc: Get TrustedDevice List of the DeviceManager DeviceInfo Manager
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
|
||||
std::vector<DmDeviceInfo> &deviceList);
|
||||
|
||||
/**
|
||||
* @tc.name: DmDeviceInfoManager::GetLocalDeviceInfo
|
||||
* @tc.desc: Get Local DeviceInfo of the DeviceManager DeviceInfo Manager
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
int32_t GetLocalDeviceInfo(DmDeviceInfo &info);
|
||||
|
||||
private:
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector_;
|
||||
std::string decisionSoName_;
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DM_DEVICEINFO_MANAGER_H
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "dm_device_info_manager.h"
|
||||
|
||||
#include "dm_constants.h"
|
||||
#include "dm_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
DmDeviceInfoManager::DmDeviceInfoManager(std::shared_ptr<SoftbusConnector> &softbusConnectorPtr)
|
||||
: softbusConnector_(softbusConnectorPtr)
|
||||
{
|
||||
LOGI("DmDeviceInfoManager constructor");
|
||||
decisionSoName_ = "libdevicemanagerext_decision.z.so";
|
||||
}
|
||||
|
||||
int32_t DmDeviceInfoManager::GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
|
||||
std::vector<DmDeviceInfo> &deviceList)
|
||||
{
|
||||
int32_t ret = softbusConnector_->GetTrustedDeviceList(deviceList);
|
||||
if (ret != DM_OK) {
|
||||
LOGE("GetTrustedDeviceList failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!extra.empty() && !deviceList.empty()) {
|
||||
DmAdapterManager &adapterMgrPtr = DmAdapterManager::GetInstance();
|
||||
std::shared_ptr<IDecisionAdapter> decisionAdapter = adapterMgrPtr.GetDecisionAdapter(decisionSoName_);
|
||||
if (decisionAdapter != nullptr) {
|
||||
decisionAdapter->FilterDeviceList(deviceList, extra);
|
||||
} else {
|
||||
LOGE("GetTrustedDeviceList decisionAdapter is nullptr");
|
||||
}
|
||||
}
|
||||
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DmDeviceInfoManager::GetLocalDeviceInfo(DmDeviceInfo &info)
|
||||
{
|
||||
int32_t ret = softbusConnector_->GetLocalDeviceInfo(info);
|
||||
if (ret != DM_OK) {
|
||||
LOGE("GetLocalDeviceInfo failed");
|
||||
return ret;
|
||||
}
|
||||
return DM_OK;
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
Executable → Regular
+28
-38
@@ -25,22 +25,21 @@ if (defined(ohos_lite)) {
|
||||
include_dirs = [
|
||||
"${devicemanager_path}/interfaces/inner_kits/native_cpp/include",
|
||||
"${devicemanager_path}/interfaces/inner_kits/native_cpp/include/notify",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/config",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/authentication/showconfirm/lite",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/deviceinfo",
|
||||
"${services_path}/include/devicestate",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/commonevent",
|
||||
"${services_path}/include/dependency/multipleuser",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/dependency/mini",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/eventbus",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/config",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/authentication/showconfirm/lite",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/commonevent",
|
||||
"${servicesimpl_path}/include/dependency/multipleuser",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/dependency/mini",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/eventbus",
|
||||
"${common_path}/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
@@ -51,7 +50,7 @@ if (defined(ohos_lite)) {
|
||||
"${utils_path}/include/dfx/lite",
|
||||
"${utils_path}/include/permission/lite",
|
||||
"foundation/multimedia/image_standard/mock/native/include",
|
||||
"${services_path}/include/dispatch",
|
||||
"${servicesimpl_path}/include/dispatch",
|
||||
"${ext_path}/pin_auth/include",
|
||||
"${ext_path}/pin_auth/include/lite",
|
||||
]
|
||||
@@ -70,7 +69,7 @@ if (defined(ohos_lite)) {
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/discovery",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/transport",
|
||||
"//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
|
||||
"//foundation/distributedhardware/device_manager/services/devicemanagerservice/include/dependency/multipleuser",
|
||||
"//foundation/distributedhardware/device_manager/services/implementation/include/dependency/multipleuser",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
]
|
||||
@@ -104,7 +103,7 @@ if (defined(ohos_lite)) {
|
||||
defines = [
|
||||
"__LITEOS_M__",
|
||||
"HI_LOG_ENABLE",
|
||||
"DH_LOG_TAG=\"devicemanagerservice\"",
|
||||
"DH_LOG_TAG=\"devicemanagerserviceimpl\"",
|
||||
"LOG_DOMAIN=0xD004100",
|
||||
]
|
||||
|
||||
@@ -134,7 +133,7 @@ if (defined(ohos_lite)) {
|
||||
]
|
||||
}
|
||||
} else {
|
||||
executable("devicemanagerservice") {
|
||||
executable("devicemanagerserviceimpl") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"include/config",
|
||||
@@ -142,7 +141,6 @@ if (defined(ohos_lite)) {
|
||||
"include/authentication",
|
||||
"include/authentication/showconfirm/lite",
|
||||
"include/ability",
|
||||
"include/deviceinfo",
|
||||
"include/devicestate",
|
||||
"include/discovery",
|
||||
"include/dependency/multipleuser/",
|
||||
@@ -213,7 +211,7 @@ if (defined(ohos_lite)) {
|
||||
defines = [
|
||||
"LITE_DEVICE",
|
||||
"HI_LOG_ENABLE",
|
||||
"DH_LOG_TAG=\"devicemanagerservice\"",
|
||||
"DH_LOG_TAG=\"devicemanagerserviceimpl\"",
|
||||
"LOG_DOMAIN=0xD004100",
|
||||
]
|
||||
|
||||
@@ -234,11 +232,11 @@ if (defined(ohos_lite)) {
|
||||
}
|
||||
}
|
||||
} else if (!support_jsapi) {
|
||||
group("devicemanagerservice") {
|
||||
group("devicemanagerserviceimpl") {
|
||||
deps = []
|
||||
}
|
||||
} else {
|
||||
config("devicemanagerservice_config") {
|
||||
config("devicemanagerserviceimpl_config") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"include/config",
|
||||
@@ -246,7 +244,6 @@ if (defined(ohos_lite)) {
|
||||
"include/authentication",
|
||||
"include/authentication/showconfirm/standard",
|
||||
"include/ability",
|
||||
"include/deviceinfo",
|
||||
"include/devicestate",
|
||||
"include/discovery",
|
||||
"include/dependency/commonevent",
|
||||
@@ -254,9 +251,6 @@ if (defined(ohos_lite)) {
|
||||
"include/dependency/hichain",
|
||||
"include/dependency/softbus",
|
||||
"include/dependency/timer",
|
||||
"include/ipc",
|
||||
"include/ipc/standard",
|
||||
"include/eventbus",
|
||||
"${common_path}/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
@@ -267,6 +261,8 @@ if (defined(ohos_lite)) {
|
||||
"${utils_path}/include/permission/standard",
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"//third_party/json/include",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/ipc/standard",
|
||||
]
|
||||
|
||||
if (os_account_part_exists) {
|
||||
@@ -274,7 +270,7 @@ if (defined(ohos_lite)) {
|
||||
}
|
||||
}
|
||||
|
||||
ohos_shared_library("devicemanagerservice") {
|
||||
ohos_shared_library("devicemanagerserviceimpl") {
|
||||
sources = [
|
||||
"src/ability/standard/dm_ability_manager.cpp",
|
||||
"src/adapter/standard/dm_adapter_manager.cpp",
|
||||
@@ -290,22 +286,16 @@ if (defined(ohos_lite)) {
|
||||
"src/dependency/softbus/softbus_connector.cpp",
|
||||
"src/dependency/softbus/softbus_session.cpp",
|
||||
"src/dependency/timer/dm_timer.cpp",
|
||||
"src/device_manager_service.cpp",
|
||||
"src/device_manager_service_listener.cpp",
|
||||
"src/deviceinfo/dm_device_info_manager.cpp",
|
||||
"src/device_manager_service_impl.cpp",
|
||||
"src/devicestate/dm_device_state_manager.cpp",
|
||||
"src/discovery/dm_discovery_manager.cpp",
|
||||
"src/ipc/standard/ipc_cmd_parser.cpp",
|
||||
"src/ipc/standard/ipc_server_client_proxy.cpp",
|
||||
"src/ipc/standard/ipc_server_listener.cpp",
|
||||
"src/ipc/standard/ipc_server_stub.cpp",
|
||||
]
|
||||
|
||||
public_configs = [ ":devicemanagerservice_config" ]
|
||||
public_configs = [ ":devicemanagerserviceimpl_config" ]
|
||||
|
||||
defines = [
|
||||
"HI_LOG_ENABLE",
|
||||
"DH_LOG_TAG=\"devicemanagerservice\"",
|
||||
"DH_LOG_TAG=\"devicemanagerserviceimpl\"",
|
||||
"LOG_DOMAIN=0xD004100",
|
||||
]
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@
|
||||
#include "auth_request_state.h"
|
||||
#include "auth_response_state.h"
|
||||
#include "authentication.h"
|
||||
#include "device_manager_service_listener.h"
|
||||
#include "idevice_manager_service_listener.h"
|
||||
#include "dm_ability_manager.h"
|
||||
#include "dm_adapter_manager.h"
|
||||
#include "dm_constants.h"
|
||||
@@ -122,7 +122,7 @@ class DmAuthManager final : public ISoftbusSessionCallback,
|
||||
public std::enable_shared_from_this<DmAuthManager> {
|
||||
public:
|
||||
DmAuthManager(std::shared_ptr<SoftbusConnector> softbusConnector,
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener,
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener,
|
||||
std::shared_ptr<HiChainConnector> hiChainConnector_);
|
||||
~DmAuthManager();
|
||||
|
||||
@@ -375,7 +375,7 @@ public:
|
||||
private:
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector_;
|
||||
std::shared_ptr<HiChainConnector> hiChainConnector_;
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener_;
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener_;
|
||||
std::shared_ptr<DmAdapterManager> adapterMgr_;
|
||||
std::map<int32_t, std::shared_ptr<IAuthentication>> authenticationMap_;
|
||||
std::shared_ptr<AuthRequestState> authRequestState_ = nullptr;
|
||||
+2
-30
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -32,10 +31,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
void DeviceOnLine(std::map<std::string, std::shared_ptr<ISoftbusStateCallback>> stateCallbackMap,
|
||||
DmDeviceInfo deviceInfo);
|
||||
void DeviceOffLine(std::map<std::string, std::shared_ptr<ISoftbusStateCallback>> stateCallbackMap,
|
||||
DmDeviceInfo deviceInfo);
|
||||
class SoftbusConnector {
|
||||
public:
|
||||
/**
|
||||
@@ -52,27 +47,6 @@ public:
|
||||
*/
|
||||
static void OnPublishFail(int publishId, PublishFailReason reason);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusConnector::OnSoftBusDeviceOnline
|
||||
* @tc.desc: OnSoftBus DeviceOnline of the SoftbusConnector
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnSoftBusDeviceOnline(NodeBasicInfo *info);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusConnector::OnSoftbusDeviceOffline
|
||||
* @tc.desc: OnSoftbus DeviceOffline of the SoftbusConnector
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnSoftbusDeviceOffline(NodeBasicInfo *info);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusConnector::OnSoftbusDeviceInfoChanged
|
||||
* @tc.desc: OnSoftbus DeviceInfoChanged of the SoftbusConnector
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnSoftbusDeviceInfoChanged(NodeBasicInfoType type, NodeBasicInfo *info);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusConnector::OnSoftbusDeviceFound
|
||||
* @tc.desc: OnSoftbus DeviceFound of the SoftbusConnector
|
||||
@@ -145,16 +119,15 @@ public:
|
||||
int32_t RegisterSoftbusDiscoveryCallback(const std::string &pkgName,
|
||||
const std::shared_ptr<ISoftbusDiscoveryCallback> callback);
|
||||
int32_t UnRegisterSoftbusDiscoveryCallback(const std::string &pkgName);
|
||||
int32_t GetTrustedDeviceList(std::vector<DmDeviceInfo> &deviceInfoList);
|
||||
int32_t GetLocalDeviceInfo(DmDeviceInfo &deviceInfo);
|
||||
int32_t StartDiscovery(const DmSubscribeInfo &subscribeInfo);
|
||||
int32_t StopDiscovery(uint16_t subscribeId);
|
||||
std::shared_ptr<SoftbusSession> GetSoftbusSession();
|
||||
bool HaveDeviceInMap(std::string deviceId);
|
||||
void HandleDeviceOnline(const DmDeviceInfo &info);
|
||||
void HandleDeviceOffline(const DmDeviceInfo &info);
|
||||
|
||||
private:
|
||||
int32_t Init();
|
||||
static int32_t CovertNodeBasicInfoToDmDevice(const NodeBasicInfo &nodeBasicInfo, DmDeviceInfo &dmDeviceInfo);
|
||||
static void CovertDeviceInfoToDmDevice(const DeviceInfo &deviceInfo, DmDeviceInfo &dmDeviceInfo);
|
||||
static ConnectionAddr *GetConnectAddrByType(DeviceInfo *deviceInfo, ConnectionAddrType type);
|
||||
|
||||
@@ -165,7 +138,6 @@ private:
|
||||
NOT_ALLOW_BE_DISCOVERY = 2,
|
||||
};
|
||||
static PulishStatus publishStatus;
|
||||
static INodeStateCb softbusNodeStateCb_;
|
||||
static IDiscoveryCallback softbusDiscoveryCallback_;
|
||||
static IPublishCallback softbusPublishCallback_;
|
||||
std::shared_ptr<SoftbusSession> softbusSession_;
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_DM_SERVICE_IMPL_H
|
||||
#define OHOS_DM_SERVICE_IMPL_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "dm_ability_manager.h"
|
||||
#include "dm_auth_manager.h"
|
||||
#include "dm_device_info.h"
|
||||
#include "dm_device_state_manager.h"
|
||||
#include "dm_discovery_manager.h"
|
||||
#include "idevice_manager_service_impl.h"
|
||||
#include "single_instance.h"
|
||||
#include "softbus_connector.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class DeviceManagerServiceImpl : public IDeviceManagerServiceImpl {
|
||||
public:
|
||||
DeviceManagerServiceImpl();
|
||||
virtual ~DeviceManagerServiceImpl();
|
||||
|
||||
int32_t Initialize(const std::shared_ptr<IDeviceManagerServiceListener> &listener);
|
||||
|
||||
void Release();
|
||||
|
||||
int32_t StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
|
||||
const std::string &extra);
|
||||
|
||||
int32_t StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId);
|
||||
|
||||
int32_t AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId,
|
||||
const std::string &extra);
|
||||
|
||||
int32_t UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId);
|
||||
|
||||
int32_t VerifyAuthentication(const std::string &authParam);
|
||||
|
||||
int32_t GetFaParam(std::string &pkgName, DmAuthParam &authParam);
|
||||
|
||||
int32_t SetUserOperation(std::string &pkgName, int32_t action);
|
||||
|
||||
int32_t RegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
|
||||
|
||||
int32_t UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
|
||||
|
||||
void HandleDeviceOnline(const DmDeviceInfo &info);
|
||||
|
||||
void HandleDeviceOffline(const DmDeviceInfo &info);
|
||||
|
||||
int OnSessionOpened(int sessionId, int result);
|
||||
|
||||
void OnSessionClosed(int sessionId);
|
||||
|
||||
void OnBytesReceived(int sessionId, const void *data, unsigned int dataLen);
|
||||
|
||||
private:
|
||||
std::shared_ptr<DmAuthManager> authMgr_;
|
||||
std::shared_ptr<DmDeviceStateManager> deviceStateMgr_;
|
||||
std::shared_ptr<DmDiscoveryManager> discoveryMgr_;
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector_;
|
||||
std::shared_ptr<DmAbilityManager> abilityMgr_;
|
||||
std::shared_ptr<HiChainConnector> hiChainConnector_;
|
||||
};
|
||||
|
||||
using CreateDMServiceFuncPtr = IDeviceManagerServiceImpl *(*)(void);
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DM_SERVICE_IMPL_H
|
||||
Executable → Regular
+3
-3
@@ -23,7 +23,7 @@
|
||||
#else
|
||||
#include <mutex>
|
||||
#endif
|
||||
#include "device_manager_service_listener.h"
|
||||
#include "idevice_manager_service_listener.h"
|
||||
#include "dm_adapter_manager.h"
|
||||
#include "softbus_connector.h"
|
||||
#include "dm_timer.h"
|
||||
@@ -42,7 +42,7 @@ class DmDeviceStateManager final : public ISoftbusStateCallback,
|
||||
public std::enable_shared_from_this<DmDeviceStateManager> {
|
||||
public:
|
||||
DmDeviceStateManager(std::shared_ptr<SoftbusConnector> softbusConnector,
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener,
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener,
|
||||
std::shared_ptr<HiChainConnector> hiChainConnector);
|
||||
~DmDeviceStateManager();
|
||||
|
||||
@@ -159,7 +159,7 @@ private:
|
||||
std::mutex remoteDeviceInfosMutex_;
|
||||
#endif
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector_;
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener_;
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener_;
|
||||
std::map<std::string, DmDeviceInfo> remoteDeviceInfos_;
|
||||
std::map<std::string, std::string> decisionInfos_;
|
||||
std::map<std::string, StateTimerInfo> stateTimerInfoMap_;
|
||||
+3
-3
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "device_manager_service_listener.h"
|
||||
#include "idevice_manager_service_listener.h"
|
||||
#include "dm_timer.h"
|
||||
#include "softbus_connector.h"
|
||||
namespace OHOS {
|
||||
@@ -33,7 +33,7 @@ class DmDiscoveryManager final : public ISoftbusDiscoveryCallback,
|
||||
public std::enable_shared_from_this<DmDiscoveryManager> {
|
||||
public:
|
||||
DmDiscoveryManager(std::shared_ptr<SoftbusConnector> softbusConnector,
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener);
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener);
|
||||
~DmDiscoveryManager();
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
private:
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector_;
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener_;
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener_;
|
||||
std::queue<std::string> discoveryQueue_;
|
||||
std::map<std::string, DmDiscoveryContext> discoveryContextMap_;
|
||||
std::shared_ptr<DmTimer> timer_;
|
||||
+1
-1
@@ -43,7 +43,7 @@ const int32_t DEVICE_ID_HALF = 2;
|
||||
const int32_t MAX_AUTH_TIMES = 3;
|
||||
|
||||
DmAuthManager::DmAuthManager(std::shared_ptr<SoftbusConnector> softbusConnector,
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener,
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener,
|
||||
std::shared_ptr<HiChainConnector> hiChainConnector)
|
||||
: softbusConnector_(softbusConnector), hiChainConnector_(hiChainConnector), listener_(listener)
|
||||
{
|
||||
+1
-1
@@ -61,4 +61,4 @@ void ShowConfirm::ShowConfirmDialog(const std::string ¶ms, std::shared_ptr<D
|
||||
#endif
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
+1
-7
@@ -20,13 +20,7 @@
|
||||
#include "dm_log.h"
|
||||
#include "json_config.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
namespace {
|
||||
#ifdef __LP64__
|
||||
const std::string LIB_LOAD_PATH = "/system/lib64/";
|
||||
#else
|
||||
const std::string LIB_LOAD_PATH = "/system/lib/";
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
void from_json(const nlohmann::json &jsonObject, AdapterSoLoadInfo &soLoadInfo)
|
||||
+9
-239
@@ -17,13 +17,6 @@
|
||||
|
||||
#include <securec.h>
|
||||
#include <unistd.h>
|
||||
#if defined(__LITEOS_M__)
|
||||
#include "dm_mutex.h"
|
||||
#include "dm_thread.h"
|
||||
#else
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#endif
|
||||
|
||||
#include "dm_anonymous.h"
|
||||
#include "dm_constants.h"
|
||||
@@ -40,56 +33,14 @@ std::map<std::string, std::shared_ptr<DeviceInfo>> SoftbusConnector::discoveryDe
|
||||
std::map<std::string, std::shared_ptr<ISoftbusStateCallback>> SoftbusConnector::stateCallbackMap_ = {};
|
||||
std::map<std::string, std::shared_ptr<ISoftbusDiscoveryCallback>> SoftbusConnector::discoveryCallbackMap_ = {};
|
||||
|
||||
IPublishCallback SoftbusConnector::softbusPublishCallback_ = {.OnPublishSuccess = SoftbusConnector::OnPublishSuccess,
|
||||
.OnPublishFail = SoftbusConnector::OnPublishFail};
|
||||
|
||||
IDiscoveryCallback SoftbusConnector::softbusDiscoveryCallback_ = {
|
||||
.OnDeviceFound = SoftbusConnector::OnSoftbusDeviceFound,
|
||||
.OnDiscoverFailed = SoftbusConnector::OnSoftbusDiscoveryFailed,
|
||||
.OnDiscoverySuccess = SoftbusConnector::OnSoftbusDiscoverySuccess};
|
||||
|
||||
INodeStateCb SoftbusConnector::softbusNodeStateCb_ = {
|
||||
.events = EVENT_NODE_STATE_ONLINE | EVENT_NODE_STATE_OFFLINE | EVENT_NODE_STATE_INFO_CHANGED,
|
||||
.onNodeOnline = SoftbusConnector::OnSoftBusDeviceOnline,
|
||||
.onNodeOffline = SoftbusConnector::OnSoftbusDeviceOffline,
|
||||
.onNodeBasicInfoChanged = SoftbusConnector::OnSoftbusDeviceInfoChanged};
|
||||
|
||||
void DeviceOnLine(std::map<std::string, std::shared_ptr<ISoftbusStateCallback>> stateCallbackMap,
|
||||
DmDeviceInfo deviceInfo)
|
||||
{
|
||||
LOGI("Device on line start");
|
||||
#if defined(__LITEOS_M__)
|
||||
DmMutex lockDeviceOnLine;
|
||||
#else
|
||||
std::mutex lockDeviceOnLine;
|
||||
std::lock_guard<std::mutex> lock(lockDeviceOnLine);
|
||||
#endif
|
||||
for (auto &iter : stateCallbackMap) {
|
||||
iter.second->OnDeviceOnline(iter.first, deviceInfo);
|
||||
}
|
||||
LOGI("Device on line end");
|
||||
}
|
||||
|
||||
void DeviceOffLine(std::map<std::string, std::shared_ptr<ISoftbusStateCallback>> stateCallbackMap,
|
||||
DmDeviceInfo deviceInfo)
|
||||
{
|
||||
LOGI("Device off line start");
|
||||
#if defined(__LITEOS_M__)
|
||||
DmMutex lockDeviceOffLine;
|
||||
#else
|
||||
std::mutex lockDeviceOffLine;
|
||||
std::lock_guard<std::mutex> lock(lockDeviceOffLine);
|
||||
#endif
|
||||
for (auto &iter : stateCallbackMap) {
|
||||
iter.second->OnDeviceOffline(iter.first, deviceInfo);
|
||||
}
|
||||
LOGI("Device off line end");
|
||||
}
|
||||
|
||||
SoftbusConnector::SoftbusConnector()
|
||||
{
|
||||
softbusSession_ = std::make_shared<SoftbusSession>();
|
||||
Init();
|
||||
}
|
||||
|
||||
SoftbusConnector::~SoftbusConnector()
|
||||
@@ -97,63 +48,6 @@ SoftbusConnector::~SoftbusConnector()
|
||||
LOGI("SoftbusConnector destructor");
|
||||
}
|
||||
|
||||
int32_t SoftbusConnector::Init()
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t retryTimes = 0;
|
||||
do {
|
||||
ret = RegNodeDeviceStateCb(DM_PKG_NAME.c_str(), &softbusNodeStateCb_);
|
||||
if (ret != DM_OK) {
|
||||
++retryTimes;
|
||||
LOGE("RegNodeDeviceStateCb failed with ret %d, retryTimes %d", ret, retryTimes);
|
||||
usleep(SOFTBUS_CHECK_INTERVAL);
|
||||
}
|
||||
} while (ret != DM_OK);
|
||||
|
||||
PublishInfo dmPublishInfo;
|
||||
dmPublishInfo.publishId = DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID;
|
||||
dmPublishInfo.mode = DiscoverMode::DISCOVER_MODE_ACTIVE;
|
||||
dmPublishInfo.medium = ExchangeMedium::AUTO;
|
||||
dmPublishInfo.freq = ExchangeFreq::HIGH;
|
||||
dmPublishInfo.capability = DM_CAPABILITY_OSD;
|
||||
dmPublishInfo.capabilityData = nullptr;
|
||||
dmPublishInfo.dataLen = 0;
|
||||
#if (defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
ret = PublishService(DM_PKG_NAME.c_str(), &dmPublishInfo, &softbusPublishCallback_);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
#else
|
||||
char discoverStatus[DISCOVER_STATUS_LEN + 1] = {0};
|
||||
ret = GetParameter(DISCOVER_STATUS_KEY.c_str(), "not exist", discoverStatus, DISCOVER_STATUS_LEN);
|
||||
if (strcmp(discoverStatus, "not exist") == 0) {
|
||||
ret = SetParameter(DISCOVER_STATUS_KEY.c_str(), DISCOVER_STATUS_ON.c_str());
|
||||
LOGI("service set parameter result is : %d", ret);
|
||||
|
||||
ret = PublishService(DM_PKG_NAME.c_str(), &dmPublishInfo, &softbusPublishCallback_);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service publish result is : %d", ret);
|
||||
} else if (ret >= 0 && strcmp(discoverStatus, DISCOVER_STATUS_ON.c_str()) == 0) {
|
||||
ret = PublishService(DM_PKG_NAME.c_str(), &dmPublishInfo, &softbusPublishCallback_);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service publish result is : %d", ret);
|
||||
} else if (ret >= 0 && strcmp(discoverStatus, DISCOVER_STATUS_OFF.c_str()) == 0) {
|
||||
ret = UnPublishService(DM_PKG_NAME.c_str(), DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = NOT_ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service unpublish result is : %d", ret);
|
||||
}
|
||||
|
||||
ret = WatchParameter(DISCOVER_STATUS_KEY.c_str(), &SoftbusConnector::OnParameterChgCallback, nullptr);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t SoftbusConnector::RegisterSoftbusDiscoveryCallback(const std::string &pkgName,
|
||||
const std::shared_ptr<ISoftbusDiscoveryCallback> callback)
|
||||
{
|
||||
@@ -180,48 +74,6 @@ int32_t SoftbusConnector::UnRegisterSoftbusStateCallback(const std::string &pkgN
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t SoftbusConnector::GetTrustedDeviceList(std::vector<DmDeviceInfo> &deviceInfoList)
|
||||
{
|
||||
LOGI("SoftbusConnector::GetTrustDevices start");
|
||||
int32_t infoNum = 0;
|
||||
NodeBasicInfo *nodeInfo = nullptr;
|
||||
int32_t ret = GetAllNodeDeviceInfo(DM_PKG_NAME.c_str(), &nodeInfo, &infoNum);
|
||||
if (ret != 0) {
|
||||
LOGE("GetAllNodeDeviceInfo failed with ret %d", ret);
|
||||
return ERR_DM_FAILED;
|
||||
}
|
||||
DmDeviceInfo *info = (DmDeviceInfo *)malloc(sizeof(DmDeviceInfo) * (infoNum));
|
||||
if (info == nullptr) {
|
||||
FreeNodeInfo(nodeInfo);
|
||||
return ERR_DM_MALLOC_FAILED;
|
||||
}
|
||||
DmDeviceInfo **pInfoList = &info;
|
||||
for (int32_t i = 0; i < infoNum; ++i) {
|
||||
NodeBasicInfo *nodeBasicInfo = nodeInfo + i;
|
||||
DmDeviceInfo *deviceInfo = *pInfoList + i;
|
||||
CovertNodeBasicInfoToDmDevice(*nodeBasicInfo, *deviceInfo);
|
||||
deviceInfoList.push_back(*deviceInfo);
|
||||
}
|
||||
FreeNodeInfo(nodeInfo);
|
||||
free(info);
|
||||
LOGI("SoftbusConnector::GetTrustDevices success, deviceCount %d", infoNum);
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t SoftbusConnector::GetLocalDeviceInfo(DmDeviceInfo &deviceInfo)
|
||||
{
|
||||
LOGI("SoftbusConnector::GetLocalDeviceInfo start");
|
||||
NodeBasicInfo nodeBasicInfo;
|
||||
int32_t ret = GetLocalNodeDeviceInfo(DM_PKG_NAME.c_str(), &nodeBasicInfo);
|
||||
if (ret != 0) {
|
||||
LOGE("GetLocalNodeDeviceInfo failed with ret %d", ret);
|
||||
return ERR_DM_FAILED;
|
||||
}
|
||||
CovertNodeBasicInfoToDmDevice(nodeBasicInfo, deviceInfo);
|
||||
LOGI("SoftbusConnector::GetLocalDeviceInfo success");
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t SoftbusConnector::StartDiscovery(const DmSubscribeInfo &dmSubscribeInfo)
|
||||
{
|
||||
SubscribeInfo subscribeInfo;
|
||||
@@ -424,27 +276,6 @@ ConnectionAddr *SoftbusConnector::GetConnectAddr(const std::string &deviceId, st
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t SoftbusConnector::CovertNodeBasicInfoToDmDevice(const NodeBasicInfo &nodeBasicInfo, DmDeviceInfo &dmDeviceInfo)
|
||||
{
|
||||
(void)memset_s(&dmDeviceInfo, sizeof(DmDeviceInfo), 0, sizeof(DmDeviceInfo));
|
||||
if (memcpy_s(dmDeviceInfo.deviceId, sizeof(dmDeviceInfo.deviceId), nodeBasicInfo.networkId,
|
||||
std::min(sizeof(dmDeviceInfo.deviceId), sizeof(nodeBasicInfo.networkId))) != DM_OK) {
|
||||
LOGE("CovertNodeBasicInfoToDmDevice copy deviceId data failed");
|
||||
}
|
||||
|
||||
if (memcpy_s(dmDeviceInfo.networkId, sizeof(dmDeviceInfo.networkId), nodeBasicInfo.networkId,
|
||||
std::min(sizeof(dmDeviceInfo.networkId), sizeof(nodeBasicInfo.networkId))) != DM_OK) {
|
||||
LOGE("CovertNodeBasicInfoToDmDevice copy networkId data failed");
|
||||
}
|
||||
|
||||
if (memcpy_s(dmDeviceInfo.deviceName, sizeof(dmDeviceInfo.deviceName), nodeBasicInfo.deviceName,
|
||||
std::min(sizeof(dmDeviceInfo.deviceName), sizeof(nodeBasicInfo.deviceName))) != DM_OK) {
|
||||
LOGE("CovertNodeBasicInfoToDmDevice copy deviceName data failed");
|
||||
}
|
||||
dmDeviceInfo.deviceTypeId = nodeBasicInfo.deviceTypeId;
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
void SoftbusConnector::CovertDeviceInfoToDmDevice(const DeviceInfo &deviceInfo, DmDeviceInfo &dmDeviceInfo)
|
||||
{
|
||||
(void)memset_s(&dmDeviceInfo, sizeof(DmDeviceInfo), 0, sizeof(DmDeviceInfo));
|
||||
@@ -465,41 +296,19 @@ void SoftbusConnector::CovertDeviceInfoToDmDevice(const DeviceInfo &deviceInfo,
|
||||
dmDeviceInfo.deviceTypeId = deviceInfo.devType;
|
||||
}
|
||||
|
||||
void SoftbusConnector::OnPublishSuccess(int publishId)
|
||||
void SoftbusConnector::HandleDeviceOnline(const DmDeviceInfo &info)
|
||||
{
|
||||
LOGI("SoftbusConnector::OnPublishSuccess, publishId: %d", publishId);
|
||||
}
|
||||
|
||||
void SoftbusConnector::OnPublishFail(int publishId, PublishFailReason reason)
|
||||
{
|
||||
LOGI("SoftbusConnector::OnPublishFail failed, publishId: %d, reason: %d", publishId, reason);
|
||||
}
|
||||
|
||||
void SoftbusConnector::OnSoftBusDeviceOnline(NodeBasicInfo *info)
|
||||
{
|
||||
LOGI("device online");
|
||||
if (info == nullptr) {
|
||||
LOGE("SoftbusConnector::OnSoftbusDeviceOffline NodeBasicInfo is nullptr");
|
||||
return;
|
||||
LOGI("HandleDeviceOnline: start handle device online event.");
|
||||
for (auto &iter : stateCallbackMap_) {
|
||||
iter.second->OnDeviceOnline(iter.first, info);
|
||||
}
|
||||
|
||||
DmDeviceInfo dmDeviceInfo;
|
||||
CovertNodeBasicInfoToDmDevice(*info, dmDeviceInfo);
|
||||
#if defined(__LITEOS_M__)
|
||||
DmThread deviceOnLine(DeviceOnLine, stateCallbackMap_, dmDeviceInfo);
|
||||
deviceOnLine.DmCreatThread();
|
||||
#else
|
||||
std::thread deviceOnLine(DeviceOnLine, stateCallbackMap_, dmDeviceInfo);
|
||||
deviceOnLine.detach();
|
||||
#endif
|
||||
|
||||
if (discoveryDeviceInfoMap_.empty()) {
|
||||
return;
|
||||
}
|
||||
// remove the discovery node map
|
||||
uint8_t udid[UDID_BUF_LEN] = {0};
|
||||
int32_t ret =
|
||||
GetNodeKeyInfo(DM_PKG_NAME.c_str(), info->networkId, NodeDeviceInfoKey::NODE_KEY_UDID, udid, sizeof(udid));
|
||||
GetNodeKeyInfo(DM_PKG_NAME.c_str(), info.networkId, NodeDeviceInfoKey::NODE_KEY_UDID, udid, sizeof(udid));
|
||||
if (ret != DM_OK) {
|
||||
LOGE("GetNodeKeyInfo failed");
|
||||
return;
|
||||
@@ -509,26 +318,12 @@ void SoftbusConnector::OnSoftBusDeviceOnline(NodeBasicInfo *info)
|
||||
discoveryDeviceInfoMap_.erase(deviceId);
|
||||
}
|
||||
|
||||
void SoftbusConnector::OnSoftbusDeviceOffline(NodeBasicInfo *info)
|
||||
void SoftbusConnector::HandleDeviceOffline(const DmDeviceInfo &info)
|
||||
{
|
||||
if (info == nullptr) {
|
||||
LOGE("OnSoftbusDeviceOffline NodeBasicInfo is nullptr");
|
||||
return;
|
||||
LOGI("HandleDeviceOffline: start handle device offline event.");
|
||||
for (auto &iter : stateCallbackMap_) {
|
||||
iter.second->OnDeviceOffline(iter.first, info);
|
||||
}
|
||||
DmDeviceInfo dmDeviceInfo;
|
||||
CovertNodeBasicInfoToDmDevice(*info, dmDeviceInfo);
|
||||
#if defined(__LITEOS_M__)
|
||||
DmThread deviceOffLine(DeviceOffLine, stateCallbackMap_, dmDeviceInfo);
|
||||
deviceOffLine.DmCreatThread();
|
||||
#else
|
||||
std::thread deviceOffLine(DeviceOffLine, stateCallbackMap_, dmDeviceInfo);
|
||||
deviceOffLine.detach();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SoftbusConnector::OnSoftbusDeviceInfoChanged(NodeBasicInfoType type, NodeBasicInfo *info)
|
||||
{
|
||||
LOGI("SoftbusConnector::OnSoftbusDeviceInfoChanged.");
|
||||
}
|
||||
|
||||
void SoftbusConnector::OnSoftbusDeviceFound(const DeviceInfo *device)
|
||||
@@ -578,30 +373,5 @@ void SoftbusConnector::OnSoftbusDiscoverySuccess(int subscribeId)
|
||||
iter.second->OnDiscoverySuccess(iter.first, originId);
|
||||
}
|
||||
}
|
||||
|
||||
void SoftbusConnector::OnParameterChgCallback(const char *key, const char *value, void *context)
|
||||
{
|
||||
if (strcmp(value, DISCOVER_STATUS_ON.c_str()) == 0 && publishStatus != ALLOW_BE_DISCOVERY) {
|
||||
PublishInfo dmPublishInfo;
|
||||
dmPublishInfo.publishId = DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID;
|
||||
dmPublishInfo.mode = DiscoverMode::DISCOVER_MODE_ACTIVE;
|
||||
dmPublishInfo.medium = ExchangeMedium::AUTO;
|
||||
dmPublishInfo.freq = ExchangeFreq::HIGH;
|
||||
dmPublishInfo.capability = DM_CAPABILITY_OSD;
|
||||
dmPublishInfo.capabilityData = nullptr;
|
||||
dmPublishInfo.dataLen = 0;
|
||||
int32_t ret = PublishService(DM_PKG_NAME.c_str(), &dmPublishInfo, &softbusPublishCallback_);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service publish result is : %d", ret);
|
||||
} else if (strcmp(value, DISCOVER_STATUS_OFF.c_str()) == 0 && publishStatus != NOT_ALLOW_BE_DISCOVERY) {
|
||||
int32_t ret = UnPublishService(DM_PKG_NAME.c_str(), DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = NOT_ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service unpublish result is : %d", ret);
|
||||
}
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
-12
@@ -28,22 +28,10 @@ std::shared_ptr<ISoftbusSessionCallback> SoftbusSession::sessionCallback_ = null
|
||||
|
||||
SoftbusSession::SoftbusSession()
|
||||
{
|
||||
ISessionListener sessionListener = {.OnSessionOpened = SoftbusSession::OnSessionOpened,
|
||||
.OnSessionClosed = SoftbusSession::OnSessionClosed,
|
||||
.OnBytesReceived = SoftbusSession::OnBytesReceived,
|
||||
.OnMessageReceived = nullptr,
|
||||
.OnStreamReceived = nullptr};
|
||||
int32_t ret = CreateSessionServer(DM_PKG_NAME.c_str(), DM_SESSION_NAME.c_str(), &sessionListener);
|
||||
if (ret != DM_OK) {
|
||||
LOGE("CreateSessionServer failed");
|
||||
} else {
|
||||
LOGI("CreateSessionServer ok");
|
||||
}
|
||||
}
|
||||
|
||||
SoftbusSession::~SoftbusSession()
|
||||
{
|
||||
RemoveSessionServer(DM_PKG_NAME.c_str(), DM_SESSION_NAME.c_str());
|
||||
}
|
||||
|
||||
int32_t SoftbusSession::RegisterSessionCallback(std::shared_ptr<ISoftbusSessionCallback> callback)
|
||||
+69
-134
@@ -13,13 +13,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "device_manager_service.h"
|
||||
#include "device_manager_service_impl.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "device_manager_service_listener.h"
|
||||
#include "dm_constants.h"
|
||||
#include "dm_device_info_manager.h"
|
||||
#include "dm_log.h"
|
||||
#include "multiple_user_connector.h"
|
||||
#include "permission_manager.h"
|
||||
@@ -31,33 +29,19 @@ using namespace OHOS::EventFwk;
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
IMPLEMENT_SINGLE_INSTANCE(DeviceManagerService);
|
||||
|
||||
DeviceManagerService::~DeviceManagerService()
|
||||
DeviceManagerServiceImpl::DeviceManagerServiceImpl()
|
||||
{
|
||||
LOGI("DeviceManagerService destructor");
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DmCommonEventManager &dmCommonEventManager = DmCommonEventManager::GetInstance();
|
||||
if (dmCommonEventManager.UnsubscribeServiceEvent(CommonEventSupport::COMMON_EVENT_USER_STOPPED)) {
|
||||
LOGI("subscribe service event success");
|
||||
}
|
||||
#endif
|
||||
softbusConnector_->GetSoftbusSession()->UnRegisterSessionCallback();
|
||||
hiChainConnector_->UnRegisterHiChainCallback();
|
||||
LOGI("DeviceManagerServiceImpl constructor");
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::Init()
|
||||
DeviceManagerServiceImpl::~DeviceManagerServiceImpl()
|
||||
{
|
||||
if (intFlag_) {
|
||||
LOGE("Init failed, singleton cannot be initialized multiple times");
|
||||
return ERR_DM_INIT_REPEATED;
|
||||
}
|
||||
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
LOGI("DeviceManagerServiceImpl destructor");
|
||||
}
|
||||
|
||||
int32_t DeviceManagerServiceImpl::Initialize(const std::shared_ptr<IDeviceManagerServiceListener> &listener)
|
||||
{
|
||||
LOGI("DeviceManagerServiceImpl Initialize");
|
||||
if (softbusConnector_ == nullptr) {
|
||||
softbusConnector_ = std::make_shared<SoftbusConnector>();
|
||||
if (softbusConnector_ == nullptr) {
|
||||
@@ -65,13 +49,6 @@ int32_t DeviceManagerService::Init()
|
||||
return ERR_DM_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
if (listener_ == nullptr) {
|
||||
listener_ = std::make_shared<DeviceManagerServiceListener>();
|
||||
if (softbusConnector_ == nullptr) {
|
||||
LOGE("Init failed, listener_ apply for failure");
|
||||
return ERR_DM_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
if (hiChainConnector_ == nullptr) {
|
||||
hiChainConnector_ = std::make_shared<HiChainConnector>();
|
||||
if (hiChainConnector_ == nullptr) {
|
||||
@@ -79,15 +56,8 @@ int32_t DeviceManagerService::Init()
|
||||
return ERR_DM_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
if (deviceInfoMgr_ == nullptr) {
|
||||
deviceInfoMgr_ = std::make_shared<DmDeviceInfoManager>(softbusConnector_);
|
||||
if (deviceInfoMgr_ == nullptr) {
|
||||
LOGE("Init failed, deviceInfoMgr_ apply for failure");
|
||||
return ERR_DM_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
if (deviceStateMgr_ == nullptr) {
|
||||
deviceStateMgr_ = std::make_shared<DmDeviceStateManager>(softbusConnector_, listener_, hiChainConnector_);
|
||||
deviceStateMgr_ = std::make_shared<DmDeviceStateManager>(softbusConnector_, listener, hiChainConnector_);
|
||||
if (deviceStateMgr_ == nullptr) {
|
||||
LOGE("Init failed, deviceStateMgr_ apply for failure");
|
||||
return ERR_DM_INIT_FAILED;
|
||||
@@ -95,14 +65,14 @@ int32_t DeviceManagerService::Init()
|
||||
deviceStateMgr_->RegisterSoftbusStateCallback();
|
||||
}
|
||||
if (discoveryMgr_ == nullptr) {
|
||||
discoveryMgr_ = std::make_shared<DmDiscoveryManager>(softbusConnector_, listener_);
|
||||
discoveryMgr_ = std::make_shared<DmDiscoveryManager>(softbusConnector_, listener);
|
||||
if (discoveryMgr_ == nullptr) {
|
||||
LOGE("Init failed, discoveryMgr_ apply for failure");
|
||||
return ERR_DM_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
if (authMgr_ == nullptr) {
|
||||
authMgr_ = std::make_shared<DmAuthManager>(softbusConnector_, listener_, hiChainConnector_);
|
||||
authMgr_ = std::make_shared<DmAuthManager>(softbusConnector_, listener, hiChainConnector_);
|
||||
if (authMgr_ == nullptr) {
|
||||
LOGE("Init failed, authMgr_ apply for failure");
|
||||
return ERR_DM_INIT_FAILED;
|
||||
@@ -125,84 +95,36 @@ int32_t DeviceManagerService::Init()
|
||||
}
|
||||
#endif
|
||||
LOGI("Init success, singleton initialized");
|
||||
intFlag_ = true;
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
|
||||
std::vector<DmDeviceInfo> &deviceList)
|
||||
void DeviceManagerServiceImpl::Release()
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
LOGI("DeviceManagerServiceImpl Release");
|
||||
#if !(defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
DmCommonEventManager &dmCommonEventManager = DmCommonEventManager::GetInstance();
|
||||
if (dmCommonEventManager.UnsubscribeServiceEvent(CommonEventSupport::COMMON_EVENT_USER_STOPPED)) {
|
||||
LOGI("subscribe service event success");
|
||||
}
|
||||
if (!intFlag_) {
|
||||
LOGE("GetTrustedDeviceList failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
if (pkgName.empty()) {
|
||||
LOGE("GetTrustedDeviceList failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
}
|
||||
return deviceInfoMgr_->GetTrustedDeviceList(pkgName, extra, deviceList);
|
||||
#endif
|
||||
softbusConnector_->GetSoftbusSession()->UnRegisterSessionCallback();
|
||||
hiChainConnector_->UnRegisterHiChainCallback();
|
||||
|
||||
authMgr_ = nullptr;
|
||||
deviceStateMgr_ = nullptr;
|
||||
discoveryMgr_ = nullptr;
|
||||
softbusConnector_ = nullptr;
|
||||
abilityMgr_ = nullptr;
|
||||
hiChainConnector_ = nullptr;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetLocalDeviceInfo(DmDeviceInfo &info)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!intFlag_) {
|
||||
LOGE("GetLocalDeviceInfo failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return deviceInfoMgr_->GetLocalDeviceInfo(info);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
|
||||
std::string &udid)
|
||||
{
|
||||
if (!intFlag_) {
|
||||
LOGE("GetLocalDeviceInfo failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
|
||||
if (pkgName.empty()) {
|
||||
LOGE("StartDeviceDiscovery failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
}
|
||||
SoftbusConnector::GetUdidByNetworkId(netWorkId.c_str(), udid);
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
|
||||
std::string &uuid)
|
||||
{
|
||||
if (!intFlag_) {
|
||||
LOGE("GetLocalDeviceInfo failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
|
||||
if (pkgName.empty()) {
|
||||
LOGE("StartDeviceDiscovery failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
}
|
||||
SoftbusConnector::GetUuidByNetworkId(netWorkId.c_str(), uuid);
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
|
||||
int32_t DeviceManagerServiceImpl::StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
|
||||
const std::string &extra)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!intFlag_) {
|
||||
LOGE("StartDeviceDiscovery failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
if (pkgName.empty()) {
|
||||
LOGE("StartDeviceDiscovery failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
@@ -210,16 +132,12 @@ int32_t DeviceManagerService::StartDeviceDiscovery(const std::string &pkgName, c
|
||||
return discoveryMgr_->StartDeviceDiscovery(pkgName, subscribeInfo, extra);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId)
|
||||
int32_t DeviceManagerServiceImpl::StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!intFlag_) {
|
||||
LOGE("StopDeviceDiscovery failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
if (pkgName.empty()) {
|
||||
LOGE("StopDeviceDiscovery failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
@@ -227,17 +145,13 @@ int32_t DeviceManagerService::StopDeviceDiscovery(const std::string &pkgName, ui
|
||||
return discoveryMgr_->StopDeviceDiscovery(pkgName, subscribeId);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::AuthenticateDevice(const std::string &pkgName, int32_t authType,
|
||||
int32_t DeviceManagerServiceImpl::AuthenticateDevice(const std::string &pkgName, int32_t authType,
|
||||
const std::string &deviceId, const std::string &extra)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!intFlag_) {
|
||||
LOGE("AuthenticateDevice failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
if (pkgName.empty()) {
|
||||
LOGE("AuthenticateDevice failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
@@ -249,16 +163,12 @@ int32_t DeviceManagerService::AuthenticateDevice(const std::string &pkgName, int
|
||||
return authMgr_->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId)
|
||||
int32_t DeviceManagerServiceImpl::UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!intFlag_) {
|
||||
LOGE("UnAuthenticateDevice failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
if (pkgName.empty()) {
|
||||
LOGE("UnAuthenticateDevice failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
@@ -270,20 +180,16 @@ int32_t DeviceManagerService::UnAuthenticateDevice(const std::string &pkgName, c
|
||||
return authMgr_->UnAuthenticateDevice(pkgName, deviceId);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::VerifyAuthentication(const std::string &authParam)
|
||||
int32_t DeviceManagerServiceImpl::VerifyAuthentication(const std::string &authParam)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!intFlag_) {
|
||||
LOGE("VerifyAuthentication failed, singleton not init or init fail");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return authMgr_->VerifyAuthentication(authParam);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetFaParam(std::string &pkgName, DmAuthParam &authParam)
|
||||
int32_t DeviceManagerServiceImpl::GetFaParam(std::string &pkgName, DmAuthParam &authParam)
|
||||
{
|
||||
if (pkgName.empty()) {
|
||||
LOGE("GetFaParam failed, pkgName is empty");
|
||||
@@ -295,7 +201,7 @@ int32_t DeviceManagerService::GetFaParam(std::string &pkgName, DmAuthParam &auth
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::SetUserOperation(std::string &pkgName, int32_t action)
|
||||
int32_t DeviceManagerServiceImpl::SetUserOperation(std::string &pkgName, int32_t action)
|
||||
{
|
||||
if (pkgName.empty()) {
|
||||
LOGE("SetUserOperation failed, pkgName is empty");
|
||||
@@ -307,7 +213,7 @@ int32_t DeviceManagerService::SetUserOperation(std::string &pkgName, int32_t act
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::RegisterDevStateCallback(const std::string &pkgName, const std::string &extra)
|
||||
int32_t DeviceManagerServiceImpl::RegisterDevStateCallback(const std::string &pkgName, const std::string &extra)
|
||||
{
|
||||
if (pkgName.empty()) {
|
||||
LOGE("RegisterDevStateCallback failed, pkgName is empty");
|
||||
@@ -319,7 +225,7 @@ int32_t DeviceManagerService::RegisterDevStateCallback(const std::string &pkgNam
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra)
|
||||
int32_t DeviceManagerServiceImpl::UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra)
|
||||
{
|
||||
if (pkgName.empty()) {
|
||||
LOGE("UnRegisterDevStateCallback failed, pkgName is empty");
|
||||
@@ -331,9 +237,38 @@ int32_t DeviceManagerService::UnRegisterDevStateCallback(const std::string &pkgN
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
bool DeviceManagerService::IsServiceInitialized()
|
||||
void DeviceManagerServiceImpl::HandleDeviceOnline(const DmDeviceInfo &info)
|
||||
{
|
||||
return intFlag_;
|
||||
if (softbusConnector_ != nullptr) {
|
||||
softbusConnector_->HandleDeviceOnline(info);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManagerServiceImpl::HandleDeviceOffline(const DmDeviceInfo &info)
|
||||
{
|
||||
if (softbusConnector_ != nullptr) {
|
||||
softbusConnector_->HandleDeviceOffline(info);
|
||||
}
|
||||
}
|
||||
|
||||
int DeviceManagerServiceImpl::OnSessionOpened(int sessionId, int result)
|
||||
{
|
||||
return SoftbusSession::OnSessionOpened(sessionId, result);
|
||||
}
|
||||
|
||||
void DeviceManagerServiceImpl::OnSessionClosed(int sessionId)
|
||||
{
|
||||
SoftbusSession::OnSessionClosed(sessionId);
|
||||
}
|
||||
|
||||
void DeviceManagerServiceImpl::OnBytesReceived(int sessionId, const void *data, unsigned int dataLen)
|
||||
{
|
||||
SoftbusSession::OnBytesReceived(sessionId, data, dataLen);
|
||||
}
|
||||
|
||||
extern "C" IDeviceManagerServiceImpl *CreateDMServiceObject(void)
|
||||
{
|
||||
return new DeviceManagerServiceImpl;
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
Executable → Regular
+1
-1
@@ -24,7 +24,7 @@
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
DmDeviceStateManager::DmDeviceStateManager(std::shared_ptr<SoftbusConnector> softbusConnector,
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener, std::shared_ptr<HiChainConnector> hiChainConnector)
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener, std::shared_ptr<HiChainConnector> hiChainConnector)
|
||||
: softbusConnector_(softbusConnector), listener_(listener), hiChainConnector_(hiChainConnector)
|
||||
{
|
||||
profileSoName_ = "libdevicemanagerext_profile.z.so";
|
||||
+1
-1
@@ -25,7 +25,7 @@ const std::string DISCOVERY_TIMEOUT_TASK = TIMER_PREFIX + "discovery";
|
||||
const int32_t DISCOVERY_TIMEOUT = 120;
|
||||
|
||||
DmDiscoveryManager::DmDiscoveryManager(std::shared_ptr<SoftbusConnector> softbusConnector,
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener)
|
||||
std::shared_ptr<IDeviceManagerServiceListener> listener)
|
||||
: softbusConnector_(softbusConnector), listener_(listener)
|
||||
{
|
||||
LOGI("DmDiscoveryManager constructor");
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "device_manager_service_listener.h"
|
||||
#include "idevice_manager_service_listener.h"
|
||||
|
||||
#include "dm_anonymous.h"
|
||||
#include "dm_constants.h"
|
||||
@@ -0,0 +1,297 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if (defined(ohos_lite)) {
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
} else {
|
||||
import("//build/ohos.gni")
|
||||
}
|
||||
|
||||
import("//foundation/distributedhardware/device_manager/device_manager.gni")
|
||||
|
||||
if (defined(ohos_lite)) {
|
||||
if (ohos_kernel_type == "liteos_m") {
|
||||
static_library("devicemanagerservice_mini") {
|
||||
include_dirs = [
|
||||
"${devicemanager_path}/interfaces/inner_kits/native_cpp/include",
|
||||
"${devicemanager_path}/interfaces/inner_kits/native_cpp/include/notify",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/config",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/authentication/showconfirm/lite",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/commonevent",
|
||||
"${servicesimpl_path}/include/dependency/multipleuser",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/dependency/mini",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/eventbus",
|
||||
"${common_path}/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"//third_party/json/include",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/dfx",
|
||||
"${utils_path}/include/dfx/lite",
|
||||
"${utils_path}/include/permission/lite",
|
||||
"foundation/multimedia/image_standard/mock/native/include",
|
||||
"${servicesimpl_path}/include/dispatch",
|
||||
"${ext_path}/pin_auth/include",
|
||||
"${ext_path}/pin_auth/include/lite",
|
||||
]
|
||||
|
||||
include_dirs += [
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include",
|
||||
"//utils/native/lite/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"//third_party/json/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//foundation/communication/ipc/interfaces/innerkits/c/ipc/include",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/common",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/discovery",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/transport",
|
||||
"//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
|
||||
"//foundation/distributedhardware/device_manager/services/implementation/include/dependency/multipleuser",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"${services_path}/src/ability/lite/dm_ability_manager.cpp",
|
||||
"${services_path}/src/adapter/standard/dm_adapter_manager.cpp",
|
||||
"${services_path}/src/authentication/auth_message_processor.cpp",
|
||||
"${services_path}/src/authentication/auth_request_state.cpp",
|
||||
"${services_path}/src/authentication/auth_response_state.cpp",
|
||||
"${services_path}/src/authentication/dm_auth_manager.cpp",
|
||||
"${services_path}/src/authentication/showconfirm/lite/show_confirm.cpp",
|
||||
"${services_path}/src/config/mini/dm_config_manager.cpp",
|
||||
"${services_path}/src/config/mini/pin_auth.cpp",
|
||||
"${services_path}/src/dependency/hichain/hichain_connector.cpp",
|
||||
"${services_path}/src/dependency/mini/dm_mutex.cpp",
|
||||
"${services_path}/src/dependency/mini/dm_thread.cpp",
|
||||
"${services_path}/src/dependency/multipleuser/multiple_user_connector.cpp",
|
||||
"${services_path}/src/dependency/softbus/softbus_listener.cpp",
|
||||
"${services_path}/src/dependency/softbus/softbus_session.cpp",
|
||||
"${services_path}/src/dependency/timer/mini/dm_timer.cpp",
|
||||
"${services_path}/src/device_manager_service.cpp",
|
||||
"${services_path}/src/deviceinfo/dm_device_info_manager.cpp",
|
||||
"${services_path}/src/devicestate/dm_device_state_manager.cpp",
|
||||
"${services_path}/src/discovery/dm_discovery_manager.cpp",
|
||||
"${services_path}/src/dispatch/command_dispatch.cpp",
|
||||
"${services_path}/src/dispatch/device_manager_service_listener_mini.cpp",
|
||||
"${services_path}/src/dispatch/server_stub.cpp",
|
||||
]
|
||||
|
||||
defines = [
|
||||
"__LITEOS_M__",
|
||||
"HI_LOG_ENABLE",
|
||||
"DH_LOG_TAG=\"devicemanagerservice\"",
|
||||
"LOG_DOMAIN=0xD004100",
|
||||
]
|
||||
|
||||
if (os_account_part_exists) {
|
||||
defines += [ "OS_ACCOUNT_PART_EXISTS" ]
|
||||
include_dirs += [ "//base/account/os_account/interfaces/innerkits/osaccount/native/include" ]
|
||||
}
|
||||
|
||||
ldflags = dm_ldflags
|
||||
|
||||
deps = [
|
||||
"${devicemanager_path}/interfaces/inner_kits/native_cpp:devicemanagersdk_mini",
|
||||
"${utils_path}:devicemanagerutils_mini",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static",
|
||||
"//base/security/device_auth/services:deviceauth",
|
||||
"//base/startup/syspara_lite/frameworks/parameter/src:sysparam",
|
||||
"//foundation/communication/dsoftbus/sdk:softbus_client",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr",
|
||||
"//third_party/bounds_checking_function:libsec_static",
|
||||
"//third_party/mbedtls",
|
||||
"//utils/native/lite:utils",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"hisysevent_native:libhisysevent",
|
||||
"hitrace_native:hitrace_meter",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
executable("devicemanagerservice") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"include/config",
|
||||
"include/adapter",
|
||||
"include/authentication",
|
||||
"include/authentication/showconfirm/lite",
|
||||
"include/ability",
|
||||
"include/devicestate",
|
||||
"include/discovery",
|
||||
"include/dependency/multipleuser/",
|
||||
"include/dependency/hichain",
|
||||
"include/dependency/softbus",
|
||||
"include/dependency/timer",
|
||||
"include",
|
||||
"include/ipc/lite",
|
||||
"include/eventbus",
|
||||
"${common_path}/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/fwkload/lite",
|
||||
"${utils_path}/include/dfx",
|
||||
"${utils_path}/include/dfx/lite",
|
||||
"${utils_path}/include/ipc/lite",
|
||||
"${utils_path}/include/permission/lite",
|
||||
"${innerkits_path}/native_cpp/include",
|
||||
"${innerkits_path}/native_cpp/include/ipc",
|
||||
"${innerkits_path}/native_cpp/include/ipc/lite",
|
||||
]
|
||||
include_dirs += [
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include",
|
||||
"//utils/native/lite/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"//third_party/json/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
"//foundation/communication/ipc/interfaces/innerkits/c/ipc/include",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/common",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/discovery",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/transport",
|
||||
"//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
|
||||
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"src/ability/lite/dm_ability_manager.cpp",
|
||||
"src/adapter/lite/dm_adapter_manager.cpp",
|
||||
"src/authentication/auth_message_processor.cpp",
|
||||
"src/authentication/auth_request_state.cpp",
|
||||
"src/authentication/auth_response_state.cpp",
|
||||
"src/authentication/dm_auth_manager.cpp",
|
||||
"src/authentication/showconfirm/lite/show_confirm.cpp",
|
||||
"src/config/dm_config_manager.cpp",
|
||||
"src/dependency/hichain/hichain_connector.cpp",
|
||||
"src/dependency/multipleuser/multiple_user_connector.cpp",
|
||||
"src/dependency/softbus/softbus_listener.cpp",
|
||||
"src/dependency/softbus/softbus_session.cpp",
|
||||
"src/dependency/timer/dm_timer.cpp",
|
||||
"src/device_manager_service.cpp",
|
||||
"src/device_manager_service_listener.cpp",
|
||||
"src/deviceinfo/dm_device_info_manager.cpp",
|
||||
"src/devicestate/dm_device_state_manager.cpp",
|
||||
"src/discovery/dm_discovery_manager.cpp",
|
||||
"src/ipc/lite/ipc_cmd_parser.cpp",
|
||||
"src/ipc/lite/ipc_server_listener.cpp",
|
||||
"src/ipc/lite/ipc_server_listenermgr.cpp",
|
||||
"src/ipc/lite/ipc_server_main.cpp",
|
||||
"src/ipc/lite/ipc_server_stub.cpp",
|
||||
]
|
||||
ldflags = dm_ldflags
|
||||
|
||||
defines = [
|
||||
"LITE_DEVICE",
|
||||
"HI_LOG_ENABLE",
|
||||
"DH_LOG_TAG=\"devicemanagerservice\"",
|
||||
"LOG_DOMAIN=0xD004100",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${common_path}/include/show_confirm_dialog/dialog_ui/js:dialog_js_files_etc",
|
||||
"${innerkits_path}/native_cpp:devicemanagersdk",
|
||||
"${utils_path}:devicemanagerutils",
|
||||
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
|
||||
"//base/security/device_auth/services:deviceauth_sdk",
|
||||
"//base/startup/syspara_lite/frameworks/parameter/src:sysparam",
|
||||
"//foundation/communication/dsoftbus/sdk:softbus_client",
|
||||
"//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
|
||||
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
|
||||
"//third_party/bounds_checking_function:libsec_shared",
|
||||
"//third_party/mbedtls:mbedtls_shared",
|
||||
"//utils/native/lite:utils",
|
||||
]
|
||||
}
|
||||
}
|
||||
} else if (!support_jsapi) {
|
||||
group("devicemanagerservice") {
|
||||
deps = []
|
||||
}
|
||||
} else {
|
||||
config("devicemanagerservice_config") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"include/softbus",
|
||||
"include/ipc",
|
||||
"include/ipc/standard",
|
||||
"${common_path}/include",
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/fwkload/standard",
|
||||
"${utils_path}/include/dfx",
|
||||
"${utils_path}/include/dfx/standard",
|
||||
"${utils_path}/include/permission/standard",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_shared_library("devicemanagerservice") {
|
||||
sources = [
|
||||
"src/device_manager_service.cpp",
|
||||
"src/device_manager_service_listener.cpp",
|
||||
"src/softbus/softbus_listener.cpp",
|
||||
"src/ipc/standard/ipc_cmd_parser.cpp",
|
||||
"src/ipc/standard/ipc_server_client_proxy.cpp",
|
||||
"src/ipc/standard/ipc_server_listener.cpp",
|
||||
"src/ipc/standard/ipc_server_stub.cpp",
|
||||
]
|
||||
|
||||
public_configs = [ ":devicemanagerservice_config" ]
|
||||
|
||||
defines = [
|
||||
"HI_LOG_ENABLE",
|
||||
"DH_LOG_TAG=\"devicemanagerservice\"",
|
||||
"LOG_DOMAIN=0xD004100",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${aainnerkits_path}/ability_manager:ability_manager",
|
||||
"${aaservices_path}/abilitymgr:abilityms",
|
||||
"${innerkits_path}/native_cpp:devicemanagersdk",
|
||||
"${utils_path}:devicemanagerutils",
|
||||
"//base/security/device_auth/services:deviceauth_sdk",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"dsoftbus:softbus_client",
|
||||
"ipc:ipc_core",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr_standard:samgr_proxy",
|
||||
"startup_l2:syspara",
|
||||
"startup_l2:syspara_watchagent",
|
||||
"utils_base:utils",
|
||||
]
|
||||
|
||||
subsystem_name = "distributedhardware"
|
||||
|
||||
part_name = "device_manager"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_DM_SERVICE_H
|
||||
#define OHOS_DM_SERVICE_H
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#if defined(__LITEOS_M__)
|
||||
#include "dm_mutex.h"
|
||||
#else
|
||||
#include <mutex>
|
||||
#endif
|
||||
|
||||
#include "device_manager_service_listener.h"
|
||||
#include "idevice_manager_service_impl.h"
|
||||
#include "single_instance.h"
|
||||
#include "softbus_listener.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class DeviceManagerService {
|
||||
DECLARE_SINGLE_INSTANCE_BASE(DeviceManagerService);
|
||||
public:
|
||||
DeviceManagerService() {}
|
||||
|
||||
~DeviceManagerService();
|
||||
|
||||
int32_t Init();
|
||||
|
||||
int32_t GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
|
||||
std::vector<DmDeviceInfo> &deviceList);
|
||||
|
||||
int32_t GetLocalDeviceInfo(DmDeviceInfo &info);
|
||||
|
||||
int32_t GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &udid);
|
||||
|
||||
int32_t GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId, std::string &uuid);
|
||||
|
||||
int32_t StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
|
||||
const std::string &extra);
|
||||
|
||||
int32_t StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId);
|
||||
|
||||
int32_t AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId,
|
||||
const std::string &extra);
|
||||
|
||||
int32_t UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId);
|
||||
|
||||
int32_t VerifyAuthentication(const std::string &authParam);
|
||||
|
||||
int32_t GetFaParam(std::string &pkgName, DmAuthParam &authParam);
|
||||
|
||||
int32_t SetUserOperation(std::string &pkgName, int32_t action);
|
||||
|
||||
int32_t RegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
|
||||
|
||||
int32_t UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
|
||||
|
||||
void HandleDeviceOnline(const DmDeviceInfo &info);
|
||||
|
||||
void HandleDeviceOffline(const DmDeviceInfo &info);
|
||||
|
||||
int OnSessionOpened(int sessionId, int result);
|
||||
|
||||
void OnSessionClosed(int sessionId);
|
||||
|
||||
void OnBytesReceived(int sessionId, const void *data, unsigned int dataLen);
|
||||
|
||||
bool IsDMServiceImplReady();
|
||||
|
||||
private:
|
||||
bool isImplsoLoaded_ = false;
|
||||
std::shared_ptr<SoftbusListener> softbusListener_;
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener_;
|
||||
std::shared_ptr<IDeviceManagerServiceImpl> dmServiceImpl_;
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DM_SERVICE_H
|
||||
+6
-38
@@ -20,65 +20,33 @@
|
||||
#include <string>
|
||||
|
||||
#include "dm_device_info.h"
|
||||
#include "idevice_manager_service_listener.h"
|
||||
#if !defined(__LITEOS_M__)
|
||||
#include "ipc_notify_dmfa_result_req.h"
|
||||
#include "ipc_server_listener.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class DeviceManagerServiceListener {
|
||||
class DeviceManagerServiceListener : public IDeviceManagerServiceListener {
|
||||
public:
|
||||
/**
|
||||
* @tc.name: DeviceManagerServiceListener::OnDeviceStateChange
|
||||
* @tc.desc: Device State Change of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
DeviceManagerServiceListener() {};
|
||||
virtual ~DeviceManagerServiceListener() {};
|
||||
|
||||
void OnDeviceStateChange(const std::string &pkgName, const DmDeviceState &state, const DmDeviceInfo &info);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerServiceListener::OnDeviceFound
|
||||
* @tc.desc: Device Found of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
void OnDeviceFound(const std::string &pkgName, uint16_t subscribeId, const DmDeviceInfo &info);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerServiceListener::OnDiscoveryFailed
|
||||
* @tc.desc: Discovery Failed of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
void OnDiscoveryFailed(const std::string &pkgName, uint16_t subscribeId, int32_t failedReason);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerServiceListener::OnDiscoverySuccess
|
||||
* @tc.desc: Discovery Success of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
void OnDiscoverySuccess(const std::string &pkgName, int32_t subscribeId);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerServiceListener::OnAuthResult
|
||||
* @tc.desc: Auth Result of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
void OnAuthResult(const std::string &pkgName, const std::string &deviceId, const std::string &token, int32_t status,
|
||||
int32_t reason);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerServiceListener::OnVerifyAuthResult
|
||||
* @tc.desc: Verify Auth Result of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
void OnVerifyAuthResult(const std::string &pkgName, const std::string &deviceId, int32_t resultCode,
|
||||
const std::string &flag);
|
||||
|
||||
/**
|
||||
* @tc.name: DeviceManagerServiceListener::OnFaCall
|
||||
* @tc.desc: Fa Call of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
void OnFaCall(std::string &pkgName, std::string ¶mJson);
|
||||
|
||||
private:
|
||||
@@ -88,4 +56,4 @@ private:
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DM_SERVICE_LISTENER_H
|
||||
#endif // OHOS_DM_SERVICE_LISTENER_H
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_I_DM_SERVICE_IMPL_H
|
||||
#define OHOS_I_DM_SERVICE_IMPL_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "idevice_manager_service_listener.h"
|
||||
#include "dm_device_info.h"
|
||||
#include "dm_subscribe_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class IDeviceManagerServiceImpl {
|
||||
public:
|
||||
virtual ~IDeviceManagerServiceImpl() {}
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::Initialize
|
||||
* @tc.desc: Initialize the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t Initialize(const std::shared_ptr<IDeviceManagerServiceListener> &listener);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::Release
|
||||
* @tc.desc: Release the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void Release();
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::StartDeviceDiscovery
|
||||
* @tc.desc: Start Device Discovery of the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
|
||||
const std::string &extra);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::StopDeviceDiscovery
|
||||
* @tc.desc: Stop Device Discovery of the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::AuthenticateDevice
|
||||
* @tc.desc: Authenticate Device of the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId,
|
||||
const std::string &extra);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::UnAuthenticateDevice
|
||||
* @tc.desc: UnAuthenticate Device of the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::VerifyAuthentication
|
||||
* @tc.desc: Verify Authentication of the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t VerifyAuthentication(const std::string &authParam);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::GetFaParam
|
||||
* @tc.desc: Get FaParam of the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t GetFaParam(std::string &pkgName, DmAuthParam &authParam);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::SetUserOperation
|
||||
* @tc.desc: Se tUser Operation of device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t SetUserOperation(std::string &pkgName, int32_t action);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::RegisterDevStateCallback
|
||||
* @tc.desc: Register Device State Callback to device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t RegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::UnRegisterDevStateCallback
|
||||
* @tc.desc: UnRegister Device State Callback to device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int32_t UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::HandleDeviceOnline
|
||||
* @tc.desc: Handle Device Online to the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void HandleDeviceOnline(const DmDeviceInfo &info);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::HandleDeviceOffline
|
||||
* @tc.desc: Handle Device Offline to the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void HandleDeviceOffline(const DmDeviceInfo &info);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::OnSessionOpened
|
||||
* @tc.desc: Send Session Opened event to the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual int OnSessionOpened(int sessionId, int result);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::OnSessionClosed
|
||||
* @tc.desc: Send Session Closed event to the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnSessionClosed(int sessionId);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceImpl::OnBytesReceived
|
||||
* @tc.desc: Send Bytes Received event to the device manager service impl
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnBytesReceived(int sessionId, const void *data, unsigned int dataLen);
|
||||
};
|
||||
|
||||
using CreateDMServiceFuncPtr = IDeviceManagerServiceImpl *(*)(void);
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_I_DM_SERVICE_IMPL_H
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_I_DM_SERVICE_LISTENER_H
|
||||
#define OHOS_I_DM_SERVICE_LISTENER_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "dm_device_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class IDeviceManagerServiceListener {
|
||||
public:
|
||||
virtual ~IDeviceManagerServiceListener() {}
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceListener::OnDeviceStateChange
|
||||
* @tc.desc: Device State Change of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnDeviceStateChange(const std::string &pkgName, const DmDeviceState &state, const DmDeviceInfo &info);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceListener::OnDeviceFound
|
||||
* @tc.desc: Device Found of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnDeviceFound(const std::string &pkgName, uint16_t subscribeId, const DmDeviceInfo &info);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceListener::OnDiscoveryFailed
|
||||
* @tc.desc: Discovery Failed of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnDiscoveryFailed(const std::string &pkgName, uint16_t subscribeId, int32_t failedReason);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceListener::OnDiscoverySuccess
|
||||
* @tc.desc: Discovery Success of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnDiscoverySuccess(const std::string &pkgName, int32_t subscribeId);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceListener::OnAuthResult
|
||||
* @tc.desc: Auth Result of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnAuthResult(const std::string &pkgName, const std::string &deviceId, const std::string &token, int32_t status,
|
||||
int32_t reason);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceListener::OnVerifyAuthResult
|
||||
* @tc.desc: Verify Auth Result of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnVerifyAuthResult(const std::string &pkgName, const std::string &deviceId, int32_t resultCode,
|
||||
const std::string &flag);
|
||||
|
||||
/**
|
||||
* @tc.name: IDeviceManagerServiceListener::OnFaCall
|
||||
* @tc.desc: Fa Call of the DeviceManager Service Listener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
virtual void OnFaCall(std::string &pkgName, std::string ¶mJson);
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_I_DM_SERVICE_LISTENER_H
|
||||
-1
@@ -22,7 +22,6 @@
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "hichain_connector.h"
|
||||
#include "ipc_remote_broker.h"
|
||||
#include "iremote_stub.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_DM_SOFTBUS_LISTENER_H
|
||||
#define OHOS_DM_SOFTBUS_LISTENER_H
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "discovery_service.h"
|
||||
#include "dm_device_info.h"
|
||||
#include "dm_subscribe_info.h"
|
||||
#include "inner_session.h"
|
||||
#include "session.h"
|
||||
#include "softbus_bus_center.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
void DeviceOnLine(DmDeviceInfo deviceInfo);
|
||||
void DeviceOffLine(DmDeviceInfo deviceInfo);
|
||||
class SoftbusListener {
|
||||
public:
|
||||
static int OnSessionOpened(int sessionId, int result);
|
||||
static void OnSessionClosed(int sessionId);
|
||||
static void OnBytesReceived(int sessionId, const void *data, unsigned int dataLen);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @tc.name: SoftbusListener::OnPublishSuccess
|
||||
* @tc.desc: OnPublishSuccess of the SoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnPublishSuccess(int publishId);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusListener::OnPublishFail
|
||||
* @tc.desc: OnPublishFail of the SoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnPublishFail(int publishId, PublishFailReason reason);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusListener::OnSoftBusDeviceOnline
|
||||
* @tc.desc: OnSoftBus DeviceOnline of the SoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnSoftBusDeviceOnline(NodeBasicInfo *info);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusListener::OnSoftbusDeviceOffline
|
||||
* @tc.desc: OnSoftbus DeviceOffline of the SoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnSoftbusDeviceOffline(NodeBasicInfo *info);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusListener::OnSoftbusDeviceInfoChanged
|
||||
* @tc.desc: OnSoftbus DeviceInfoChanged of the SoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnSoftbusDeviceInfoChanged(NodeBasicInfoType type, NodeBasicInfo *info);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusListener::OnPublishSuccess
|
||||
* @tc.desc: OnParameter Chg Callback of the SoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static void OnParameterChgCallback(const char *key, const char *value, void *context);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusListener::GetUdidByNetworkId
|
||||
* @tc.desc: Get Udid By NetworkId of the SoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static int32_t GetUdidByNetworkId(const char *networkId, std::string &udid);
|
||||
|
||||
/**
|
||||
* @tc.name: SoftbusListener::GetUuidByNetworkId
|
||||
* @tc.desc: Get Uuid By NetworkId of the SoftbusListener
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
static int32_t GetUuidByNetworkId(const char *networkId, std::string &uuid);
|
||||
|
||||
public:
|
||||
SoftbusListener();
|
||||
~SoftbusListener();
|
||||
int32_t GetTrustedDeviceList(std::vector<DmDeviceInfo> &deviceInfoList);
|
||||
int32_t GetLocalDeviceInfo(DmDeviceInfo &deviceInfo);
|
||||
|
||||
private:
|
||||
int32_t Init();
|
||||
static int32_t CovertNodeBasicInfoToDmDevice(const NodeBasicInfo &nodeBasicInfo, DmDeviceInfo &dmDeviceInfo);
|
||||
|
||||
private:
|
||||
enum PulishStatus {
|
||||
STATUS_UNKNOWN = 0,
|
||||
ALLOW_BE_DISCOVERY = 1,
|
||||
NOT_ALLOW_BE_DISCOVERY = 2,
|
||||
};
|
||||
static PulishStatus publishStatus;
|
||||
static INodeStateCb softbusNodeStateCb_;
|
||||
static IPublishCallback softbusPublishCallback_;
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DM_SOFTBUS_LISTENER_H
|
||||
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "device_manager_service.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <functional>
|
||||
|
||||
#include "dm_constants.h"
|
||||
#include "dm_log.h"
|
||||
#include "permission_manager.h"
|
||||
#include "dm_distributed_hardware_load.h"
|
||||
|
||||
const std::string LIB_IMPL_NAME = "libdevicemanagerserviceimpl.z.so";
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
IMPLEMENT_SINGLE_INSTANCE(DeviceManagerService);
|
||||
|
||||
DeviceManagerService::~DeviceManagerService()
|
||||
{
|
||||
LOGI("DeviceManagerService destructor");
|
||||
if (dmServiceImpl_ != nullptr) {
|
||||
dmServiceImpl_->Release();
|
||||
}
|
||||
std::string soPathName = LIB_LOAD_PATH + LIB_IMPL_NAME;
|
||||
void *so_handle = dlopen(soPathName.c_str(), RTLD_NOW | RTLD_NOLOAD);
|
||||
if (so_handle != nullptr) {
|
||||
dlclose(so_handle);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::Init()
|
||||
{
|
||||
if (softbusListener_ == nullptr) {
|
||||
softbusListener_ = std::make_shared<SoftbusListener>();
|
||||
}
|
||||
|
||||
if (listener_ == nullptr) {
|
||||
listener_ = std::make_shared<DeviceManagerServiceListener>();
|
||||
}
|
||||
|
||||
LOGI("Init success, dm service single instance initialized.");
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetTrustedDeviceList(const std::string &pkgName, const std::string &extra,
|
||||
std::vector<DmDeviceInfo> &deviceList)
|
||||
{
|
||||
if (pkgName.empty()) {
|
||||
LOGE("GetTrustedDeviceList failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
}
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
int32_t ret = softbusListener_->GetTrustedDeviceList(deviceList);
|
||||
if (ret != DM_OK) {
|
||||
LOGE("GetTrustedDeviceList failed");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetLocalDeviceInfo(DmDeviceInfo &info)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
int32_t ret = softbusListener_->GetLocalDeviceInfo(info);
|
||||
if (ret != DM_OK) {
|
||||
LOGE("GetLocalDeviceInfo failed");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
|
||||
std::string &udid)
|
||||
{
|
||||
if (pkgName.empty()) {
|
||||
LOGE("StartDeviceDiscovery failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
}
|
||||
SoftbusListener::GetUdidByNetworkId(netWorkId.c_str(), udid);
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId,
|
||||
std::string &uuid)
|
||||
{
|
||||
if (pkgName.empty()) {
|
||||
LOGE("StartDeviceDiscovery failed, pkgName is empty");
|
||||
return ERR_DM_INPUT_PARAMETER_EMPTY;
|
||||
}
|
||||
SoftbusListener::GetUuidByNetworkId(netWorkId.c_str(), uuid);
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo,
|
||||
const std::string &extra)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call.");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("StartDeviceDiscovery failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->StartDeviceDiscovery(pkgName, subscribeInfo, extra);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("StopDeviceDiscovery failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->StopDeviceDiscovery(pkgName, subscribeId);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::AuthenticateDevice(const std::string &pkgName, int32_t authType,
|
||||
const std::string &deviceId, const std::string &extra)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("AuthenticateDevice failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("UnAuthenticateDevice failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->UnAuthenticateDevice(pkgName, deviceId);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::VerifyAuthentication(const std::string &authParam)
|
||||
{
|
||||
if (!PermissionManager::GetInstance().CheckPermission()) {
|
||||
LOGI("The caller does not have permission to call");
|
||||
return ERR_DM_NO_PERMISSION;
|
||||
}
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("VerifyAuthentication failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->VerifyAuthentication(authParam);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::GetFaParam(std::string &pkgName, DmAuthParam &authParam)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("GetFaParam failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->GetFaParam(pkgName, authParam);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::SetUserOperation(std::string &pkgName, int32_t action)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("SetUserOperation failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->SetUserOperation(pkgName, action);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::RegisterDevStateCallback(const std::string &pkgName, const std::string &extra)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("RegisterDevStateCallback failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->RegisterDevStateCallback(pkgName, extra);
|
||||
}
|
||||
|
||||
int32_t DeviceManagerService::UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("UnRegisterDevStateCallback failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->UnRegisterDevStateCallback(pkgName, extra);
|
||||
}
|
||||
|
||||
void DeviceManagerService::HandleDeviceOnline(const DmDeviceInfo &info)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("HandleDeviceOnline failed, instance not init or init failed.");
|
||||
return;
|
||||
}
|
||||
dmServiceImpl_->HandleDeviceOnline(info);
|
||||
}
|
||||
|
||||
void DeviceManagerService::HandleDeviceOffline(const DmDeviceInfo &info)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("HandleDeviceOffline failed, instance not init or init failed.");
|
||||
return;
|
||||
}
|
||||
dmServiceImpl_->HandleDeviceOffline(info);
|
||||
}
|
||||
|
||||
int DeviceManagerService::OnSessionOpened(int sessionId, int result)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("OnSessionOpened failed, instance not init or init failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
return dmServiceImpl_->OnSessionOpened(sessionId, result);
|
||||
}
|
||||
|
||||
void DeviceManagerService::OnSessionClosed(int sessionId)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("OnSessionClosed failed, instance not init or init failed.");
|
||||
return;
|
||||
}
|
||||
dmServiceImpl_->OnSessionClosed(sessionId);
|
||||
}
|
||||
|
||||
void DeviceManagerService::OnBytesReceived(int sessionId, const void *data, unsigned int dataLen)
|
||||
{
|
||||
if (!IsDMServiceImplReady()) {
|
||||
LOGE("OnBytesReceived failed, instance not init or init failed.");
|
||||
return;
|
||||
}
|
||||
dmServiceImpl_->OnBytesReceived(sessionId, data, dataLen);
|
||||
}
|
||||
|
||||
bool DeviceManagerService::IsDMServiceImplReady()
|
||||
{
|
||||
if (isImplsoLoaded_ && (dmServiceImpl_ != nullptr)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string soName = LIB_LOAD_PATH + LIB_IMPL_NAME;
|
||||
void *so_handle = dlopen(soName.c_str(), RTLD_NOW | RTLD_NOLOAD);
|
||||
if (so_handle == nullptr) {
|
||||
so_handle = dlopen(soName.c_str(), RTLD_NOW);
|
||||
if (so_handle == nullptr) {
|
||||
LOGE("load profile so %s failed.", soName.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
dlerror();
|
||||
auto func = (CreateDMServiceFuncPtr)dlsym(so_handle, "CreateDMServiceObject");
|
||||
if (dlerror() != nullptr || func == nullptr) {
|
||||
LOGE("Create object function is not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
dmServiceImpl_ = std::shared_ptr<IDeviceManagerServiceImpl>(func());
|
||||
if (dmServiceImpl_->Initialize(listener_) != DM_OK) {
|
||||
dlclose(so_handle);
|
||||
dmServiceImpl_ = nullptr;
|
||||
isImplsoLoaded_ = false;
|
||||
return false;
|
||||
}
|
||||
isImplsoLoaded_ = true;
|
||||
return true;
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
+1
-1
@@ -441,7 +441,7 @@ ON_IPC_CMD(SERVER_GET_DMFA_INFO, MessageParcel &data, MessageParcel &reply)
|
||||
std::string packName = data.ReadString();
|
||||
DmAuthParam authParam;
|
||||
if (DeviceManagerService::GetInstance().GetFaParam(packName, authParam) != DM_OK) {
|
||||
LOGE("ipc read fa param failed");
|
||||
LOGE("ipc read fa parm failed");
|
||||
return ERR_DM_IPC_READ_FAILED;
|
||||
}
|
||||
int32_t appIconLen = authParam.imageinfo.GetAppIconLen();
|
||||
+6
-15
@@ -126,11 +126,6 @@ int32_t IpcServerStub::RegisterDeviceManagerListener(std::string &pkgName, sptr<
|
||||
return ERR_DM_POINT_NULL;
|
||||
}
|
||||
|
||||
if (!DeviceManagerService::GetInstance().IsServiceInitialized()) {
|
||||
LOGE("Device manager service has not been initialized or initialized failed.");
|
||||
return ERR_DM_NOT_INIT;
|
||||
}
|
||||
|
||||
LOGI("Register device manager listener for package name: %s", pkgName.c_str());
|
||||
std::lock_guard<std::mutex> autoLock(listenerLock_);
|
||||
auto iter = dmListener_.find(pkgName);
|
||||
@@ -138,17 +133,13 @@ int32_t IpcServerStub::RegisterDeviceManagerListener(std::string &pkgName, sptr<
|
||||
LOGI("RegisterDeviceManagerListener: listener already exists");
|
||||
return DM_OK;
|
||||
}
|
||||
try {
|
||||
sptr<AppDeathRecipient> appRecipient = sptr<AppDeathRecipient>(new AppDeathRecipient());
|
||||
if (!listener->AddDeathRecipient(appRecipient)) {
|
||||
LOGE("RegisterDeviceManagerListener: AddDeathRecipient Failed");
|
||||
}
|
||||
dmListener_[pkgName] = listener;
|
||||
appRecipient_[pkgName] = appRecipient;
|
||||
} catch (const std::bad_alloc &e) {
|
||||
LOGE("new AppDeathRecipient failed");
|
||||
return ERR_DM_MALLOC_FAILED;
|
||||
|
||||
sptr<AppDeathRecipient> appRecipient = sptr<AppDeathRecipient>(new AppDeathRecipient());
|
||||
if (!listener->AddDeathRecipient(appRecipient)) {
|
||||
LOGE("RegisterDeviceManagerListener: AddDeathRecipient Failed");
|
||||
}
|
||||
dmListener_[pkgName] = listener;
|
||||
appRecipient_[pkgName] = appRecipient;
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "softbus_listener.h"
|
||||
|
||||
#include <securec.h>
|
||||
#include <unistd.h>
|
||||
#if defined(__LITEOS_M__)
|
||||
#include "dm_mutex.h"
|
||||
#include "dm_thread.h"
|
||||
#else
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#endif
|
||||
|
||||
#include "device_manager_service.h"
|
||||
#include "dm_anonymous.h"
|
||||
#include "dm_constants.h"
|
||||
#include "dm_device_info.h"
|
||||
#include "dm_log.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "parameter.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
SoftbusListener::PulishStatus SoftbusListener::publishStatus = SoftbusListener::STATUS_UNKNOWN;
|
||||
IPublishCallback SoftbusListener::softbusPublishCallback_ = {.OnPublishSuccess = SoftbusListener::OnPublishSuccess,
|
||||
.OnPublishFail = SoftbusListener::OnPublishFail};
|
||||
|
||||
INodeStateCb SoftbusListener::softbusNodeStateCb_ = {
|
||||
.events = EVENT_NODE_STATE_ONLINE | EVENT_NODE_STATE_OFFLINE | EVENT_NODE_STATE_INFO_CHANGED,
|
||||
.onNodeOnline = SoftbusListener::OnSoftBusDeviceOnline,
|
||||
.onNodeOffline = SoftbusListener::OnSoftbusDeviceOffline,
|
||||
.onNodeBasicInfoChanged = SoftbusListener::OnSoftbusDeviceInfoChanged};
|
||||
|
||||
void DeviceOnLine(DmDeviceInfo deviceInfo)
|
||||
{
|
||||
#if defined(__LITEOS_M__)
|
||||
DmMutex lockDeviceOnLine;
|
||||
#else
|
||||
std::mutex lockDeviceOnLine;
|
||||
std::lock_guard<std::mutex> lock(lockDeviceOnLine);
|
||||
#endif
|
||||
DeviceManagerService::GetInstance().HandleDeviceOnline(deviceInfo);
|
||||
}
|
||||
|
||||
void DeviceOffLine(DmDeviceInfo deviceInfo)
|
||||
{
|
||||
#if defined(__LITEOS_M__)
|
||||
DmMutex lockDeviceOffLine;
|
||||
#else
|
||||
std::mutex lockDeviceOffLine;
|
||||
std::lock_guard<std::mutex> lock(lockDeviceOffLine);
|
||||
#endif
|
||||
DeviceManagerService::GetInstance().HandleDeviceOffline(deviceInfo);
|
||||
}
|
||||
|
||||
SoftbusListener::SoftbusListener()
|
||||
{
|
||||
ISessionListener sessionListener = {.OnSessionOpened = SoftbusListener::OnSessionOpened,
|
||||
.OnSessionClosed = SoftbusListener::OnSessionClosed,
|
||||
.OnBytesReceived = SoftbusListener::OnBytesReceived,
|
||||
.OnMessageReceived = nullptr,
|
||||
.OnStreamReceived = nullptr};
|
||||
int32_t ret = CreateSessionServer(DM_PKG_NAME.c_str(), DM_SESSION_NAME.c_str(), &sessionListener);
|
||||
if (ret != DM_OK) {
|
||||
LOGE("CreateSessionServer failed");
|
||||
} else {
|
||||
LOGI("CreateSessionServer ok");
|
||||
}
|
||||
Init();
|
||||
}
|
||||
|
||||
SoftbusListener::~SoftbusListener()
|
||||
{
|
||||
RemoveSessionServer(DM_PKG_NAME.c_str(), DM_SESSION_NAME.c_str());
|
||||
LOGI("SoftbusListener destructor");
|
||||
}
|
||||
|
||||
int32_t SoftbusListener::Init()
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t retryTimes = 0;
|
||||
do {
|
||||
ret = RegNodeDeviceStateCb(DM_PKG_NAME.c_str(), &softbusNodeStateCb_);
|
||||
if (ret != DM_OK) {
|
||||
++retryTimes;
|
||||
LOGE("RegNodeDeviceStateCb failed with ret %d, retryTimes %d", ret, retryTimes);
|
||||
usleep(SOFTBUS_CHECK_INTERVAL);
|
||||
}
|
||||
} while (ret != DM_OK);
|
||||
|
||||
PublishInfo dmPublishInfo;
|
||||
dmPublishInfo.publishId = DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID;
|
||||
dmPublishInfo.mode = DiscoverMode::DISCOVER_MODE_ACTIVE;
|
||||
dmPublishInfo.medium = ExchangeMedium::AUTO;
|
||||
dmPublishInfo.freq = ExchangeFreq::HIGH;
|
||||
dmPublishInfo.capability = DM_CAPABILITY_OSD;
|
||||
dmPublishInfo.capabilityData = nullptr;
|
||||
dmPublishInfo.dataLen = 0;
|
||||
#if (defined(__LITEOS_M__) || defined(LITE_DEVICE))
|
||||
ret = PublishService(DM_PKG_NAME.c_str(), &dmPublishInfo, &softbusPublishCallback_);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
#else
|
||||
char discoverStatus[DISCOVER_STATUS_LEN + 1] = {0};
|
||||
ret = GetParameter(DISCOVER_STATUS_KEY.c_str(), "not exist", discoverStatus, DISCOVER_STATUS_LEN);
|
||||
if (strcmp(discoverStatus, "not exist") == 0) {
|
||||
ret = SetParameter(DISCOVER_STATUS_KEY.c_str(), DISCOVER_STATUS_ON.c_str());
|
||||
LOGI("service set parameter result is : %d", ret);
|
||||
|
||||
ret = PublishService(DM_PKG_NAME.c_str(), &dmPublishInfo, &softbusPublishCallback_);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service publish result is : %d", ret);
|
||||
} else if (ret >= 0 && strcmp(discoverStatus, DISCOVER_STATUS_ON.c_str()) == 0) {
|
||||
ret = PublishService(DM_PKG_NAME.c_str(), &dmPublishInfo, &softbusPublishCallback_);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service publish result is : %d", ret);
|
||||
} else if (ret >= 0 && strcmp(discoverStatus, DISCOVER_STATUS_OFF.c_str()) == 0) {
|
||||
ret = UnPublishService(DM_PKG_NAME.c_str(), DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = NOT_ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service unpublish result is : %d", ret);
|
||||
}
|
||||
|
||||
ret = WatchParameter(DISCOVER_STATUS_KEY.c_str(), &SoftbusListener::OnParameterChgCallback, nullptr);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t SoftbusListener::GetTrustedDeviceList(std::vector<DmDeviceInfo> &deviceInfoList)
|
||||
{
|
||||
LOGI("SoftbusListener::GetTrustDevices start");
|
||||
int32_t infoNum = 0;
|
||||
NodeBasicInfo *nodeInfo = nullptr;
|
||||
int32_t ret = GetAllNodeDeviceInfo(DM_PKG_NAME.c_str(), &nodeInfo, &infoNum);
|
||||
if (ret != 0) {
|
||||
LOGE("GetAllNodeDeviceInfo failed with ret %d", ret);
|
||||
return ERR_DM_FAILED;
|
||||
}
|
||||
DmDeviceInfo *info = (DmDeviceInfo *)malloc(sizeof(DmDeviceInfo) * (infoNum));
|
||||
if (info == nullptr) {
|
||||
FreeNodeInfo(nodeInfo);
|
||||
return ERR_DM_MALLOC_FAILED;
|
||||
}
|
||||
DmDeviceInfo **pInfoList = &info;
|
||||
for (int32_t i = 0; i < infoNum; ++i) {
|
||||
NodeBasicInfo *nodeBasicInfo = nodeInfo + i;
|
||||
DmDeviceInfo *deviceInfo = *pInfoList + i;
|
||||
CovertNodeBasicInfoToDmDevice(*nodeBasicInfo, *deviceInfo);
|
||||
deviceInfoList.push_back(*deviceInfo);
|
||||
}
|
||||
FreeNodeInfo(nodeInfo);
|
||||
free(info);
|
||||
LOGI("SoftbusListener::GetTrustDevices success, deviceCount %d", infoNum);
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t SoftbusListener::GetLocalDeviceInfo(DmDeviceInfo &deviceInfo)
|
||||
{
|
||||
LOGI("SoftbusListener::GetLocalDeviceInfo start");
|
||||
NodeBasicInfo nodeBasicInfo;
|
||||
int32_t ret = GetLocalNodeDeviceInfo(DM_PKG_NAME.c_str(), &nodeBasicInfo);
|
||||
if (ret != 0) {
|
||||
LOGE("GetLocalNodeDeviceInfo failed with ret %d", ret);
|
||||
return ERR_DM_FAILED;
|
||||
}
|
||||
CovertNodeBasicInfoToDmDevice(nodeBasicInfo, deviceInfo);
|
||||
LOGI("SoftbusListener::GetLocalDeviceInfo success");
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t SoftbusListener::GetUdidByNetworkId(const char *networkId, std::string &udid)
|
||||
{
|
||||
LOGI("GetUdidByNetworkId begin");
|
||||
uint8_t mUdid[UDID_BUF_LEN] = {0};
|
||||
int32_t ret =
|
||||
GetNodeKeyInfo(DM_PKG_NAME.c_str(), networkId, NodeDeviceInfoKey::NODE_KEY_UDID, mUdid, sizeof(mUdid));
|
||||
if (ret != DM_OK) {
|
||||
LOGE("GetUdidByNetworkId GetNodeKeyInfo failed");
|
||||
return ERR_DM_FAILED;
|
||||
}
|
||||
udid = (char *)mUdid;
|
||||
LOGI("SoftbusListener::GetUdidByNetworkId completed");
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
int32_t SoftbusListener::GetUuidByNetworkId(const char *networkId, std::string &uuid)
|
||||
{
|
||||
LOGI("GetUuidByNetworkId begin");
|
||||
uint8_t mUuid[UUID_BUF_LEN] = {0};
|
||||
int32_t ret =
|
||||
GetNodeKeyInfo(DM_PKG_NAME.c_str(), networkId, NodeDeviceInfoKey::NODE_KEY_UUID, mUuid, sizeof(mUuid));
|
||||
if (ret != DM_OK) {
|
||||
LOGE("GetUuidByNetworkId GetNodeKeyInfo failed");
|
||||
return ERR_DM_FAILED;
|
||||
}
|
||||
uuid = (char *)mUuid;
|
||||
LOGI("SoftbusListener::GetUuidByNetworkId completed");
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
void SoftbusListener::OnSoftBusDeviceOnline(NodeBasicInfo *info)
|
||||
{
|
||||
LOGI("OnSoftBusDeviceOnline: received device online callback from softbus.");
|
||||
if (info == nullptr) {
|
||||
LOGE("SoftbusListener::OnSoftbusDeviceOffline NodeBasicInfo is nullptr");
|
||||
return;
|
||||
}
|
||||
DmDeviceInfo dmDeviceInfo;
|
||||
CovertNodeBasicInfoToDmDevice(*info, dmDeviceInfo);
|
||||
#if defined(__LITEOS_M__)
|
||||
DmThread deviceOnLine(DeviceOnLine, dmDeviceInfo);
|
||||
deviceOnLine.DmCreatThread();
|
||||
#else
|
||||
std::thread deviceOnLine(DeviceOnLine, dmDeviceInfo);
|
||||
deviceOnLine.detach();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SoftbusListener::OnSoftbusDeviceOffline(NodeBasicInfo *info)
|
||||
{
|
||||
LOGI("OnSoftBusDeviceOnline: received device offline callback from softbus.");
|
||||
if (info == nullptr) {
|
||||
LOGE("OnSoftbusDeviceOffline NodeBasicInfo is nullptr");
|
||||
return;
|
||||
}
|
||||
DmDeviceInfo dmDeviceInfo;
|
||||
CovertNodeBasicInfoToDmDevice(*info, dmDeviceInfo);
|
||||
#if defined(__LITEOS_M__)
|
||||
DmThread deviceOffLine(DeviceOffLine, dmDeviceInfo);
|
||||
deviceOffLine.DmCreatThread();
|
||||
#else
|
||||
std::thread deviceOffLine(DeviceOffLine, dmDeviceInfo);
|
||||
deviceOffLine.detach();
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t SoftbusListener::CovertNodeBasicInfoToDmDevice(const NodeBasicInfo &nodeBasicInfo, DmDeviceInfo &dmDeviceInfo)
|
||||
{
|
||||
(void)memset_s(&dmDeviceInfo, sizeof(DmDeviceInfo), 0, sizeof(DmDeviceInfo));
|
||||
if (memcpy_s(dmDeviceInfo.deviceId, sizeof(dmDeviceInfo.deviceId), nodeBasicInfo.networkId,
|
||||
std::min(sizeof(dmDeviceInfo.deviceId), sizeof(nodeBasicInfo.networkId))) != DM_OK) {
|
||||
LOGE("CovertNodeBasicInfoToDmDevice copy deviceId data failed");
|
||||
}
|
||||
|
||||
if (memcpy_s(dmDeviceInfo.networkId, sizeof(dmDeviceInfo.networkId), nodeBasicInfo.networkId,
|
||||
std::min(sizeof(dmDeviceInfo.networkId), sizeof(nodeBasicInfo.networkId))) != DM_OK) {
|
||||
LOGE("CovertNodeBasicInfoToDmDevice copy networkId data failed");
|
||||
}
|
||||
|
||||
if (memcpy_s(dmDeviceInfo.deviceName, sizeof(dmDeviceInfo.deviceName), nodeBasicInfo.deviceName,
|
||||
std::min(sizeof(dmDeviceInfo.deviceName), sizeof(nodeBasicInfo.deviceName))) != DM_OK) {
|
||||
LOGE("CovertNodeBasicInfoToDmDevice copy deviceName data failed");
|
||||
}
|
||||
dmDeviceInfo.deviceTypeId = nodeBasicInfo.deviceTypeId;
|
||||
return DM_OK;
|
||||
}
|
||||
|
||||
void SoftbusListener::OnParameterChgCallback(const char *key, const char *value, void *context)
|
||||
{
|
||||
if (strcmp(value, DISCOVER_STATUS_ON.c_str()) == 0 && publishStatus != ALLOW_BE_DISCOVERY) {
|
||||
PublishInfo dmPublishInfo;
|
||||
dmPublishInfo.publishId = DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID;
|
||||
dmPublishInfo.mode = DiscoverMode::DISCOVER_MODE_ACTIVE;
|
||||
dmPublishInfo.medium = ExchangeMedium::AUTO;
|
||||
dmPublishInfo.freq = ExchangeFreq::HIGH;
|
||||
dmPublishInfo.capability = DM_CAPABILITY_OSD;
|
||||
dmPublishInfo.capabilityData = nullptr;
|
||||
dmPublishInfo.dataLen = 0;
|
||||
int32_t ret = PublishService(DM_PKG_NAME.c_str(), &dmPublishInfo, &softbusPublishCallback_);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service publish result is : %d", ret);
|
||||
} else if (strcmp(value, DISCOVER_STATUS_OFF.c_str()) == 0 && publishStatus != NOT_ALLOW_BE_DISCOVERY) {
|
||||
int32_t ret = UnPublishService(DM_PKG_NAME.c_str(), DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID);
|
||||
if (ret == DM_OK) {
|
||||
publishStatus = NOT_ALLOW_BE_DISCOVERY;
|
||||
}
|
||||
LOGI("service unpublish result is : %d", ret);
|
||||
}
|
||||
}
|
||||
|
||||
int SoftbusListener::OnSessionOpened(int sessionId, int result)
|
||||
{
|
||||
return DeviceManagerService::GetInstance().OnSessionOpened(sessionId, result);
|
||||
}
|
||||
|
||||
void SoftbusListener::OnSessionClosed(int sessionId)
|
||||
{
|
||||
DeviceManagerService::GetInstance().OnSessionClosed(sessionId);
|
||||
}
|
||||
|
||||
void SoftbusListener::OnBytesReceived(int sessionId, const void *data, unsigned int dataLen)
|
||||
{
|
||||
DeviceManagerService::GetInstance().OnBytesReceived(sessionId, data, dataLen);
|
||||
}
|
||||
|
||||
void SoftbusListener::OnPublishSuccess(int publishId)
|
||||
{
|
||||
LOGI("SoftbusListener::OnPublishSuccess, publishId: %d", publishId);
|
||||
}
|
||||
|
||||
void SoftbusListener::OnPublishFail(int publishId, PublishFailReason reason)
|
||||
{
|
||||
LOGI("SoftbusListener::OnPublishFail failed, publishId: %d, reason: %d", publishId, reason);
|
||||
}
|
||||
|
||||
void SoftbusListener::OnSoftbusDeviceInfoChanged(NodeBasicInfoType type, NodeBasicInfo *info)
|
||||
{
|
||||
LOGI("SoftbusListener::OnSoftbusDeviceInfoChanged.");
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
@@ -36,19 +36,18 @@ ohos_fuzztest("DeviceManagerImplFuzzTest") {
|
||||
"${common_path}/include/ipc",
|
||||
"${common_path}/include/ipc/model",
|
||||
"${utils_path}/include/ipc/standard",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/ipc/standard",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/deviceinfo/",
|
||||
"${services_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/ipc/standard",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
|
||||
"//foundation/communication/softbus_lite/interfaces/kits/transport",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
@@ -62,8 +61,8 @@ ohos_fuzztest("DeviceManagerImplFuzzTest") {
|
||||
"//foundation/deviceprofile/device_profile_core/interfaces/innerkits/core/include",
|
||||
"//foundation/distributedhardware/device_manager/ext/mini/common/include",
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/config",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/config",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
|
||||
@@ -34,19 +34,18 @@ ohos_fuzztest("DeviceManagerNotifyFuzzTest") {
|
||||
"${common_path}/include/ipc/model",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/ipc/standard",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/ipc/standard",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/deviceinfo/",
|
||||
"${services_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/ipc/standard",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
|
||||
"//foundation/communication/softbus_lite/interfaces/kits/transport",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
@@ -60,8 +59,8 @@ ohos_fuzztest("DeviceManagerNotifyFuzzTest") {
|
||||
"//foundation/deviceprofile/device_profile_core/interfaces/innerkits/core/include",
|
||||
"//foundation/distributedhardware/device_manager/ext/mini/common/include",
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/config",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/config",
|
||||
]
|
||||
cflags = [
|
||||
"-g",
|
||||
|
||||
@@ -34,19 +34,19 @@ ohos_fuzztest("DeviceManagerServiceFuzzTest") {
|
||||
"${common_path}/include/ipc/model",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/ipc/standard",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include",
|
||||
"${services_path}/include/ipc/standard",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/deviceinfo/",
|
||||
"${services_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include",
|
||||
"${servicesimpl_path}/include/ipc/standard",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/deviceinfo/",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
|
||||
"//foundation/communication/softbus_lite/interfaces/kits/transport",
|
||||
"//foundation/communication/ipc_lite/interfaces/kits",
|
||||
@@ -60,8 +60,8 @@ ohos_fuzztest("DeviceManagerServiceFuzzTest") {
|
||||
"//foundation/deviceprofile/device_profile_core/interfaces/innerkits/core/include",
|
||||
"//foundation/distributedhardware/device_manager/ext/mini/common/include",
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/config",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/config",
|
||||
]
|
||||
cflags = [
|
||||
"-g",
|
||||
|
||||
@@ -39,16 +39,16 @@ ohos_fuzztest("IpcClientManagerFuzzTest") {
|
||||
"${common_path}/include/ipc/model",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/ipc/standard",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include",
|
||||
"${services_path}/include/ipc/standard",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/deviceinfo",
|
||||
"${services_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/deviceinfo",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
|
||||
"//foundation/communication/softbus_lite/interfaces/kits/transport",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/common",
|
||||
@@ -61,8 +61,8 @@ ohos_fuzztest("IpcClientManagerFuzzTest") {
|
||||
"//foundation/deviceprofile/device_profile_core/interfaces/innerkits/core/include",
|
||||
"//foundation/distributedhardware/device_manager/ext/mini/common/include",
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/config",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/config",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
|
||||
@@ -39,16 +39,16 @@ ohos_fuzztest("IpcCmdRegisterFuzzTest") {
|
||||
"${common_path}/include/ipc/model",
|
||||
"${utils_path}/include",
|
||||
"${utils_path}/include/ipc/standard",
|
||||
"${services_path}/include/dependency/timer",
|
||||
"${services_path}/include/dependency/softbus",
|
||||
"${services_path}/include/authentication",
|
||||
"${services_path}/include/adapter",
|
||||
"${services_path}/include",
|
||||
"${servicesimpl_path}/include/dependency/timer",
|
||||
"${servicesimpl_path}/include/dependency/softbus",
|
||||
"${servicesimpl_path}/include/authentication",
|
||||
"${servicesimpl_path}/include/adapter",
|
||||
"${servicesimpl_path}/include",
|
||||
"${services_path}/include/ipc/standard",
|
||||
"${services_path}/include/discovery",
|
||||
"${services_path}/include/dependency/hichain",
|
||||
"${services_path}/include/deviceinfo",
|
||||
"${services_path}/include/devicestate",
|
||||
"${servicesimpl_path}/include/discovery",
|
||||
"${servicesimpl_path}/include/dependency/hichain",
|
||||
"${servicesimpl_path}/include/deviceinfo",
|
||||
"${servicesimpl_path}/include/devicestate",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/bus_center",
|
||||
"//foundation/communication/softbus_lite/interfaces/kits/transport",
|
||||
"//foundation/communication/dsoftbus/interfaces/kits/common",
|
||||
@@ -61,8 +61,8 @@ ohos_fuzztest("IpcCmdRegisterFuzzTest") {
|
||||
"//foundation/deviceprofile/device_profile_core/interfaces/innerkits/core/include",
|
||||
"//foundation/distributedhardware/device_manager/ext/mini/common/include",
|
||||
"//base/security/device_auth/interfaces/innerkits",
|
||||
"${services_path}/include/ability",
|
||||
"${services_path}/include/config",
|
||||
"${servicesimpl_path}/include/ability",
|
||||
"${servicesimpl_path}/include/config",
|
||||
"//utils/native/lite/include",
|
||||
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user