mirror of
https://github.com/openharmony/distributed_hardware_fwk.git
synced 2026-07-19 13:45:35 -04:00
@@ -83,6 +83,7 @@ ohos_shared_library("distributedhardwarefwksvr_impl") {
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"distributeddatamgr:distributeddata_inner",
|
||||
"eventhandler:libeventhandler",
|
||||
"hitrace_native:hitrace_meter",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
"safwk:system_ability_fwk",
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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_DH_HITRACE_H
|
||||
#define OHOS_DH_HITRACE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "hitrace_meter.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
constexpr uint64_t DHFWK_HITRACE_LABEL = HITRACE_TAG_DISTRIBUTED_HARDWARE_FWK;
|
||||
|
||||
const std::string DH_FWK_COMPONENT_ENABLE_START = "DH_FWK_COMPONENT_ENABLE_START";
|
||||
const std::string DH_FWK_COMPONENT_DISABLE_START = "DH_FWK_COMPONENT_DISABLE_START";
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "constants.h"
|
||||
#include "distributed_hardware_errno.h"
|
||||
#include "distributed_hardware_log.h"
|
||||
#include "dh_hitrace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
@@ -39,6 +40,7 @@ int32_t ComponentDisable::Disable(const std::string &networkId, const std::strin
|
||||
return ERR_DH_FWK_PARA_INVALID;
|
||||
}
|
||||
|
||||
StartTrace(DHFWK_HITRACE_LABEL, DH_FWK_COMPONENT_DISABLE_START);
|
||||
auto ret = handler->UnregisterDistributedHardware(networkId, dhId, shared_from_this());
|
||||
if (ret != DH_FWK_SUCCESS) {
|
||||
DHLOGE("UnregisterDistributedHardware failed, networkId = %s dhId = %s.", GetAnonyString(networkId).c_str(),
|
||||
@@ -55,6 +57,7 @@ int32_t ComponentDisable::Disable(const std::string &networkId, const std::strin
|
||||
GetAnonyString(dhId).c_str());
|
||||
return ERR_DH_FWK_COMPONENT_DISABLE_TIMEOUT;
|
||||
}
|
||||
FinishTrace(DHFWK_HITRACE_LABEL);
|
||||
return (status_ == DH_FWK_SUCCESS) ? DH_FWK_SUCCESS : ERR_DH_FWK_COMPONENT_DISABLE_FAILED;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "constants.h"
|
||||
#include "distributed_hardware_errno.h"
|
||||
#include "distributed_hardware_log.h"
|
||||
#include "dh_hitrace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
@@ -39,6 +40,7 @@ int32_t ComponentEnable::Enable(const std::string &networkId, const std::string
|
||||
return ERR_DH_FWK_PARA_INVALID;
|
||||
}
|
||||
|
||||
StartTrace(DHFWK_HITRACE_LABEL, DH_FWK_COMPONENT_ENABLE_START);
|
||||
auto ret = handler->RegisterDistributedHardware(networkId, dhId, param, shared_from_this());
|
||||
if (ret != DH_FWK_SUCCESS) {
|
||||
DHLOGE("RegisterDistributedHardware failed, networkId = %s dhId = %s.", GetAnonyString(networkId).c_str(),
|
||||
@@ -55,6 +57,7 @@ int32_t ComponentEnable::Enable(const std::string &networkId, const std::string
|
||||
GetAnonyString(dhId).c_str());
|
||||
return ERR_DH_FWK_COMPONENT_ENABLE_TIMEOUT;
|
||||
}
|
||||
FinishTrace(DHFWK_HITRACE_LABEL);
|
||||
return (status_ == DH_FWK_SUCCESS) ? DH_FWK_SUCCESS : ERR_DH_FWK_COMPONENT_ENABLE_FAILED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user