1 /* 2 * Copyright (c) 2022 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 MULTIMODAL_INPUT_CONNECT_REMOTER_H 17 #define MULTIMODAL_INPUT_CONNECT_REMOTER_H 18 19 #include <map> 20 #include <memory> 21 #include <string> 22 23 #include "nocopyable.h" 24 25 #include "i_multimodal_input_connect.h" 26 27 namespace OHOS { 28 namespace MMI { 29 class MultimodalInputConnectRemoter : public std::enable_shared_from_this<MultimodalInputConnectRemoter> { 30 public: 31 virtual ~MultimodalInputConnectRemoter() = default; 32 static std::shared_ptr<MultimodalInputConnectRemoter> GetInstance(); 33 int32_t StartRemoteCooperate(const std::string &localDeviceId, const std::string &remoteDeviceId); 34 int32_t StartRemoteCooperateResult(const std::string &remoteDeviceId, bool isSuccess, 35 const std::string &startDhid, int32_t xPercent, int32_t yPercent); 36 int32_t StopRemoteCooperate(const std::string &remoteDeviceId); 37 int32_t StopRemoteCooperateResult(const std::string &remoteDeviceId, bool isSuccess); 38 int32_t StartCooperateOtherResult(const std::string &remoteDeviceId, const std::string &srcNetworkId); 39 40 private: 41 MultimodalInputConnectRemoter() = default; 42 DISALLOW_COPY_AND_MOVE(MultimodalInputConnectRemoter); 43 44 sptr<IMultimodalInputConnect> GetProxyById(const std::string &remoteDeviceId); 45 void OnRemoteDeath(const std::string &remoteDeviceId); 46 std::mutex lock_; 47 std::map<std::string, sptr<IMultimodalInputConnect>> mmiRemoteServices_; 48 std::map<std::string, sptr<IRemoteObject::DeathRecipient>> mmiDeathRecipients_; 49 }; 50 } // namespace MMI 51 } // namespace OHOS 52 #define RemoteMgr MultimodalInputConnectRemoter::GetInstance() 53 #endif // MULTIMODAL_INPUT_CONNECT_REMOTER_H 54