添加hisysevent

Signed-off-by: chen0088 <chenmenghuan3@huawei.com>
This commit is contained in:
chen0088
2022-05-24 15:43:11 +08:00
parent 81f348d49c
commit fc8d1beecc
20 changed files with 521 additions and 2 deletions
+3
View File
@@ -23,6 +23,9 @@
],
"rom":"2000k",
"ram":"6M",
"hisysevent_config": [
"//foundation/distributedhardware/distributedcamera/hisysevent.yaml"
],
"deps":{
"components":[
"appexecfwk_standard",
+165
View File
@@ -0,0 +1,165 @@
# 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.
#####################################################
# below is the format of defining event #
#####################################################
#domain: domain name. [Only one domain name can be defined at the top]
#
#author: the author name who defined this event.
#date: the date when this event was defined, format is YYYY-MM-DD.
#logged: source file which refer to this event.
#usage: the usage of this event.
#//Define event name and event properties.
#@EVENT_NAME: the event definition part begin.
# // __BASE is used for defining the basic info of the event.
# // "type" optional values are: FAULT, STATISTICS, SECURITY, BEHAVIOR.
# // "level" optional values are: CRITICAL, MINOR.
# // "tag" set tags with may used by subscriber of this event, multiple tags devided by space.
# // "desc" full description of this event.
# @PARAMETER: {type: parameter type, arrsize: array length(optional), desc: parameter description}.
# // follow the __BASE block, each line defines a parameter of this event.
# // "type" optional values are: INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, STRING.
# // "arrsize" of the parameter is an array, set a non-zero value.
# // "desc" full description of this parameter.
#####################################################
# Example of some hiviewdfx events definition #
#####################################################
domain: DISTCAMERA
SA_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: dcamera sa error occured}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera sa error info}
HDF_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: dcamera hdf error occured}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera hdf error info}
REGISTER_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: register dcamera error occured}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: register dcamera error info}
SOFTBUS_SESSIONSERVER_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: softbus sessionserver error occured}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
PKGNAME: {type: STRING, desc: softbus package name}
SESSIONNAME: {type: STRING, desc: softbus session name}
MSG: {type: STRING, desc: dcamera softbus sessionserver error info}
SOFTBUS_SESSION_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: softbus session error occured}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MYSESSIONNAME: {type: STRING, desc: softbus my session name}
PEERSESSIONNAME: {type: STRING, desc: softbus peer session name}
PEERDEVID: {type: STRING, desc: peer network id}
MSG: {type: STRING, desc: dcamera softbus session error info}
CAMERA_OPERATER_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: dcamera operater error occured}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera operater error info}
VIDEO_ENCODER_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: video encoder error occured}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera video encoder error info}
VIDEO_DECODER_ERROR:
__BASE: {type: FAULT, level: CRITICAL, desc: video decoder error occured}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera video decoder error info}
INIT_SA_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera init sa event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera init sa event}
RELEASE_SA_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera release sa event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera release sa event}
LOAD_HDF_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera load hdf event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera load hdf event}
UNLOAD_HDF_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera unload hdf event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera unload hdf event}
REGIST_CAMERA_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera register event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera register event}
UNREGIST_CAMERA_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera unregister event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera unregister event}
OPEN_CAMERA_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera open event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera open event}
CLOSE_CAMERA_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera close event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera close event}
CONFIG_STREAMS_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera config streams event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera config streams event}
RELEASE_STREAMS_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera release streams event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera release streams event}
START_CAPTURE_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera start capture event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera start capture event}
STOP_CAPTURE_EVENT:
__BASE: {type: BEHAVIOR, level: MINOR, desc: dcamera stop capture event}
PID: {type: INT32, desc: dcamera pid}
UID: {type: INT32, desc: dcamera uid}
MSG: {type: STRING, desc: dcamera stop capture event}
@@ -49,6 +49,7 @@ ohos_shared_library("distributed_camera_sink_sdk") {
]
external_deps = [
"hisysevent_native:libhisysevent",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"samgr_standard:samgr_proxy",
@@ -15,7 +15,10 @@
#include "dcamera_sink_handler.h"
#include <unistd.h>
#include "anonymous_string.h"
#include "hisysevent.h"
#include "dcamera_sink_handler_ipc.h"
#include "dcamera_sink_load_callback.h"
#include "distributed_camera_constants.h"
@@ -41,6 +44,16 @@ int32_t DCameraSinkHandler::InitSink(const std::string& params)
DHLOGE("GetSourceLocalDHMS GetSystemAbilityManager failed");
return DCAMERA_INIT_ERR;
}
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"INIT_SA_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "init sink sa event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
sptr<DCameraSinkLoadCallback> loadCallback = new DCameraSinkLoadCallback(params);
int32_t ret = sm->LoadSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID, loadCallback);
if (ret != DCAMERA_OK) {
@@ -91,6 +104,17 @@ int32_t DCameraSinkHandler::ReleaseSink()
return DCAMERA_BAD_VALUE;
}
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"RELEASE_SA_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "release sink sa event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = dCameraSinkSrv->ReleaseSink();
if (ret != DCAMERA_OK) {
DHLOGE("DCameraSinkHandler::ReleaseSink sink service release failed, ret: %d", ret);
@@ -12,10 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "dcamera_sink_load_callback.h"
#include <unistd.h>
#include "hisysevent.h"
#include "dcamera_sink_handler.h"
#include "distributed_hardware_log.h"
#include "distributed_camera_constants.h"
#include "distributed_camera_errno.h"
namespace OHOS {
namespace DistributedHardware {
@@ -41,6 +47,16 @@ void DCameraSinkLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
DHLOGI("OnLoadSystemAbilityFail systemAbilityId: %d.", systemAbilityId);
if (systemAbilityId != DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID) {
DHLOGE("start aystemabilityId is not sinkSAId!");
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"SA_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "dcamera sink OnLoadSystemAbilityFail.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return;
}
DCameraSinkHandler::GetInstance().FinishStartSAFailed(systemAbilityId);
@@ -52,6 +52,7 @@ ohos_shared_library("distributed_camera_source_sdk") {
]
external_deps = [
"hisysevent_native:libhisysevent",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"samgr_standard:samgr_proxy",
@@ -15,7 +15,10 @@
#include "dcamera_source_handler.h"
#include <unistd.h>
#include "anonymous_string.h"
#include "hisysevent.h"
#include "dcamera_source_callback.h"
#include "dcamera_source_handler_ipc.h"
#include "dcamera_source_load_callback.h"
@@ -43,6 +46,16 @@ int32_t DCameraSourceHandler::InitSource(const std::string& params)
DHLOGE("GetSourceLocalDHMS GetSystemAbilityManager failed");
return DCAMERA_INIT_ERR;
}
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"INIT_SA_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "init source sa event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
sptr<DCameraSourceLoadCallback> loadCallback = new DCameraSourceLoadCallback(params);
int32_t ret = sm->LoadSystemAbility(DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID, loadCallback);
if (ret != DCAMERA_OK) {
@@ -98,6 +111,16 @@ int32_t DCameraSourceHandler::ReleaseSource()
DHLOGE("DCameraSourceHandler ReleaseSource get Service failed");
return DCAMERA_INIT_ERR;
}
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"RELEASE_SA_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "release source sa event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
dCameraSourceSrv->ReleaseSource();
DCameraSourceHandlerIpc::GetInstance().UnInit();
std::unique_lock<std::mutex> lock(producerMutex_);
@@ -12,10 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "dcamera_source_load_callback.h"
#include <unistd.h>
#include "hisysevent.h"
#include "dcamera_source_handler.h"
#include "distributed_hardware_log.h"
#include "distributed_camera_constants.h"
#include "distributed_camera_errno.h"
namespace OHOS {
namespace DistributedHardware {
@@ -41,6 +47,16 @@ void DCameraSourceLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
DHLOGI("OnLoadSystemAbilityFail systemAbilityId: %d.", systemAbilityId);
if (systemAbilityId != DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID) {
DHLOGE("start systemabilityId is not sourceSAId!");
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"SA_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "dcamera source OnLoadSystemAbilityFail.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return;
}
DCameraSourceHandler::GetInstance().FinishStartSAFailed(systemAbilityId);
@@ -118,6 +118,7 @@ ohos_shared_library("distributed_camera_sink") {
]
external_deps = [
"hisysevent_native:libhisysevent",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
@@ -15,6 +15,9 @@
#include "distributed_camera_sink_service.h"
#include <unistd.h>
#include "hisysevent.h"
#include "if_system_ability_manager.h"
#include "ipc_skeleton.h"
#include "ipc_types.h"
@@ -235,6 +238,16 @@ int32_t DistributedCameraSinkService::OpenChannel(const std::string& dhId, std::
int32_t ret = sinkDevice->OpenChannel(openInfo);
if (ret != DCAMERA_OK) {
DHLOGE("DistributedCameraSinkService::OpenChannel failed, ret: %d", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"CAMERA_OPERATER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "sink service open channel failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return ret;
}
DHLOGI("DistributedCameraSinkService::OpenChannel success");
@@ -104,6 +104,7 @@ ohos_shared_library("distributed_camera_source") {
]
external_deps = [
"hisysevent_native:libhisysevent",
"device_driver_framework:libhdf_utils",
"device_driver_framework:libhdi",
"eventhandler:libeventhandler",
@@ -15,6 +15,9 @@
#include "distributed_camera_source_service.h"
#include <unistd.h>
#include "hisysevent.h"
#include "if_system_ability_manager.h"
#include "ipc_skeleton.h"
#include "ipc_types.h"
@@ -87,6 +90,16 @@ int32_t DistributedCameraSourceService::InitSource(const std::string& params,
const sptr<IDCameraSourceCallback>& callback)
{
DHLOGI("DistributedCameraSourceService InitSource param: %s", params.c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"LOAD_HDF_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "load dcamera hdf event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = LoadDCameraHDF();
if (ret != DCAMERA_OK) {
DHLOGE("DistributedCameraSourceService InitSource LoadHDF failed, ret: %d", ret);
@@ -100,6 +113,16 @@ int32_t DistributedCameraSourceService::InitSource(const std::string& params,
int32_t DistributedCameraSourceService::ReleaseSource()
{
DHLOGI("DistributedCameraSourceService ReleaseSource");
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"UNLOAD_HDF_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "unload dcamera hdf event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = UnLoadCameraHDF();
if (ret != DCAMERA_OK) {
DHLOGE("DistributedCameraSourceService ReleaseSource UnLoadHDF failed, ret: %d", ret);
@@ -143,6 +166,16 @@ int32_t DistributedCameraSourceService::RegisterDistributedHardware(const std::s
if (ret != DCAMERA_OK) {
DHLOGE("DistributedCameraSourceService RegisterDistributedHardware failed, ret: %d", ret);
camerasMap_.erase(camIndex);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"REGISTER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "dcamera source RegisterDistributedHardware fail.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
}
DHLOGI("DistributedCameraSourceService RegisterDistributedHardware end devId: %s, dhId: %s, version: %s",
GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), param.version.c_str());
@@ -195,6 +228,16 @@ int32_t DistributedCameraSourceService::LoadDCameraHDF()
int32_t ret = DCameraHdfOperate::GetInstance().LoadDcameraHDFImpl();
if (ret != DCAMERA_OK) {
DHLOGE("load hdf driver failed, ret %d", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"HDF_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "dcamera load hdf driver fail.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return ret;
}
DHLOGI("load hdf driver end");
@@ -207,6 +250,16 @@ int32_t DistributedCameraSourceService::UnLoadCameraHDF()
int32_t ret = DCameraHdfOperate::GetInstance().UnLoadDcameraHDFImpl();
if (ret != DCAMERA_OK) {
DHLOGE("unload hdf driver failed, ret %d", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"HDF_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "dcamera unload hdf driver fail.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return ret;
}
DHLOGI("unload hdf driver end");
@@ -15,7 +15,10 @@
#include "dcamera_source_dev.h"
#include <unistd.h>
#include "anonymous_string.h"
#include "hisysevent.h"
#include "distributed_camera_constants.h"
#include "distributed_camera_errno.h"
#include "distributed_hardware_log.h"
@@ -215,6 +218,16 @@ int32_t DCameraSourceDev::ExecuteRegister(std::shared_ptr<DCameraRegistParam>& p
{
DHLOGI("DCameraSourceDev Execute Register devId: %s dhId: %s",
GetAnonyString(devId_).c_str(), GetAnonyString(dhId_).c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"REGIST_CAMERA_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "execute register event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
std::vector<DCameraIndex> actualDevInfo;
actualDevInfo.assign(actualDevInfo_.begin(), actualDevInfo_.end());
int32_t ret = controller_->Init(actualDevInfo);
@@ -258,6 +271,16 @@ int32_t DCameraSourceDev::ExecuteUnRegister(std::shared_ptr<DCameraRegistParam>&
{
DHLOGI("DCameraSourceDev Execute UnRegister devId: %s dhId: %s", GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"UNREGIST_CAMERA_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "execute unregister event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = controller_->UnInit();
if (ret != DCAMERA_OK) {
DHLOGE("DCameraSourceDev Execute UnRegister controller uninit failed, ret: %d, devId: %s dhId: %s", ret,
@@ -293,6 +316,16 @@ int32_t DCameraSourceDev::ExecuteOpenCamera()
{
DHLOGI("DCameraSourceDev Execute OpenCamera devId %s dhId %s", GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"OPEN_CAMERA_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "execute open camera event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
std::shared_ptr<DCameraOpenInfo> openInfo = std::make_shared<DCameraOpenInfo>();
int32_t ret = GetLocalDeviceNetworkId(openInfo->sourceDevId_);
if (ret != DCAMERA_OK) {
@@ -314,6 +347,16 @@ int32_t DCameraSourceDev::ExecuteCloseCamera()
{
DHLOGI("DCameraSourceDev Execute CloseCamera devId %s dhId %s", GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"CLOSE_CAMERA_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "execute close camera event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = input_->CloseChannel();
if (ret != DCAMERA_OK) {
DHLOGE("DCameraSourceDev Execute CloseCamera input CloseChannel failed, ret: %d, devId: %s dhId: %s", ret,
@@ -331,6 +374,16 @@ int32_t DCameraSourceDev::ExecuteConfigStreams(std::vector<std::shared_ptr<DCStr
{
DHLOGI("DCameraSourceDev Execute ConfigStreams devId %s dhId %s", GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"CONFIG_STREAMS_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "execute config streams event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = input_->ConfigStreams(streamInfos);
if (ret != DCAMERA_OK) {
DHLOGE("DCameraSourceDev Execute ConfigStreams ConfigStreams failed, ret: %d, devId: %s dhId: %s", ret,
@@ -372,6 +425,16 @@ int32_t DCameraSourceDev::ExecuteReleaseStreams(std::vector<int>& streamIds, boo
{
DHLOGI("DCameraSourceDev Execute ReleaseStreams devId %s dhId %s", GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"RELEASE_STREAMS_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "execute release streams event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = input_->ReleaseStreams(streamIds, isAllRelease);
if (ret != DCAMERA_OK) {
DHLOGE("DCameraSourceDev Execute ReleaseStreams failed ret: %d, devId: %s, dhId: %s", ret,
@@ -398,6 +461,16 @@ int32_t DCameraSourceDev::ExecuteStartCapture(std::vector<std::shared_ptr<DCCapt
{
DHLOGI("DCameraSourceDev Execute StartCapture devId %s dhId %s", GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"START_CAPTURE_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "execute start capture event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = input_->StartCapture(captureInfos);
if (ret != DCAMERA_OK) {
DHLOGE("DCameraSourceDev input StartCapture failed ret: %d, devId: %s, dhId: %s", ret,
@@ -440,6 +513,16 @@ int32_t DCameraSourceDev::ExecuteStopCapture(std::vector<int>& streamIds, bool&
{
DHLOGI("DCameraSourceDev Execute StopCapture devId %s dhId %s", GetAnonyString(devId_).c_str(),
GetAnonyString(dhId_).c_str());
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"STOP_CAPTURE_EVENT",
OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
"PID", getpid(),
"UID", getuid(),
"MSG", "execute stop capture event.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
int32_t ret = input_->StopCapture(streamIds, isAllStop);
if (ret != DCAMERA_OK) {
DHLOGE("DCameraSourceDev Execute StopCapture input StopCapture failed, ret: %d, devId: %s dhId: %s", ret,
+1
View File
@@ -52,6 +52,7 @@ ohos_shared_library("distributed_camera_channel") {
]
external_deps = [
"hisysevent_native:libhisysevent",
"dsoftbus_standard:softbus_client",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
@@ -15,8 +15,10 @@
#include "dcamera_softbus_adapter.h"
#include <unistd.h>
#include <securec.h>
#include "hisysevent.h"
#include "softbus_bus_center.h"
#include "softbus_common.h"
@@ -125,6 +127,18 @@ int32_t DCameraSoftbusAdapter::CreateSoftbusSessionServer(std::string sessionNam
int32_t ret = CreateSessionServer(PKG_NAME.c_str(), sessionName.c_str(), &sessListeners_[role]);
if (ret != DCAMERA_OK) {
DHLOGE("DCameraSoftbusAdapter CreateSessionServer failed, ret: %d", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"SOFTBUS_SESSIONSERVER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"PKGNAME", PKG_NAME.c_str(),
"SESSIONNAME", sessionName.c_str(),
"MSG", "create session server failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return ret;
}
sessionTotal_[sessionName]++;
@@ -197,6 +211,19 @@ int32_t DCameraSoftbusAdapter::OpenSoftbusSession(std::string mySessName, std::s
int32_t sessionId = OpenSession(mySessName.c_str(), peerSessName.c_str(), peerDevId.c_str(), "0", &attr);
if (sessionId < 0) {
DHLOGE("DCameraSoftbusAdapter OpenSoftbusSession failed %d", sessionId);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"SOFTBUS_SESSION_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MYSESSIONNAME", mySessName.c_str(),
"PEERSESSIONNAME", peerSessName.c_str(),
"PEERDEVID", peerDevId.c_str(),
"MSG", "open softbus session failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return DCAMERA_BAD_OPERATE;
}
return DCAMERA_OK;
+1
View File
@@ -83,6 +83,7 @@ ohos_shared_library("distributed_camera_data_process") {
]
external_deps = [
"hisysevent_native:libhisysevent",
"eventhandler:libeventhandler",
"hiviewdfx_hilog_native:libhilog",
"multimedia_media_standard:media_client",
@@ -15,6 +15,9 @@
#include "decode_data_process.h"
#include <unistd.h>
#include "hisysevent.h"
#include "distributed_hardware_log.h"
#include "graphic_common_c.h"
@@ -232,6 +235,16 @@ int32_t DecodeDataProcess::StartVideoDecoder()
ret = videoDecoder_->Start();
if (ret != Media::MediaServiceErrCode::MSERR_OK) {
DHLOGE("Video decoder start failed. Error code %d.", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"VIDEO_DECODER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "video decoder start failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return DCAMERA_INIT_ERR;
}
return DCAMERA_OK;
@@ -253,6 +266,16 @@ int32_t DecodeDataProcess::StopVideoDecoder()
ret = videoDecoder_->Stop();
if (ret != Media::MediaServiceErrCode::MSERR_OK) {
DHLOGE("VideoDecoder stop failed. Error type: %d.", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"VIDEO_DECODER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "video decoder stop failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
isSuccess = isSuccess && false;
}
if (!isSuccess) {
@@ -15,6 +15,9 @@
#include "decode_data_process.h"
#include <unistd.h>
#include "hisysevent.h"
#include "distributed_hardware_log.h"
#include "graphic_common_c.h"
@@ -220,6 +223,16 @@ int32_t DecodeDataProcess::StartVideoDecoder()
ret = videoDecoder_->Start();
if (ret != Media::MediaServiceErrCode::MSERR_OK) {
DHLOGE("Video decoder start failed. Error code %d.", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"VIDEO_DECODER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "video decoder start failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return DCAMERA_INIT_ERR;
}
return DCAMERA_OK;
@@ -242,6 +255,16 @@ int32_t DecodeDataProcess::StopVideoDecoder()
ret = videoDecoder_->Stop();
if (ret != Media::MediaServiceErrCode::MSERR_OK) {
DHLOGE("VideoDecoder stop failed. Error type: %d.", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"VIDEO_DECODER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "video decoder stop failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
isSuccess = isSuccess && false;
}
if (!isSuccess) {
@@ -15,8 +15,10 @@
#include "encode_data_process.h"
#include<cmath>
#include <cmath>
#include <unistd.h>
#include "hisysevent.h"
#include "display_type.h"
#include "distributed_hardware_log.h"
#include "graphic_common_c.h"
@@ -255,6 +257,16 @@ int32_t EncodeDataProcess::StartVideoEncoder()
ret = videoEncoder_->Start();
if (ret != Media::MediaServiceErrCode::MSERR_OK) {
DHLOGE("Video encoder start failed. Error code %d.", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"VIDEO_ENCODER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "video encoder start failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return DCAMERA_INIT_ERR;
}
return DCAMERA_OK;
@@ -276,6 +288,16 @@ int32_t EncodeDataProcess::StopVideoEncoder()
ret = videoEncoder_->Stop();
if (ret != Media::MediaServiceErrCode::MSERR_OK) {
DHLOGE("VideoEncoder stop failed. Error type: %d.", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"VIDEO_ENCODER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "video encoder stop failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
isSuccess = isSuccess && false;
}
@@ -15,11 +15,13 @@
#include "encode_data_process.h"
#include<cmath>
#include <cmath>
#include <unistd.h>
#include "display_type.h"
#include "distributed_hardware_log.h"
#include "graphic_common_c.h"
#include "hisysevent.h"
#include "dcamera_utils_tools.h"
#include "encode_video_callback.h"
@@ -227,6 +229,16 @@ int32_t EncodeDataProcess::StartVideoEncoder()
ret = videoEncoder_->Start();
if (ret != Media::MediaServiceErrCode::MSERR_OK) {
DHLOGE("Video encoder start failed. Error code %d.", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"VIDEO_ENCODER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "video encoder start failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
return DCAMERA_INIT_ERR;
}
return DCAMERA_OK;
@@ -248,6 +260,16 @@ int32_t EncodeDataProcess::StopVideoEncoder()
ret = videoEncoder_->Stop();
if (ret != Media::MediaServiceErrCode::MSERR_OK) {
DHLOGE("VideoEncoder stop failed. Error type: %d.", ret);
int32_t retVal = OHOS::HiviewDFX::HiSysEvent::Write(
OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_CAMERA,
"VIDEO_ENCODER_ERROR",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
"PID", getpid(),
"UID", getuid(),
"MSG", "video encoder stop failed.");
if (retVal != DCAMERA_OK) {
DHLOGE("Write HiSysEvent error, retVal:%d", retVal);
}
isSuccess = isSuccess && false;
}