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