1 /*
2  * Copyright (c) 2024 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 INFRARED_EMMITTER_CONTROLLER_H
17 #define INFRARED_EMMITTER_CONTROLLER_H
18 
19 #include "nocopyable.h"
20 #include "infrared_emitter_def.h"
21 
22 namespace OHOS {
23 namespace MMI {
24 using namespace OHOS::HDI::V1_0;
25 struct InfraredFrequencyInfo {
26     int64_t max_ { 0 };
27     int64_t min_ { 0 };
28 };
29 class InfraredEmitterController {
30 public:
31     /**
32      * @brief Obtains an <b>InfraredEmitterController</b> instance.
33      * @return Returns the pointer to the <b>InfraredEmitterController</b> instance.
34      * @since 12
35      */
36     static InfraredEmitterController *GetInstance();
37     virtual ~InfraredEmitterController();
38     void InitInfraredEmitter();
39     bool Transmit(int64_t carrierFreq, const std::vector<int64_t> pattern);
40     bool GetFrequencies(std::vector<InfraredFrequencyInfo> &frequencyInfo);
41 
42 private:
43     InfraredEmitterController();
44     DISALLOW_COPY_AND_MOVE(InfraredEmitterController);
45     static InfraredEmitterController *instance_;
46     ConsumerIr *irInterface_ {nullptr};
47     void *soIrHandle_ {nullptr};
48 };
49 }
50 }
51 #endif // INFRARED_EMMITTER_CONTROLLER_H