• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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_stub.h"
23 
24 namespace OHOS {
25 namespace DistributedHardware {
26 class DAudioSinkService : public SystemAbility, public DAudioSinkStub {
27 DECLARE_SYSTEM_ABILITY(DAudioSinkService);
28 
29 public:
30     DAudioSinkService(int32_t saId, bool runOnCreate);
31     ~DAudioSinkService() override = default;
32 
33     int32_t InitSink(const std::string &params) override;
34     int32_t ReleaseSink() override;
35     int32_t SubscribeLocalHardware(const std::string &dhId, const std::string &param) override;
36     int32_t UnsubscribeLocalHardware(const std::string &dhId) override;
37     void DAudioNotify(const std::string &devId, const std::string &dhId, const int32_t eventType,
38         const std::string &eventContent) override;
39 
40 protected:
41     void OnStart() override;
42     void OnStop() override;
43     DISALLOW_COPY_AND_MOVE(DAudioSinkService);
44 
45 private:
46     bool Init();
47 
48 private:
49     bool isServiceStarted_ = false;
50 };
51 } // DistributedHardware
52 } // OHOS
53 #endif // OHOS_DAUDIO_SINK_SERVICE_H