blob: 6764d82a0a4632fbf43fb196d60ba6df25ebe1ef [file] [log] [blame]
Eric Laurenta1745882016-11-21 10:41:22 -08001/*
2 * Copyright (C) 2016 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 */
Steven Morelandd6e4f032016-11-28 18:37:07 -080016#ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H
17#define ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H
Eric Laurenta1745882016-11-21 10:41:22 -080018
19#include <android/hardware/broadcastradio/1.0/IBroadcastRadio.h>
20#include <hidl/Status.h>
21#include <hardware/radio.h>
22
23#include <hidl/MQDescriptor.h>
24namespace android {
25namespace hardware {
26namespace broadcastradio {
27namespace V1_0 {
28namespace implementation {
29
30struct BroadcastRadio : public IBroadcastRadio {
31
32 BroadcastRadio(Class classId);
33
34 // Methods from ::android::hardware::broadcastradio::V1_0::IBroadcastRadio follow.
35 Return<void> getProperties(getProperties_cb _hidl_cb) override;
36 Return<void> openTuner(const BandConfig& config, bool audio,
37 const sp<ITunerCallback>& callback,
38 openTuner_cb _hidl_cb) override;
39
40
41 // RefBase
42 virtual void onFirstRef();
43
44 Result initCheck() { return mStatus; }
45 int closeHalTuner(const struct radio_tuner *halTuner);
46
47private:
48 virtual ~BroadcastRadio();
49
50 static const char * sClassModuleNames[];
51
52 Result convertHalResult(int rc);
53 void convertBandConfigFromHal(BandConfig *config,
54 const radio_hal_band_config_t *halConfig);
55 void convertPropertiesFromHal(Properties *properties,
56 const radio_hal_properties_t *halProperties);
57 void convertBandConfigToHal(radio_hal_band_config_t *halConfig,
58 const BandConfig *config);
59
60 Result mStatus;
61 Class mClassId;
62 struct radio_hw_device *mHwDevice;
63};
64
65} // namespace implementation
66} // namespace V1_0
67} // namespace broadcastradio
68} // namespace hardware
69} // namespace android
70
Steven Morelandd6e4f032016-11-28 18:37:07 -080071#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H