1d96309c9Sopenharmony_ci/*
2d96309c9Sopenharmony_ci * Copyright (c) 2020 Huawei Device Co., Ltd.
3d96309c9Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4d96309c9Sopenharmony_ci * you may not use this file except in compliance with the License.
5d96309c9Sopenharmony_ci * You may obtain a copy of the License at
6d96309c9Sopenharmony_ci *
7d96309c9Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8d96309c9Sopenharmony_ci *
9d96309c9Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10d96309c9Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11d96309c9Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12d96309c9Sopenharmony_ci * See the License for the specific language governing permissions and
13d96309c9Sopenharmony_ci * limitations under the License.
14d96309c9Sopenharmony_ci */
15d96309c9Sopenharmony_ci
16d96309c9Sopenharmony_ci#ifndef HOS_LITE_HIVIEW_COMMAND_H
17d96309c9Sopenharmony_ci#define HOS_LITE_HIVIEW_COMMAND_H
18d96309c9Sopenharmony_ci
19d96309c9Sopenharmony_ci#include <stdbool.h>
20d96309c9Sopenharmony_ci
21d96309c9Sopenharmony_ci#include "log.h"
22d96309c9Sopenharmony_ci
23d96309c9Sopenharmony_ci#ifdef __cplusplus
24d96309c9Sopenharmony_ci#if __cplusplus
25d96309c9Sopenharmony_ciextern "C" {
26d96309c9Sopenharmony_ci#endif
27d96309c9Sopenharmony_ci#endif /* End of #ifdef __cplusplus */
28d96309c9Sopenharmony_ci
29d96309c9Sopenharmony_ci#define DOMAIN_ID_LENGTH 5
30d96309c9Sopenharmony_ci#define SILENT_MODE_OFF 0
31d96309c9Sopenharmony_ci#define SILENT_MODE_ON 1
32d96309c9Sopenharmony_ci
33d96309c9Sopenharmony_citypedef struct {
34d96309c9Sopenharmony_ci    const unsigned char outputOption : 4; /* Control log output mode. Cannot be modified during running. */
35d96309c9Sopenharmony_ci    unsigned char hiviewInited : 1;       /* Indicates whether the hiview service is inited. */
36d96309c9Sopenharmony_ci    unsigned char level : 3;              /* Control log output level. HILOG_LV_XXX */
37d96309c9Sopenharmony_ci    unsigned char logSwitch : 1;          /* Indicates whether to enable the log component. */
38d96309c9Sopenharmony_ci    unsigned char eventSwitch : 1;        /* Indicates whether to enable the event component. */
39d96309c9Sopenharmony_ci    unsigned char dumpSwitch : 1;         /* Indicates whether to enable the dump component. */
40d96309c9Sopenharmony_ci    unsigned char silenceMod : 1;         /* Silent mode, 0 for mode off, 1 for mdoe on. */
41d96309c9Sopenharmony_ci    char logOutputModule[DOMAIN_ID_LENGTH + 1]; /* Control log output module (including '\0' byte). */
42d96309c9Sopenharmony_ci    unsigned short writeFailureCount;
43d96309c9Sopenharmony_ci} HiviewConfig;
44d96309c9Sopenharmony_ci
45d96309c9Sopenharmony_citypedef enum {
46d96309c9Sopenharmony_ci    OUTPUT_OPTION_DEBUG = 0, /* Output to the UART without buffer. Commercial versions are forbidden. */
47d96309c9Sopenharmony_ci    OUTPUT_OPTION_FLOW,      /* Output to UART via SAMR */
48d96309c9Sopenharmony_ci    OUTPUT_OPTION_TEXT_FILE,
49d96309c9Sopenharmony_ci    OUTPUT_OPTION_BIN_FILE,
50d96309c9Sopenharmony_ci    OUTPUT_OPTION_MAX
51d96309c9Sopenharmony_ci} HiviewOutputOption;
52d96309c9Sopenharmony_ci
53d96309c9Sopenharmony_ciextern HiviewConfig g_hiviewConfig;
54d96309c9Sopenharmony_ci
55d96309c9Sopenharmony_ciint HilogCmdProc(const char *tag, int argc, char *argv[]);
56d96309c9Sopenharmony_cibool FilterLevelLog(unsigned char setLevel, unsigned char logLevel);
57d96309c9Sopenharmony_cibool FilterModuleLog(const char *setModule, const char *logModule);
58d96309c9Sopenharmony_ci
59d96309c9Sopenharmony_ci#ifdef __cplusplus
60d96309c9Sopenharmony_ci#if __cplusplus
61d96309c9Sopenharmony_ci}
62d96309c9Sopenharmony_ci#endif
63d96309c9Sopenharmony_ci#endif /* End of #ifdef __cplusplus */
64d96309c9Sopenharmony_ci
65d96309c9Sopenharmony_ci#endif /* End of #ifndef HOS_LITE_HIVIEW_COMMAND_H */
66