1f857971dSopenharmony_ci/* 2f857971dSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3f857971dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4f857971dSopenharmony_ci * you may not use this file except in compliance with the License. 5f857971dSopenharmony_ci * You may obtain a copy of the License at 6f857971dSopenharmony_ci * 7f857971dSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8f857971dSopenharmony_ci * 9f857971dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10f857971dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11f857971dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12f857971dSopenharmony_ci * See the License for the specific language governing permissions and 13f857971dSopenharmony_ci * limitations under the License. 14f857971dSopenharmony_ci */ 15f857971dSopenharmony_ci 16f857971dSopenharmony_ci#ifndef INTENTION_DRAG_CLIENT_H 17f857971dSopenharmony_ci#define INTENTION_DRAG_CLIENT_H 18f857971dSopenharmony_ci 19f857971dSopenharmony_ci#include "nocopyable.h" 20f857971dSopenharmony_ci 21f857971dSopenharmony_ci#include <set> 22f857971dSopenharmony_ci 23f857971dSopenharmony_ci#include "i_drag_listener.h" 24f857971dSopenharmony_ci#include "i_subscript_listener.h" 25f857971dSopenharmony_ci#include "i_tunnel_client.h" 26f857971dSopenharmony_ci#include "i_start_drag_listener.h" 27f857971dSopenharmony_ci#include "socket_client.h" 28f857971dSopenharmony_ci#include "transaction/rs_transaction.h" 29f857971dSopenharmony_ci 30f857971dSopenharmony_cinamespace OHOS { 31f857971dSopenharmony_cinamespace Msdp { 32f857971dSopenharmony_cinamespace DeviceStatus { 33f857971dSopenharmony_ciclass DragClient final { 34f857971dSopenharmony_cipublic: 35f857971dSopenharmony_ci DragClient() = default; 36f857971dSopenharmony_ci ~DragClient() = default; 37f857971dSopenharmony_ci DISALLOW_COPY_AND_MOVE(DragClient); 38f857971dSopenharmony_ci 39f857971dSopenharmony_ci int32_t StartDrag(ITunnelClient &tunnel, const DragData &dragData, std::shared_ptr<IStartDragListener> listener); 40f857971dSopenharmony_ci int32_t StopDrag(ITunnelClient &tunnel, const DragDropResult &dropResult); 41f857971dSopenharmony_ci int32_t AddDraglistener(ITunnelClient &tunnel, DragListenerPtr listener, bool isJsCaller = false); 42f857971dSopenharmony_ci int32_t RemoveDraglistener(ITunnelClient &tunnel, DragListenerPtr listener, bool isJsCaller = false); 43f857971dSopenharmony_ci int32_t AddSubscriptListener(ITunnelClient &tunnel, SubscriptListenerPtr listener); 44f857971dSopenharmony_ci int32_t RemoveSubscriptListener(ITunnelClient &tunnel, SubscriptListenerPtr listener); 45f857971dSopenharmony_ci int32_t SetDragWindowVisible(ITunnelClient &tunnel, bool visible, bool isForce); 46f857971dSopenharmony_ci int32_t UpdateDragStyle(ITunnelClient &tunnel, DragCursorStyle style, int32_t eventId = -1); 47f857971dSopenharmony_ci int32_t UpdateShadowPic(ITunnelClient &tunnel, const ShadowInfo &shadowInfo); 48f857971dSopenharmony_ci int32_t GetDragTargetPid(ITunnelClient &tunnel); 49f857971dSopenharmony_ci int32_t GetUdKey(ITunnelClient &tunnel, std::string &udKey); 50f857971dSopenharmony_ci int32_t GetShadowOffset(ITunnelClient &tunnel, ShadowOffset &shadowOffset); 51f857971dSopenharmony_ci int32_t GetDragData(ITunnelClient &tunnel, DragData &dragData); 52f857971dSopenharmony_ci int32_t UpdatePreviewStyle(ITunnelClient &tunnel, const PreviewStyle &previewStyle); 53f857971dSopenharmony_ci int32_t UpdatePreviewStyleWithAnimation(ITunnelClient &tunnel, 54f857971dSopenharmony_ci const PreviewStyle &previewStyle, const PreviewAnimation &animation); 55f857971dSopenharmony_ci int32_t RotateDragWindowSync(ITunnelClient &tunnel, 56f857971dSopenharmony_ci const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr); 57f857971dSopenharmony_ci int32_t SetDragWindowScreenId(ITunnelClient &tunnel, uint64_t displayId, uint64_t screenId); 58f857971dSopenharmony_ci int32_t GetDragSummary(ITunnelClient &tunnel, std::map<std::string, int64_t> &summary, 59f857971dSopenharmony_ci bool isJsCaller = false); 60f857971dSopenharmony_ci int32_t GetDragState(ITunnelClient &tunnel, DragState &dragState); 61f857971dSopenharmony_ci int32_t EnableUpperCenterMode(ITunnelClient &tunnel, bool enable); 62f857971dSopenharmony_ci int32_t GetDragAction(ITunnelClient &tunnel, DragAction &dragAction); 63f857971dSopenharmony_ci int32_t GetExtraInfo(ITunnelClient &tunnel, std::string &extraInfo); 64f857971dSopenharmony_ci int32_t AddPrivilege(ITunnelClient &tunnel); 65f857971dSopenharmony_ci int32_t EraseMouseIcon(ITunnelClient &tunnel); 66f857971dSopenharmony_ci int32_t AddSelectedPixelMap(ITunnelClient &tunnel, std::shared_ptr<OHOS::Media::PixelMap> pixelMap, 67f857971dSopenharmony_ci std::function<void(bool)> callback); 68f857971dSopenharmony_ci int32_t SetMouseDragMonitorState(ITunnelClient &tunnel, bool state); 69f857971dSopenharmony_ci 70f857971dSopenharmony_ci int32_t OnNotifyResult(const StreamClient &client, NetPacket &pkt); 71f857971dSopenharmony_ci int32_t OnNotifyHideIcon(const StreamClient& client, NetPacket& pkt); 72f857971dSopenharmony_ci int32_t OnStateChangedMessage(const StreamClient &client, NetPacket &pkt); 73f857971dSopenharmony_ci int32_t OnDragStyleChangedMessage(const StreamClient &client, NetPacket &pkt); 74f857971dSopenharmony_ci int32_t OnAddSelectedPixelMapResult(const StreamClient &client, NetPacket &pkt); 75f857971dSopenharmony_ci void OnConnected(ITunnelClient &tunnel); 76f857971dSopenharmony_ci void OnDisconnected(ITunnelClient &tunnel); 77f857971dSopenharmony_ci 78f857971dSopenharmony_ciprivate: 79f857971dSopenharmony_ci mutable std::mutex mtx_; 80f857971dSopenharmony_ci std::shared_ptr<IStartDragListener> startDragListener_ { nullptr }; 81f857971dSopenharmony_ci bool hasRegistered_ { false }; 82f857971dSopenharmony_ci bool hasSubscriptRegistered_ { false }; 83f857971dSopenharmony_ci std::set<DragListenerPtr> dragListeners_; 84f857971dSopenharmony_ci std::set<DragListenerPtr> connectedDragListeners_; 85f857971dSopenharmony_ci std::set<SubscriptListenerPtr> subscriptListeners_; 86f857971dSopenharmony_ci std::function<void(bool)> addSelectedPixelMapCallback_; 87f857971dSopenharmony_ci}; 88f857971dSopenharmony_ci} // namespace DeviceStatus 89f857971dSopenharmony_ci} // namespace Msdp 90f857971dSopenharmony_ci} // namespace OHOS 91f857971dSopenharmony_ci#endif // INTENTION_DRAG_CLIENT_H 92