diff --git a/hisysevent.yaml b/hisysevent.yaml index f90e4222e..3fa8bbf32 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -246,19 +246,19 @@ REMOTE_ACTIVATE_FAILED: __BASE: {type: FAULT, level: MINOR, tag: deviceStatus, desc: remote start cooperate} MSG: {type: STRING, desc: Remote start cooperate failed} -LOCAL_DISACTIVATE_SUCCESS: +LOCAL_DEACTIVATE_SUCCESS: __BASE: {type: BEHAVIOR, level: MINOR, tag: deviceStatus, desc: local stop cooperate} MSG: {type: STRING, desc: Local stop cooperate successfully} -LOCAL_DISACTIVATE_FAILED: +LOCAL_DEACTIVATE_FAILED: __BASE: {type: FAULT, level: MINOR, tag: deviceStatus, desc: local stop cooperate} MSG: {type: STRING, desc: Local stop cooperate failed} -REMOTE_DISACTIVATE_SUCCESS: +REMOTE_DEACTIVATE_SUCCESS: __BASE: {type: BEHAVIOR, level: MINOR, tag: deviceStatus, desc: remote stop cooperate} MSG: {type: STRING, desc: Remote stop cooperate successfully} -REMOTE_DISACTIVATE_FAILED: +REMOTE_DEACTIVATE_FAILED: __BASE: {type: FAULT, level: MINOR, tag: deviceStatus, desc: remote stop cooperate} MSG: {type: STRING, desc: Remote stop cooperate failed} diff --git a/intention/adapters/dsoftbus_adapter/BUILD.gn b/intention/adapters/dsoftbus_adapter/BUILD.gn index b05bdf45a..2cca75e54 100644 --- a/intention/adapters/dsoftbus_adapter/BUILD.gn +++ b/intention/adapters/dsoftbus_adapter/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2023-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/intention/adapters/dsoftbus_adapter/src/dsoftbus_adapter_impl.cpp b/intention/adapters/dsoftbus_adapter/src/dsoftbus_adapter_impl.cpp index 90f53a50e..1dc6dcf47 100644 --- a/intention/adapters/dsoftbus_adapter/src/dsoftbus_adapter_impl.cpp +++ b/intention/adapters/dsoftbus_adapter/src/dsoftbus_adapter_impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/intention/cooperate/client/BUILD.gn b/intention/cooperate/client/BUILD.gn index a7679b290..06d2ca1b9 100644 --- a/intention/cooperate/client/BUILD.gn +++ b/intention/cooperate/client/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2023-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/intention/cooperate/client/src/cooperate_client.cpp b/intention/cooperate/client/src/cooperate_client.cpp index d8ec8662a..594b12e8d 100644 --- a/intention/cooperate/client/src/cooperate_client.cpp +++ b/intention/cooperate/client/src/cooperate_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/intention/cooperate/plugin/BUILD.gn b/intention/cooperate/plugin/BUILD.gn index f4066dc60..58dc43544 100644 --- a/intention/cooperate/plugin/BUILD.gn +++ b/intention/cooperate/plugin/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2023-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/intention/cooperate/plugin/src/cooperate_context.cpp b/intention/cooperate/plugin/src/cooperate_context.cpp index 6af4607e6..7965d393d 100644 --- a/intention/cooperate/plugin/src/cooperate_context.cpp +++ b/intention/cooperate/plugin/src/cooperate_context.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/intention/cooperate/plugin/src/event_manager.cpp b/intention/cooperate/plugin/src/event_manager.cpp index 3cbff3b3f..c99f8f8c4 100644 --- a/intention/cooperate/plugin/src/event_manager.cpp +++ b/intention/cooperate/plugin/src/event_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/intention/cooperate/plugin/src/state_machine.cpp b/intention/cooperate/plugin/src/state_machine.cpp index 3c81b1e80..a1c1e9f48 100644 --- a/intention/cooperate/plugin/src/state_machine.cpp +++ b/intention/cooperate/plugin/src/state_machine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/intention/dfx/include/cooperate_hisysevent.h b/intention/dfx/include/cooperate_hisysevent.h index 1b59d9c3f..ab0c08124 100644 --- a/intention/dfx/include/cooperate_hisysevent.h +++ b/intention/dfx/include/cooperate_hisysevent.h @@ -34,10 +34,10 @@ enum CooperateType : int32_t { LOCAL_ACTIVATE_FAIL = 5, REMOTE_ACTIVATE_SUCC = 6, REMOTE_ACTIVATE_FAIL = 7, - LOCAL_DISACTIVATE_SUCC = 8, - LOCAL_DISACTIVATE_FAIL = 9, - REMOTE_DISACTIVATE_SUCC = 10, - REMOTE_DISACTIVATE_FAIL = 11, + LOCAL_DEACTIVATE_SUCC = 8, + LOCAL_DEACTIVATE_FAIL = 9, + REMOTE_DEACTIVATE_SUCC = 10, + REMOTE_DEACTIVATE_FAIL = 11, OPENSESSION_SUCC = 12, OPENSESSION_FAIL = 13, UPDATESTATE_SUCC = 14, @@ -65,9 +65,10 @@ public: static int32_t WriteOpenSession(OHOS::HiviewDFX::HiSysEvent::EventType type); static int32_t WriteStart(OHOS::HiviewDFX::HiSysEvent::EventType type); static int32_t WriteStop(OHOS::HiviewDFX::HiSysEvent::EventType type); - static int32_t WriteCooperateState(CooperateState currentSta); + static int32_t WriteCooperateState(CooperateState curState); template - static int32_t WriteInputFunc(const CooperateType &cooperateType, Types... paras); + static int32_t WriteInputFunc(const CooperateType &cooperateType, + OHOS::HiviewDFX::HiSysEvent::EventType eventType, Types... paras); private: static std::map CooperateState_; diff --git a/intention/dfx/src/cooperate_hisysevent.cpp b/intention/dfx/src/cooperate_hisysevent.cpp index 8885dfaf2..ae4625d8b 100644 --- a/intention/dfx/src/cooperate_hisysevent.cpp +++ b/intention/dfx/src/cooperate_hisysevent.cpp @@ -39,10 +39,10 @@ std::map> CooperateDFX::seria { CooperateType::LOCAL_ACTIVATE_FAIL, { "LOCAL_ACTIVATEE_FAILED", "Local start cooperate failed" } }, { CooperateType::REMOTE_ACTIVATE_SUCC, { "REMOTE_ACTIVATE_SUCCESS", "Remote start cooperate successfully" } }, { CooperateType::REMOTE_ACTIVATE_FAIL, { "REMOTE_ACTIVATE_FAILED", "Remote start cooperate failed" } }, - { CooperateType::LOCAL_DISACTIVATE_SUCC, { "LOCAL_DISACTIVATE_SUCCESS", "Local stop cooperate successfully" } }, - { CooperateType::LOCAL_DISACTIVATE_FAIL, { "LOCAL_DISACTIVATE_FAILED", "Local stop cooperate failed" } }, - { CooperateType::REMOTE_DISACTIVATE_SUCC, { "REMOTE_DISACTIVATE_SUCCESS", "Remote stop cooperate successfully" } }, - { CooperateType::REMOTE_DISACTIVATE_FAIL, { "REMOTE_DISACTIVATE_FAILED", "Remote stop cooperate failed" } }, + { CooperateType::LOCAL_DEACTIVATE_SUCC, { "LOCAL_DEACTIVATE_SUCCESS", "Local stop cooperate successfully" } }, + { CooperateType::LOCAL_DEACTIVATE_FAIL, { "LOCAL_DEACTIVATE_FAILED", "Local stop cooperate failed" } }, + { CooperateType::REMOTE_DEACTIVATE_SUCC, { "REMOTE_DEACTIVATE_SUCCESS", "Remote stop cooperate successfully" } }, + { CooperateType::REMOTE_DEACTIVATE_FAIL, { "REMOTE_DEACTIVATE_FAILED", "Remote stop cooperate failed" } }, { CooperateType::OPENSESSION_SUCC, { "OPENSESSION_SUCCESS", "Open session successfully" } }, { CooperateType::OPENSESSION_FAIL, { "OPENSESSION_FAILED", "Open session failed" } }, { CooperateType::UPDATESTATE_SUCC, { "UPDATESTATE_SUCCESS", "Update cooperatestate successfully" } }, @@ -54,15 +54,14 @@ std::map> CooperateDFX::seria template -int32_t CooperateDFX::WriteInputFunc(const CooperateType &cooperateType, Types... paras) +int32_t CooperateDFX::WriteInputFunc(const CooperateType &cooperateType, + OHOS::HiviewDFX::HiSysEvent::EventType eventType, Types... paras) { if (serialStr_.find(cooperateType) == serialStr_.end()) { FI_HILOGE("serialStr_ can't find the cooperate hisysevent type"); return RET_ERR; } auto &[label, dec] = serialStr_[cooperateType]; - OHOS::HiviewDFX::HiSysEvent::EventType eventType = (static_cast(cooperateType) & 1) ? - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT : OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR; int32_t ret = HiSysEventWrite( OHOS::HiviewDFX::HiSysEvent::Domain::MSDP, label, @@ -79,86 +78,87 @@ int32_t CooperateDFX::WriteInputFunc(const CooperateType &cooperateType, Types.. int32_t CooperateDFX::WriteEnable(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::ENABLE_SUCC); + return WriteInputFunc(CooperateType::ENABLE_SUCC, type); } - return WriteInputFunc(CooperateType::ENABLE_FAIL); + return WriteInputFunc(CooperateType::ENABLE_FAIL, type); } int32_t CooperateDFX::WriteDisable(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::DISABLE_SUCC); + return WriteInputFunc(CooperateType::DISABLE_SUCC, type); } - return WriteInputFunc(CooperateType::DISABLE_FAIL); + return WriteInputFunc(CooperateType::DISABLE_FAIL, type); } int32_t CooperateDFX::WriteLocalStart(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::LOCAL_ACTIVATE_SUCC); + return WriteInputFunc(CooperateType::LOCAL_ACTIVATE_SUCC, type); } - return WriteInputFunc(CooperateType::LOCAL_ACTIVATE_FAIL); + return WriteInputFunc(CooperateType::LOCAL_ACTIVATE_FAIL, type); } int32_t CooperateDFX::WriteRemoteStart(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::REMOTE_ACTIVATE_SUCC); + return WriteInputFunc(CooperateType::REMOTE_ACTIVATE_SUCC, type); } - return WriteInputFunc(CooperateType::REMOTE_ACTIVATE_FAIL); + return WriteInputFunc(CooperateType::REMOTE_ACTIVATE_FAIL, type); } int32_t CooperateDFX::WriteLocalStop(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::LOCAL_DISACTIVATE_SUCC); + return WriteInputFunc(CooperateType::LOCAL_DEACTIVATE_SUCC, type); } - return WriteInputFunc(CooperateType::LOCAL_DISACTIVATE_FAIL); + return WriteInputFunc(CooperateType::LOCAL_DEACTIVATE_FAIL, type); } int32_t CooperateDFX::WriteRemoteStop(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::REMOTE_ACTIVATE_SUCC); + return WriteInputFunc(CooperateType::REMOTE_ACTIVATE_SUCC, type); } - return WriteInputFunc(CooperateType::REMOTE_DISACTIVATE_FAIL); + return WriteInputFunc(CooperateType::REMOTE_DEACTIVATE_FAIL, type); } int32_t CooperateDFX::WriteOpenSession(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::OPENSESSION_SUCC); + return WriteInputFunc(CooperateType::OPENSESSION_SUCC, type); } - return WriteInputFunc(CooperateType::OPENSESSION_FAIL); + return WriteInputFunc(CooperateType::OPENSESSION_FAIL, type); } int32_t CooperateDFX::WriteStart(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::START_SUCC); + return WriteInputFunc(CooperateType::START_SUCC, type); } - return WriteInputFunc(CooperateType::START_FAIL); + return WriteInputFunc(CooperateType::START_FAIL, type); } int32_t CooperateDFX::WriteStop(OHOS::HiviewDFX::HiSysEvent::EventType type) { if (type == OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR) { - return WriteInputFunc(CooperateType::STOP_SUCC); + return WriteInputFunc(CooperateType::STOP_SUCC, type); } - return WriteInputFunc(CooperateType::STOP_FAIL); + return WriteInputFunc(CooperateType::STOP_FAIL, type); } -int32_t CooperateDFX::WriteCooperateState(CooperateState currentSta) +int32_t CooperateDFX::WriteCooperateState(CooperateState curState) { - if (currentSta != CooperateState::N_COOPERATE_STATUS) { + if (curState != CooperateState::N_COOPERATE_STATUS) { return RET_ERR; } - if (CooperateState_.find(currentSta) == CooperateState_.end()) { + if (CooperateState_.find(curState) == CooperateState_.end()) { FI_HILOGE("CooperateState_ can't find the current cooperate state"); return RET_ERR; } - std::string curState = CooperateState_[currentSta]; - return WriteInputFunc(CooperateType::UPDATESTATE_SUCC, "CurrentState", curState); + auto type = OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR; + std::string currentState = CooperateState_[curState]; + return WriteInputFunc(CooperateType::UPDATESTATE_SUCC, type,"CurrentState", currentState); } } // namespace DeviceStatus } // namespace Msdp