1 /*
2  * Copyright (c) 2020-2021 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 OHOS_ACELITE_ACE_EVENT_ERROR_CODE_H
17 #define OHOS_ACELITE_ACE_EVENT_ERROR_CODE_H
18 
19 #include "acelite_config.h"
20 
21 #if (FEATURE_ACELITE_MC_EVENT_ERROR_CODE_PRINT == 1)
22 #include "ace_event_id.h"
23 #include "memory_heap.h"
24 #include "non_copyable.h"
25 #include <cstdint>
26 #define ACE_EVENT_PRINT(info2, info3) \
27     EventErrorCodePrint::GetInstance()->AceEventPrint(info2, info3)
28 #define ACE_FEATURE_EVENT_PRINT(info1, info2, info3) \
29     EventErrorCodePrint::GetInstance()->AceEventPrint(info1, info2, info3)
30 #define ACE_ERROR_CODE_PRINT(info2, rfu) \
31     EventErrorCodePrint::GetInstance()->AceErrorCodePrint(info2, rfu)
32 #else
33 #define ACE_EVENT_PRINT(info2, info3)
34 #define ACE_FEATURE_EVENT_PRINT(info1, info2, info3)
35 #define ACE_ERROR_CODE_PRINT(info2, rfu)
36 #endif // ENABLED(FEATURE_ACELITE_MC_EVENT_ERROR_CODE_PRINT)
37 
38 #if (FEATURE_ACELITE_MC_EVENT_ERROR_CODE_PRINT == 1)
39 namespace OHOS {
40 namespace ACELite {
41 class EventErrorCodePrint final : public MemoryHeap {
42 public:
43     ACE_DISALLOW_COPY_AND_MOVE(EventErrorCodePrint);
44 
45     EventErrorCodePrint() = default;
46 
47     ~EventErrorCodePrint() = default;
48 
49     static EventErrorCodePrint *GetInstance();
50 
51     void AceEventPrint(uint8_t info2, uint8_t info3);
52 
53     void AceEventPrint(uint8_t info1, uint8_t info2, uint8_t info3);
54 
55     void AceErrorCodePrint(uint8_t info2, uint16_t rfu);
56 };
57 } // namespace ACELite
58 } // namespace OHOS
59 #endif // FEATURE_ACELITE_MC_EVENT_ERROR_CODE_PRINT
60 #endif // OHOS_ACELITE_ACE_EVENT_ERROR_CODE_H
61