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 #ifndef OHOS_DAUDIO_SINK_SERVICE_H 17 #define OHOS_DAUDIO_SINK_SERVICE_H 18 19 #include "system_ability.h" 20 #include "ipc_object_stub.h" 21 22 #include "daudio_sink_hidumper.h" 23 #include "daudio_sink_stub.h" 24 25 namespace OHOS { 26 namespace DistributedHardware { 27 class DAudioSinkService : public SystemAbility, public DAudioSinkStub { 28 DECLARE_SYSTEM_ABILITY(DAudioSinkService); 29 30 public: 31 DAudioSinkService(int32_t saId, bool runOnCreate); 32 ~DAudioSinkService() override = default; 33 34 int32_t InitSink(const std::string ¶ms, const sptr<IDAudioSinkIpcCallback> &sinkCallback) override; 35 int32_t ReleaseSink() override; 36 int32_t SubscribeLocalHardware(const std::string &dhId, const std::string ¶m) override; 37 int32_t UnsubscribeLocalHardware(const std::string &dhId) override; 38 void DAudioNotify(const std::string &devId, const std::string &dhId, const int32_t eventType, 39 const std::string &eventContent) override; 40 int Dump(int32_t fd, const std::vector<std::u16string>& args) override; 41 int32_t PauseDistributedHardware(const std::string &networkId) override; 42 int32_t ResumeDistributedHardware(const std::string &networkId) override; 43 int32_t StopDistributedHardware(const std::string &networkId) override; 44 45 protected: 46 void OnStart() override; 47 void OnStop() override; 48 DISALLOW_COPY_AND_MOVE(DAudioSinkService); 49 50 private: 51 bool Init(); 52 53 private: 54 bool isServiceStarted_ = false; 55 }; 56 } // DistributedHardware 57 } // OHOS 58 #endif // OHOS_DAUDIO_SINK_SERVICE_H