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_DISTRIBUTED_INPUT_HISYSEVENT_UTILS_H 17 #define OHOS_DISTRIBUTED_INPUT_HISYSEVENT_UTILS_H 18 19 #include <cstring> 20 21 #include "single_instance.h" 22 #include "hisysevent.h" 23 #include "constants_dinput.h" 24 25 namespace OHOS { 26 namespace DistributedHardware { 27 namespace DistributedInput { 28 const std::string DINPUT_INIT = "DINPUT_INIT"; 29 const std::string DINPUT_REGISTER = "DINPUT_REGISTER"; 30 const std::string DINPUT_PREPARE = "DINPUT_PREPARE"; 31 const std::string DINPUT_START_USE = "DINPUT_START_USE"; 32 const std::string DINPUT_STOP_USE = "DINPUT_STOP_USE"; 33 const std::string DINPUT_UNPREPARE = "DINPUT_UNPREPARE"; 34 const std::string DINPUT_UNREGISTER = "DINPUT_UNREGISTER"; 35 const std::string DINPUT_EXIT = "DINPUT_EXIT"; 36 const std::string DINPUT_INIT_FAIL = "DINPUT_INIT_FAIL"; 37 const std::string DINPUT_REGISTER_FAIL = "DINPUT_REGISTER_FAIL"; 38 const std::string DINPUT_OPT_FAIL = "DINPUT_OPT_FAIL"; 39 const std::string DINPUT_UNREGISTER_FAIL = "DINPUT_UNREGISTER_FAIL"; 40 41 class HisyseventUtil { 42 DECLARE_SINGLE_INSTANCE_BASE(HisyseventUtil); 43 public: 44 void SysEventWriteBehavior(std::string status, std::string msg); 45 void SysEventWriteBehavior(std::string status, std::string devId, std::string msg); 46 void SysEventWriteBehavior(std::string status, std::string devId, std::string dhId, std::string msg); 47 void SysEventWriteFault(std::string status, std::string msg); 48 void SysEventWriteFault(std::string status, std::string devId, int32_t errorCode, std::string msg); 49 void SysEventWriteFault(std::string status, std::string devId, std::string dhId, int32_t errorCode, 50 std::string msg); 51 52 private: 53 HisyseventUtil() = default; 54 ~HisyseventUtil() = default; 55 }; 56 } // namespace DistributedInput 57 } // namespace DistributedHardware 58 } // namespace OHOS 59 60 #endif // OHOS_DISTRIBUTED_INPUT_HISYSEVENT_UTILS_H 61