1 /* 2 * Copyright (c) 2022 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 UTILS_BUNDLE_LITE_AAFWK_EVENT_ERROR_CODE_H 17 #define UTILS_BUNDLE_LITE_AAFWK_EVENT_ERROR_CODE_H 18 19 #include "memory_heap.h" 20 #include "product_adapter.h" 21 #include "aafwk_event_error_id.h" 22 23 namespace OHOS { 24 namespace ACELite { 25 #define APP_EVENT(code1) \ 26 AafwkEventCodePrint::GetInstance()->AafwkEventPrint(code1, 0) 27 #define APP_ERRCODE_EXTRA(code1, code2) \ 28 AafwkEventCodePrint::GetInstance()->AafwkErrorPrint(code1, code2) 29 30 class AafwkEventCodePrint final : public MemoryHeap { 31 public: 32 AafwkEventCodePrint() = default; 33 ~AafwkEventCodePrint() = default; 34 GetInstance()35 static AafwkEventCodePrint *GetInstance() 36 { 37 static AafwkEventCodePrint printInstance; 38 return &printInstance; 39 } 40 AafwkEventPrint(uint8_t info2,uint8_t info3)41 void AafwkEventPrint(uint8_t info2, uint8_t info3) 42 { 43 ProductAdapter::PrintEventTrace(0, info2, info3); 44 } 45 AafwkEventPrint(uint8_t info1,uint8_t info2,uint8_t info3)46 void AafwkEventPrint(uint8_t info1, uint8_t info2, uint8_t info3) 47 { 48 ProductAdapter::PrintEventTrace(info1, info2, info3); 49 } 50 AafwkErrorPrint(uint8_t info1,uint16_t info2)51 void AafwkErrorPrint(uint8_t info1, uint16_t info2) 52 { 53 ProductAdapter::PrintErrCode(info1, info2); 54 } 55 }; 56 } 57 } 58 #endif