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 OHOS_DAUDIO_HISYSEVENT_H 17 #define OHOS_DAUDIO_HISYSEVENT_H 18 19 #include <cstring> 20 #include <string> 21 22 #include "daudio_errorcode.h" 23 #include "daudio_log.h" 24 #include "daudio_util.h" 25 #include "hisysevent.h" 26 #include "single_instance.h" 27 28 namespace OHOS { 29 namespace DistributedHardware { 30 const std::string DAUDIO_INIT = "DAUDIO_INIT"; 31 const std::string DAUDIO_EXIT = "DAUDIO_EXIT"; 32 const std::string DAUDIO_OPEN = "DAUDIO_OPEN"; 33 const std::string DAUDIO_CLOSE = "DAUDIO_CLOSE"; 34 const std::string DAUIDO_REGISTER = "DAUIDO_REGISTER"; 35 const std::string DAUDIO_UNREGISTER = "DAUDIO_UNREGISTER"; 36 37 const std::string DAUDIO_OPT_FAIL = "DAUDIO_OPT_FAIL"; 38 const std::string DAUDIO_INIT_FAIL = "DAUDIO_INIT_FAIL"; 39 const std::string DAUDIO_REGISTER_FAIL = "DAUDIO_REGISTER_FAIL"; 40 const std::string DAUDIO_UNREGISTER_FAIL = "DAUDIO_UNREGISTER_FAIL"; 41 42 class DAudioHisysevent { 43 DECLARE_SINGLE_INSTANCE_BASE(DAudioHisysevent); 44 45 public: 46 void SysEventWriteBehavior(const std::string &eventName, const std::string &msg); 47 void SysEventWriteBehavior(const std::string &eventName, int32_t saId, const std::string &msg); 48 void SysEventWriteBehavior(const std::string &eventName, const std::string &devId, const std::string &dhId, 49 const std::string &msg); 50 void SysEventWriteFault(const std::string &eventName, const std::string &msg); 51 void SysEventWriteFault(const std::string &eventName, int32_t saId, int32_t errorCode, const std::string &msg); 52 void SysEventWriteFault(const std::string &eventName, int32_t errorCode, const std::string &msg); 53 void SysEventWriteFault(const std::string &eventName, const std::string &devId, const std::string &dhId, 54 int32_t errorCode, const std::string &msg); 55 56 private: 57 DAudioHisysevent() = default; 58 ~DAudioHisysevent() = default; 59 }; 60 } // namespace DistributedHardware 61 } // namespace OHOS 62 #endif