增加公用

Signed-off-by: wangyb0625 <wangyibo38@huawei.com>
This commit is contained in:
wangyb0625
2022-06-20 15:14:35 +08:00
parent 23d28076cf
commit ccaacc7b06
5 changed files with 72 additions and 44 deletions
+3
View File
@@ -24,6 +24,7 @@ if (defined(ohos_lite)) {
static_library("devicemanagerutils_mini") {
include_dirs = [
"${utils_path}/include",
"${utils_path}/include/dfx",
"${utils_path}/include/dfx/lite",
"${utils_path}/include/permission/lite",
"${common_path}/include",
@@ -73,6 +74,7 @@ if (defined(ohos_lite)) {
"${common_path}/include/ipc",
"${common_path}/include/ipc/model",
"include",
"include/dfx",
"include/dfx/lite",
"include/fwkload/lite",
"include/ipc/lite",
@@ -127,6 +129,7 @@ if (defined(ohos_lite)) {
include_dirs = [
"include",
"include/fwkload/standard",
"include/dfx",
"include/dfx/standard",
"include/ipc/standard",
"${common_path}/include",
+63
View File
@@ -0,0 +1,63 @@
/*
* 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_DFX_CONSTANTS_H
#define OHOS_DM_DFX_CONSTANTS_H
#include <string>
namespace OHOS {
namespace DistributedHardware {
// type
enum DM_HISYEVENT_EventType {
DM_HISYEVENT_FAULT = 1, // system fault event
DM_HISYEVENT_STATISTIC = 2, // system statistic event
DM_HISYEVENT_SECURITY = 3, // system security event
DM_HISYEVENT_BEHAVIOR = 4 // system behavior event
};
// state
const std::string DM_INIT_DEVICE_MANAGER_SUCCESS = "DM_INIT_DEVICE_MANAGER_SUCCESS";
const std::string DM_INIT_DEVICE_MANAGER_FAILED = "DM_INIT_DEVICE_MANAGER_FAILED";
const std::string START_DEVICE_DISCOVERY_SUCCESS = "START_DEVICE_DISCOVERY_SUCCESS";
const std::string START_DEVICE_DISCOVERY_FAILED = "START_DEVICE_DISCOVERY_FAILED";
const std::string GET_LOCAL_DEVICE_INFO_SUCCESS = "GET_LOCAL_DEVICE_INFO_SUCCESS";
const std::string GET_LOCAL_DEVICE_INFO_FAILED = "GET_LOCAL_DEVICE_INFO_FAILED";
const std::string DM_SEND_REQUEST_SUCCESS = "DM_SEND_REQUEST_SUCCESS";
const std::string DM_SEND_REQUEST_FAILED = "DM_SEND_REQUEST_FAILED";
const std::string ADD_HICHAIN_GROUP_SUCCESS = "ADD_HICHAIN_GROUP_SUCCESS";
const std::string ADD_HICHAIN_GROUP_FAILED = "ADD_HICHAIN_GROUP_FAILED";
const std::string DM_CREATE_GROUP_SUCCESS = "DM_CREATE_GROUP_SUCCESS";
const std::string DM_CREATE_GROUP_FAILED = "DM_CREATE_GROUP_FAILED";
const std::string UNAUTHENTICATE_DEVICE_SUCCESS = "UNAUTHENTICATE_DEVICE_SUCCESS";
const std::string UNAUTHENTICATE_DEVICE_FAILED = "UNAUTHENTICATE_DEVICE_FAILED";
// msg
const std::string DM_INIT_DEVICE_MANAGER_SUCCESS_MSG = "init devicemanager success.";
const std::string DM_INIT_DEVICE_MANAGER_FAILED_MSG = "init devicemanager failed.";
const std::string START_DEVICE_DISCOVERY_SUCCESS_MSG = "device manager discovery success.";
const std::string START_DEVICE_DISCOVERY_FAILED_MSG = "device manager discovery failed.";
const std::string GET_LOCAL_DEVICE_INFO_SUCCESS_MSG = "get local device info success.";
const std::string GET_LOCAL_DEVICE_INFO_FAILED_MSG = "get local device info failed.";
const std::string DM_SEND_REQUEST_SUCCESS_MSG = "send request success.";
const std::string DM_SEND_REQUEST_FAILED_MSG = "send request failed.";
const std::string ADD_HICHAIN_GROUP_SUCCESS_MSG = "dm add member to group success.";
const std::string ADD_HICHAIN_GROUP_FAILED_MSG = "dm add member to group failed.";
const std::string DM_CREATE_GROUP_SUCCESS_MSG = "dm create group success.";
const std::string DM_CREATE_GROUP_FAILED_MSG = "dm create group failed.";
const std::string UNAUTHENTICATE_DEVICE_SUCCESS_MSG = "unauthenticate device success.";
const std::string UNAUTHENTICATE_DEVICE_FAILED_MSG = "unauthenticate device failed.";
} // namespace DistributedHardware
} // namespace OHOS
#endif // OHOS_DM_CONSTANTS_H
+2 -1
View File
@@ -18,6 +18,7 @@
#include "single_instance.h"
#include "dm_constants.h"
#include "dm_dfx_constants.h"
#include <cstring>
#include <unistd.h>
@@ -28,7 +29,7 @@ class HisyseventUtil {
DECLARE_SINGLE_INSTANCE(HisyseventUtil);
public:
void SysEventWrite(void);
void SysEventWrite(std::string status, DM_HISYEVENT_EventType dmeventType, std::string msg);
};
} // namespace DistributedHardware
} // namespace OHOS
+3 -42
View File
@@ -16,57 +16,18 @@
#ifndef OHOS_DISTRIBUTED_DM_HISYSEVENT_H
#define OHOS_DISTRIBUTED_DM_HISYSEVENT_H
#include "single_instance.h"
#include "dm_anonymous.h"
#include "dm_log.h"
#include "dm_constants.h"
#include "dm_anonymous.h"
#include "dm_dfx_constants.h"
#include "hisysevent.h"
#include "single_instance.h"
#include <cstring>
#include <unistd.h>
namespace OHOS {
namespace DistributedHardware {
// type
enum DM_HISYEVENT_EventType {
DM_HISYEVENT_FAULT = 1, // system fault event
DM_HISYEVENT_STATISTIC = 2, // system statistic event
DM_HISYEVENT_SECURITY = 3, // system security event
DM_HISYEVENT_BEHAVIOR = 4 // system behavior event
};
// state
const std::string DM_INIT_DEVICE_MANAGER_SUCCESS = "DM_INIT_DEVICE_MANAGER_SUCCESS";
const std::string DM_INIT_DEVICE_MANAGER_FAILED = "DM_INIT_DEVICE_MANAGER_FAILED";
const std::string START_DEVICE_DISCOVERY_SUCCESS = "START_DEVICE_DISCOVERY_SUCCESS";
const std::string START_DEVICE_DISCOVERY_FAILED = "START_DEVICE_DISCOVERY_FAILED";
const std::string GET_LOCAL_DEVICE_INFO_SUCCESS = "GET_LOCAL_DEVICE_INFO_SUCCESS";
const std::string GET_LOCAL_DEVICE_INFO_FAILED = "GET_LOCAL_DEVICE_INFO_FAILED";
const std::string DM_SEND_REQUEST_SUCCESS = "DM_SEND_REQUEST_SUCCESS";
const std::string DM_SEND_REQUEST_FAILED = "DM_SEND_REQUEST_FAILED";
const std::string ADD_HICHAIN_GROUP_SUCCESS = "ADD_HICHAIN_GROUP_SUCCESS";
const std::string ADD_HICHAIN_GROUP_FAILED = "ADD_HICHAIN_GROUP_FAILED";
const std::string DM_CREATE_GROUP_SUCCESS = "DM_CREATE_GROUP_SUCCESS";
const std::string DM_CREATE_GROUP_FAILED = "DM_CREATE_GROUP_FAILED";
const std::string UNAUTHENTICATE_DEVICE_SUCCESS = "UNAUTHENTICATE_DEVICE_SUCCESS";
const std::string UNAUTHENTICATE_DEVICE_FAILED = "UNAUTHENTICATE_DEVICE_FAILED";
// msg
const std::string DM_INIT_DEVICE_MANAGER_SUCCESS_MSG = "init devicemanager success.";
const std::string DM_INIT_DEVICE_MANAGER_FAILED_MSG = "init devicemanager failed.";
const std::string START_DEVICE_DISCOVERY_SUCCESS_MSG = "device manager discovery success.";
const std::string START_DEVICE_DISCOVERY_FAILED_MSG = "device manager discovery failed.";
const std::string GET_LOCAL_DEVICE_INFO_SUCCESS_MSG = "get local device info success.";
const std::string GET_LOCAL_DEVICE_INFO_FAILED_MSG = "get local device info failed.";
const std::string DM_SEND_REQUEST_SUCCESS_MSG = "send request success.";
const std::string DM_SEND_REQUEST_FAILED_MSG = "send request failed.";
const std::string ADD_HICHAIN_GROUP_SUCCESS_MSG = "dm add member to group success.";
const std::string ADD_HICHAIN_GROUP_FAILED_MSG = "dm add member to group failed.";
const std::string DM_CREATE_GROUP_SUCCESS_MSG = "dm create group success.";
const std::string DM_CREATE_GROUP_FAILED_MSG = "dm create group failed.";
const std::string UNAUTHENTICATE_DEVICE_SUCCESS_MSG = "unauthenticate device success.";
const std::string UNAUTHENTICATE_DEVICE_FAILED_MSG = "unauthenticate device failed.";
class HisyseventUtil {
DECLARE_SINGLE_INSTANCE(HisyseventUtil);
+1 -1
View File
@@ -18,7 +18,7 @@
namespace OHOS {
namespace DistributedHardware {
IMPLEMENT_SINGLE_INSTANCE(HisyseventUtil);
void HisyseventUtil::SysEventWrite(void)
void HisyseventUtil::SysEventWrite(std::string status, DM_HISYEVENT_EventType dmeventType, std::string msg)
{
return;
}