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 OHOS_DAUDIO_SOURCE_SERVICE_H 17 #define OHOS_DAUDIO_SOURCE_SERVICE_H 18 19 #include <vector> 20 21 #include "ipc_object_stub.h" 22 #include "system_ability.h" 23 24 #include "daudio_hidumper.h" 25 #include "daudio_source_stub.h" 26 #include "idaudio_ipc_callback.h" 27 28 namespace OHOS { 29 namespace DistributedHardware { 30 class DAudioSourceService : public SystemAbility, public DAudioSourceStub { 31 DECLARE_SYSTEM_ABILITY(DAudioSourceService); 32 33 public: DAudioSourceService(int32_t saId,bool runOnCreate)34 DAudioSourceService(int32_t saId, bool runOnCreate) : SystemAbility(saId, runOnCreate) {}; 35 ~DAudioSourceService() override = default; 36 37 int32_t InitSource(const std::string ¶ms, const sptr<IDAudioIpcCallback> &callback) override; 38 int32_t ReleaseSource() override; 39 int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, const EnableParam ¶m, 40 const std::string &reqId) override; 41 int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, 42 const std::string &reqId) override; 43 int32_t ConfigDistributedHardware(const std::string &devId, const std::string &dhId, const std::string &key, 44 const std::string &value) override; 45 void DAudioNotify(const std::string &devId, const std::string &dhId, const int32_t eventType, 46 const std::string &eventContent) override; 47 int Dump(int32_t fd, const std::vector<std::u16string>& args) override; 48 49 protected: 50 void OnStart() override; 51 void OnStop() override; 52 DISALLOW_COPY_AND_MOVE(DAudioSourceService); 53 54 private: 55 bool Init(); 56 57 private: 58 bool isServiceStarted_ = false; 59 }; 60 } // DistributedHardware 61 } // OHOS 62 #endif // OHOS_DAUDIO_SOURCE_SERVICE_H 63