1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "VirtualProgram.h"
20 
21 #include <vector>
22 
23 namespace aidl::android::hardware::broadcastradio {
24 
25 /**
26  * A radio frequency space mock.
27  *
28  * This represents all broadcast waves in the air for a given radio technology,
29  * not a captured station list in the radio tuner memory.
30  *
31  * It's meant to abstract out radio content from default tuner implementation.
32  */
33 class VirtualRadio final {
34   public:
35     VirtualRadio(const std::string& name, const std::vector<VirtualProgram>& initialList);
36     std::string getName() const;
37     const std::vector<VirtualProgram>& getProgramList() const;
38     bool getProgram(const ProgramSelector& selector, VirtualProgram* program) const;
39     std::vector<IdentifierType> getSupportedIdentifierTypes() const;
40 
41     static const VirtualRadio& getAmFmRadio();
42     static const VirtualRadio& getDabRadio();
43 
44   private:
45     const std::string mName;
46     std::vector<VirtualProgram> mPrograms;
47 };
48 
49 }  // namespace aidl::android::hardware::broadcastradio
50