• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 #include "interaction_manager.h"
17 
18 #include "devicestatus_define.h"
19 #include "drag_data.h"
20 #include "interaction_manager_impl.h"
21 
22 namespace OHOS {
23 namespace Msdp {
24 namespace DeviceStatus {
25 
26 InteractionManager *InteractionManager::instance_ = new (std::nothrow) InteractionManager();
27 
GetInstance()28 InteractionManager *InteractionManager::GetInstance()
29 {
30     return instance_;
31 }
32 
RegisterCoordinationListener(std::shared_ptr<ICoordinationListener> listener)33 int32_t InteractionManager::RegisterCoordinationListener(std::shared_ptr<ICoordinationListener> listener)
34 {
35     return INTER_MGR_IMPL.RegisterCoordinationListener(listener);
36 }
37 
UnregisterCoordinationListener(std::shared_ptr<ICoordinationListener> listener)38 int32_t InteractionManager::UnregisterCoordinationListener(std::shared_ptr<ICoordinationListener> listener)
39 {
40     return INTER_MGR_IMPL.UnregisterCoordinationListener(listener);
41 }
42 
PrepareCoordination(std::function<void (const std::string &,CoordinationMessage)> callback)43 int32_t InteractionManager::PrepareCoordination(std::function<void(const std::string&, CoordinationMessage)> callback)
44 {
45     return INTER_MGR_IMPL.PrepareCoordination(callback);
46 }
47 
UnprepareCoordination(std::function<void (const std::string &,CoordinationMessage)> callback)48 int32_t InteractionManager::UnprepareCoordination(std::function<void(const std::string&, CoordinationMessage)> callback)
49 {
50     return INTER_MGR_IMPL.UnprepareCoordination(callback);
51 }
52 
ActivateCoordination(const std::string & remoteNetworkId,int32_t startDeviceId,std::function<void (const std::string &,CoordinationMessage)> callback)53 int32_t InteractionManager::ActivateCoordination(const std::string &remoteNetworkId, int32_t startDeviceId,
54     std::function<void(const std::string&, CoordinationMessage)> callback)
55 {
56     return INTER_MGR_IMPL.ActivateCoordination(remoteNetworkId, startDeviceId, callback);
57 }
58 
DeactivateCoordination(bool isUnchained,std::function<void (const std::string &,CoordinationMessage)> callback)59 int32_t InteractionManager::DeactivateCoordination(bool isUnchained,
60     std::function<void(const std::string&, CoordinationMessage)> callback)
61 {
62     return INTER_MGR_IMPL.DeactivateCoordination(isUnchained, callback);
63 }
64 
GetCoordinationState(const std::string & deviceId,std::function<void (bool)> callback)65 int32_t InteractionManager::GetCoordinationState(
66     const std::string &deviceId, std::function<void(bool)> callback)
67 {
68     return INTER_MGR_IMPL.GetCoordinationState(deviceId, callback);
69 }
70 
UpdateDragStyle(DragCursorStyle style)71 int32_t InteractionManager::UpdateDragStyle(DragCursorStyle style)
72 {
73     return INTER_MGR_IMPL.UpdateDragStyle(style);
74 }
75 
StartDrag(const DragData & dragData,std::function<void (const DragNotifyMsg &)> callback)76 int32_t InteractionManager::StartDrag(const DragData &dragData, std::function<void(const DragNotifyMsg&)> callback)
77 {
78     return INTER_MGR_IMPL.StartDrag(dragData, callback);
79 }
80 
StopDrag(DragResult result,bool hasCustomAnimation)81 int32_t InteractionManager::StopDrag(DragResult result, bool hasCustomAnimation)
82 {
83     return INTER_MGR_IMPL.StopDrag(result, hasCustomAnimation);
84 }
85 
GetDragTargetPid()86 int32_t InteractionManager::GetDragTargetPid()
87 {
88     return INTER_MGR_IMPL.GetDragTargetPid();
89 }
90 
GetUdKey(std::string & udKey)91 int32_t InteractionManager::GetUdKey(std::string &udKey)
92 {
93     return INTER_MGR_IMPL.GetUdKey(udKey);
94 }
95 
AddDraglistener(DragListenerPtr listener)96 int32_t InteractionManager::AddDraglistener(DragListenerPtr listener)
97 {
98     return INTER_MGR_IMPL.AddDraglistener(listener);
99 }
100 
RemoveDraglistener(DragListenerPtr listener)101 int32_t InteractionManager::RemoveDraglistener(DragListenerPtr listener)
102 {
103     return INTER_MGR_IMPL.RemoveDraglistener(listener);
104 }
105 
SetDragWindowVisible(bool visible)106 int32_t InteractionManager::SetDragWindowVisible(bool visible)
107 {
108     return INTER_MGR_IMPL.SetDragWindowVisible(visible);
109 }
110 
GetShadowOffset(int32_t & offsetX,int32_t & offsetY,int32_t & width,int32_t & height)111 int32_t InteractionManager::GetShadowOffset(int32_t& offsetX, int32_t& offsetY, int32_t& width, int32_t& height)
112 {
113     return INTER_MGR_IMPL.GetShadowOffset(offsetX, offsetY, width, height);
114 }
115 
UpdateShadowPic(const ShadowInfo & shadowInfo)116 int32_t InteractionManager::UpdateShadowPic(const ShadowInfo &shadowInfo)
117 {
118     return INTER_MGR_IMPL.UpdateShadowPic(shadowInfo);
119 }
120 } // namespace DeviceStatus
121 } // namespace Msdp
122 } // namespace OHOS
123