blob: 6fa70c5d1696ac603ee6beed815b4b9bc73bd895 [file] [log] [blame]
Tomasz Wasilczyk06100b32017-12-04 09:53:32 -08001/*
2 * Copyright (C) 2017 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#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V2_0_VIRTUALRADIO_H
17#define ANDROID_HARDWARE_BROADCASTRADIO_V2_0_VIRTUALRADIO_H
18
19#include "VirtualProgram.h"
20
21#include <mutex>
22#include <vector>
23
24namespace android {
25namespace hardware {
26namespace broadcastradio {
27namespace V2_0 {
28namespace implementation {
29
30/**
31 * A radio frequency space mock.
32 *
33 * This represents all broadcast waves in the air for a given radio technology,
34 * not a captured station list in the radio tuner memory.
35 *
36 * It's meant to abstract out radio content from default tuner implementation.
37 */
38class VirtualRadio {
39 public:
40 VirtualRadio(const std::string& name, const std::vector<VirtualProgram>& initialList);
41
42 std::string getName() const;
43 std::vector<VirtualProgram> getProgramList() const;
44 bool getProgram(const ProgramSelector& selector, VirtualProgram& program) const;
45
46 private:
47 mutable std::mutex mMut;
48 std::string mName;
49 std::vector<VirtualProgram> mPrograms;
50};
51
52/** AM/FM virtual radio space. */
53extern VirtualRadio gAmFmRadio;
54
Allief62374d2019-02-19 16:21:51 -080055/** DAB virtual radio space. */
56extern VirtualRadio gDabRadio;
57
Tomasz Wasilczyk06100b32017-12-04 09:53:32 -080058} // namespace implementation
59} // namespace V2_0
60} // namespace broadcastradio
61} // namespace hardware
62} // namespace android
63
64#endif // ANDROID_HARDWARE_BROADCASTRADIO_V2_0_VIRTUALRADIO_H