1c29fa5a6Sopenharmony_ci/* 2c29fa5a6Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 3c29fa5a6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c29fa5a6Sopenharmony_ci * you may not use this file except in compliance with the License. 5c29fa5a6Sopenharmony_ci * You may obtain a copy of the License at 6c29fa5a6Sopenharmony_ci * 7c29fa5a6Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c29fa5a6Sopenharmony_ci * 9c29fa5a6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c29fa5a6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c29fa5a6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c29fa5a6Sopenharmony_ci * See the License for the specific language governing permissions and 13c29fa5a6Sopenharmony_ci * limitations under the License. 14c29fa5a6Sopenharmony_ci */ 15c29fa5a6Sopenharmony_ci 16c29fa5a6Sopenharmony_ci#ifndef COOPERATE_HISYSEVENT_H 17c29fa5a6Sopenharmony_ci#define COOPERATE_HISYSEVENT_H 18c29fa5a6Sopenharmony_ci 19c29fa5a6Sopenharmony_ci#include <map> 20c29fa5a6Sopenharmony_ci#include <string> 21c29fa5a6Sopenharmony_ci 22c29fa5a6Sopenharmony_ci#include "devicestatus_define.h" 23c29fa5a6Sopenharmony_ci#include "hisysevent.h" 24c29fa5a6Sopenharmony_ci 25c29fa5a6Sopenharmony_cinamespace OHOS { 26c29fa5a6Sopenharmony_cinamespace Msdp { 27c29fa5a6Sopenharmony_cinamespace DeviceStatus { 28c29fa5a6Sopenharmony_cienum CooperateType : int32_t { 29c29fa5a6Sopenharmony_ci ENABLE_SUCC = 0, 30c29fa5a6Sopenharmony_ci ENABLE_FAIL = 1, 31c29fa5a6Sopenharmony_ci DISABLE_SUCC = 2, 32c29fa5a6Sopenharmony_ci DISABLE_FAIL = 3, 33c29fa5a6Sopenharmony_ci LOCAL_ACTIVATE_SUCC = 4, 34c29fa5a6Sopenharmony_ci LOCAL_ACTIVATE_FAIL = 5, 35c29fa5a6Sopenharmony_ci REMOTE_ACTIVATE_SUCC = 6, 36c29fa5a6Sopenharmony_ci REMOTE_ACTIVATE_FAIL = 7, 37c29fa5a6Sopenharmony_ci LOCAL_DEACTIVATE_SUCC = 8, 38c29fa5a6Sopenharmony_ci LOCAL_DEACTIVATE_FAIL = 9, 39c29fa5a6Sopenharmony_ci REMOTE_DEACTIVATE_SUCC = 10, 40c29fa5a6Sopenharmony_ci REMOTE_DEACTIVATE_FAIL = 11, 41c29fa5a6Sopenharmony_ci OPENSESSION_SUCC = 12, 42c29fa5a6Sopenharmony_ci OPENSESSION_FAIL = 13, 43c29fa5a6Sopenharmony_ci UPDATESTATE_SUCC = 14, 44c29fa5a6Sopenharmony_ci START_SUCC = 15, 45c29fa5a6Sopenharmony_ci START_FAIL = 16, 46c29fa5a6Sopenharmony_ci STOP_SUCC = 17, 47c29fa5a6Sopenharmony_ci STOP_FAIL = 18, 48c29fa5a6Sopenharmony_ci}; 49c29fa5a6Sopenharmony_cienum CooperateState : size_t { 50c29fa5a6Sopenharmony_ci COOPERATE_STATE_FREE = 0, 51c29fa5a6Sopenharmony_ci COOPERATE_STATE_OUT, 52c29fa5a6Sopenharmony_ci COOPERATE_STATE_IN, 53c29fa5a6Sopenharmony_ci N_COOPERATE_STATES, 54c29fa5a6Sopenharmony_ci}; 55c29fa5a6Sopenharmony_ci 56c29fa5a6Sopenharmony_ciclass CooperateDFX { 57c29fa5a6Sopenharmony_cipublic: 58c29fa5a6Sopenharmony_ci 59c29fa5a6Sopenharmony_ci static int32_t WriteEnable(OHOS::HiviewDFX::HiSysEvent::EventType type); 60c29fa5a6Sopenharmony_ci static int32_t WriteDisable(OHOS::HiviewDFX::HiSysEvent::EventType type); 61c29fa5a6Sopenharmony_ci static int32_t WriteLocalStart(OHOS::HiviewDFX::HiSysEvent::EventType type); 62c29fa5a6Sopenharmony_ci static int32_t WriteLocalStop(OHOS::HiviewDFX::HiSysEvent::EventType type); 63c29fa5a6Sopenharmony_ci static int32_t WriteRemoteStart(OHOS::HiviewDFX::HiSysEvent::EventType type); 64c29fa5a6Sopenharmony_ci static int32_t WriteRemoteStop(OHOS::HiviewDFX::HiSysEvent::EventType type); 65c29fa5a6Sopenharmony_ci static int32_t WriteOpenSession(OHOS::HiviewDFX::HiSysEvent::EventType type); 66c29fa5a6Sopenharmony_ci static int32_t WriteStart(OHOS::HiviewDFX::HiSysEvent::EventType type); 67c29fa5a6Sopenharmony_ci static int32_t WriteStop(OHOS::HiviewDFX::HiSysEvent::EventType type); 68c29fa5a6Sopenharmony_ci static int32_t WriteCooperateState(CooperateState curState); 69c29fa5a6Sopenharmony_ci template<typename... Types> 70c29fa5a6Sopenharmony_ci static int32_t WriteInputFunc(const CooperateType &cooperateType, 71c29fa5a6Sopenharmony_ci OHOS::HiviewDFX::HiSysEvent::EventType eventType, Types... paras); 72c29fa5a6Sopenharmony_ci 73c29fa5a6Sopenharmony_ciprivate: 74c29fa5a6Sopenharmony_ci static std::map<CooperateState, std::string> CooperateState_; 75c29fa5a6Sopenharmony_ci static std::map<CooperateType, std::pair<std::string, std::string>> serialStr_; 76c29fa5a6Sopenharmony_ci}; 77c29fa5a6Sopenharmony_ci} // namespace DeviceStatus 78c29fa5a6Sopenharmony_ci} // namespace Msdp 79c29fa5a6Sopenharmony_ci} // namespace OHOS 80c29fa5a6Sopenharmony_ci#endif // COOPERATE_HISYSEVENT_H 81