1 /* 2 * Copyright (c) 2021 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 26 #include "ipublisher_listener.h" 27 28 namespace OHOS { 29 namespace DistributedHardware { 30 class IDistributedHardware : public OHOS::IRemoteBroker { 31 public: 32 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.distributedhardware.distributedhardwarefwk"); 33 IDistributedHardware() = default; 34 virtual ~IDistributedHardware() = default; 35 virtual int32_t RegisterPublisherListener(const DHTopic topic, const sptr<IPublisherListener> &listener) = 0; 36 virtual int32_t UnregisterPublisherListener(const DHTopic topic, const sptr<IPublisherListener> &listener) = 0; 37 virtual int32_t PublishMessage(const DHTopic topic, const std::string &msg) = 0; 38 public: 39 enum class Message : uint32_t { 40 REG_PUBLISHER_LISTNER = 1, 41 UNREG_PUBLISHER_LISTENER = 2, 42 PUBLISH_MESSAGE = 3 43 }; 44 }; 45 } // namespace DistributedHardware 46 } // namespace OHOS 47 #endif // OHOS_IDISTRIBUTED_HARDWARE_H 48