1 /* 2 * Copyright (c) 2021-2025 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 OHOS_IDISTRIBUTED_HARDWARE_H 17 #define OHOS_IDISTRIBUTED_HARDWARE_H 18 19 #include <cstdint> 20 #include <string> 21 #include <unordered_map> 22 23 #include "iremote_broker.h" 24 #include "device_type.h" 25 #include "dhardware_descriptor.h" 26 #include "iget_dh_descriptors_callback.h" 27 #include "ihardware_status_listener.h" 28 29 #include "distributed_hardware_fwk_kit_paras.h" 30 #include "iav_trans_control_center_callback.h" 31 #include "ipublisher_listener.h" 32 33 namespace OHOS { 34 namespace DistributedHardware { 35 class IDistributedHardware : public OHOS::IRemoteBroker { 36 public: 37 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.distributedhardware.accessToken"); 38 IDistributedHardware() = default; 39 virtual ~IDistributedHardware() = default; 40 virtual int32_t RegisterPublisherListener(const DHTopic topic, const sptr<IPublisherListener> listener) = 0; 41 virtual int32_t UnregisterPublisherListener(const DHTopic topic, const sptr<IPublisherListener> listener) = 0; 42 virtual int32_t PublishMessage(const DHTopic topic, const std::string &msg) = 0; 43 virtual std::string QueryLocalSysSpec(QueryLocalSysSpecType spec) = 0; 44 45 virtual int32_t InitializeAVCenter(const TransRole &transRole, int32_t &engineId) = 0; 46 virtual int32_t ReleaseAVCenter(int32_t engineId) = 0; 47 virtual int32_t CreateControlChannel(int32_t engineId, const std::string &peerDevId) = 0; 48 virtual int32_t NotifyAVCenter(int32_t engineId, const AVTransEvent &event) = 0; 49 virtual int32_t RegisterCtlCenterCallback(int32_t engineId, 50 const sptr<IAvTransControlCenterCallback> callback) = 0; 51 virtual int32_t NotifySourceRemoteSinkStarted(std::string &deviceId) = 0; 52 virtual int32_t PauseDistributedHardware(DHType dhType, const std::string &networkId) = 0; 53 virtual int32_t ResumeDistributedHardware(DHType dhType, const std::string &networkId) = 0; 54 virtual int32_t StopDistributedHardware(DHType dhType, const std::string &networkId) = 0; 55 virtual int32_t GetDistributedHardware(const std::string &networkId, EnableStep enableStep, 56 const sptr<IGetDhDescriptorsCallback> callback) = 0; 57 virtual int32_t RegisterDHStatusListener(sptr<IHDSinkStatusListener> listener) = 0; 58 virtual int32_t UnregisterDHStatusListener(sptr<IHDSinkStatusListener> listener) = 0; 59 virtual int32_t RegisterDHStatusListener(const std::string &networkId, sptr<IHDSourceStatusListener> listener) = 0; 60 virtual int32_t UnregisterDHStatusListener(const std::string &networkId, 61 sptr<IHDSourceStatusListener> listener) = 0; 62 virtual int32_t EnableSink(const std::vector<DHDescriptor> &descriptors) = 0; 63 virtual int32_t DisableSink(const std::vector<DHDescriptor> &descriptors) = 0; 64 virtual int32_t EnableSource(const std::string &networkId, const std::vector<DHDescriptor> &descriptors) = 0; 65 virtual int32_t DisableSource(const std::string &networkId, const std::vector<DHDescriptor> &descriptors) = 0; 66 virtual int32_t LoadDistributedHDF(const DHType dhType) = 0; 67 virtual int32_t UnLoadDistributedHDF(const DHType dhType) = 0; 68 }; 69 } // namespace DistributedHardware 70 } // namespace OHOS 71 #endif // OHOS_IDISTRIBUTED_HARDWARE_H 72