1 /* 2 * Copyright (c) 2023 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 DRAG_HISYSEVENT_H 17 #define DRAG_HISYSEVENT_H 18 19 #include <map> 20 #include <string> 21 22 #include "devicestatus_define.h" 23 #include "drag_data.h" 24 #include "hisysevent.h" 25 26 namespace OHOS { 27 namespace Msdp { 28 namespace DeviceStatus { 29 30 enum DragType : int32_t { 31 STA_DRAG_SUCC = 0, 32 STA_DRAG_FAIL = 1, 33 SET_DRAG_WINDOW_SUCC = 2, 34 SET_DRAG_WINDOW_FAIL = 3, 35 UPDATE_DRAG_STYLE_SUCC = 4, 36 UPDATE_DRAG_STYLE_FAIL = 5, 37 SEND_TOKENID = 7, 38 STOP_DRAG_SUCC = 8, 39 STOP_DRAG_FAIL = 9, 40 NOTIFY_DRAG_RESULT_SUCC = 10, 41 NOTIFY_DRAG_RESULT_FAIL = 11 42 }; 43 44 class DragDFX { 45 public: 46 static int32_t WriteStartDrag(const DragState &dragState, OHOS::HiviewDFX::HiSysEvent::EventType type); 47 static int32_t WriteDragWindowVisible(const DragState &dragState, bool visible, 48 OHOS::HiviewDFX::HiSysEvent::EventType type); 49 static int32_t WriteUpdateDragStyle(const DragCursorStyle &style, OHOS::HiviewDFX::HiSysEvent::EventType type); 50 static int32_t WriteSendTokenid(int32_t targetTid, const std::string &udKey); 51 static int32_t WriteStopDrag(const DragState &dragState, const DragDropResult &dropResult, 52 OHOS::HiviewDFX::HiSysEvent::EventType type); 53 static int32_t WriteNotifyDragResult(const DragResult &result, OHOS::HiviewDFX::HiSysEvent::EventType type); 54 55 template<typename... Types> 56 static int32_t WriteModel(const DragType &dragType, Types... paras); 57 58 private: 59 static std::map<DragState, std::string> dragState_; 60 static std::map<DragCursorStyle, std::string> dragStyle_; 61 static std::map<DragResult, std::string> dragResult_; 62 static std::map<DragType, std::pair<std::string, std::string>> serialStr_; 63 }; 64 } // namespace DeviceStatus 65 } // namespace Msdp 66 } // namespace OHOS 67 #endif // DEVICESTATUS_HISYSEVENT_H 68