1 /* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HOS_LITE_HIVIEW_SERVICE_H 17 #define HOS_LITE_HIVIEW_SERVICE_H 18 19 #include <service.h> 20 #include <iunknown.h> 21 #include "ohos_types.h" 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif /* End of #ifdef __cplusplus */ 28 29 typedef enum { 30 HIVIEW_CMP_TYPE_DUMP = 0, 31 HIVIEW_CMP_TYPE_LOG, 32 HIVIEW_CMP_TYPE_LOG_LIMIT, 33 HIVIEW_CMP_TYPE_EVENT, 34 HIVIEW_CMP_TYPE_MAX 35 } HiviewComponentType; 36 37 typedef enum { 38 HIVIEW_MSG_OUTPUT_LOG_FLOW = 0, 39 HIVIEW_MSG_OUTPUT_LOG_TEXT_FILE, 40 HIVIEW_MSG_OUTPUT_LOG_BIN_FILE, 41 HIVIEW_MSG_OUTPUT_EVENT_FLOW, 42 HIVIEW_MSG_OUTPUT_EVENT_BIN_FILE, 43 HIVIEW_MSG_MAX 44 } HiviewInnerMessage; 45 46 #define SYNC_FILE 1 47 48 typedef struct { 49 INHERIT_IUNKNOWN; 50 void (*Output)(IUnknown *iUnknown, int16 msgId, uint16 type); 51 } HiviewInterface; 52 53 typedef struct { 54 INHERIT_SERVICE; 55 INHERIT_IUNKNOWNENTRY(HiviewInterface); 56 Identity identity; 57 } HiviewService; 58 59 typedef void (* HiviewInitFunc)(void); 60 typedef void (* HiviewMsgHandle)(const Request *request); 61 62 void HiviewRegisterInitFunc(HiviewComponentType type, HiviewInitFunc func); 63 void HiviewRegisterMsgHandle(HiviewInnerMessage type, HiviewMsgHandle func); 64 void HiviewSendMessage(const char *srvName, int16 msgId, uint16 msgValue); 65 66 #ifdef __cplusplus 67 #if __cplusplus 68 } 69 #endif 70 #endif /* End of #ifdef __cplusplus */ 71 72 #endif /* End of #ifndef HOS_LITE_HIVIEW_SERVICE_H */ 73