blob: 7de31a07cb2711c16856a29f234ed0515b26d588 [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
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -070019#include <android/hardware/broadcastradio/1.1/IBroadcastRadio.h>
Tomasz Wasilczyk213170b2017-02-07 17:38:21 -080020#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
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -070033struct BroadcastRadio : public V1_1::IBroadcastRadio {
Tomasz Wasilczyk213170b2017-02-07 17:38:21 -080034
35 BroadcastRadio(Class classId);
36
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -070037 // Methods from ::android::hardware::broadcastradio::V1_1::IBroadcastRadio follow.
Tomasz Wasilczyk213170b2017-02-07 17:38:21 -080038 Return<void> getProperties(getProperties_cb _hidl_cb) override;
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -070039 Return<void> getProperties_1_1(getProperties_1_1_cb _hidl_cb) override;
Tomasz Wasilczyk213170b2017-02-07 17:38:21 -080040 Return<void> openTuner(const BandConfig& config, bool audio,
41 const sp<V1_0::ITunerCallback>& callback, openTuner_cb _hidl_cb) override;
42
43 // RefBase
44 virtual void onFirstRef() override;
45
46 Result initCheck() { return mStatus; }
47 int closeHalTuner(const struct radio_tuner *halTuner);
48
49private:
50 virtual ~BroadcastRadio();
51
52 static const char * sClassModuleNames[];
53
54 Result convertHalResult(int rc);
55 void convertBandConfigFromHal(BandConfig *config,
56 const radio_hal_band_config_t *halConfig);
57 void convertPropertiesFromHal(Properties *properties,
58 const radio_hal_properties_t *halProperties);
59 void convertBandConfigToHal(radio_hal_band_config_t *halConfig,
60 const BandConfig *config);
61
62 Result mStatus;
63 Class mClassId;
64 struct radio_hw_device *mHwDevice;
65};
66
67} // namespace implementation
68} // namespace V1_1
69} // namespace broadcastradio
70} // namespace hardware
71} // namespace android
72
73#endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_1_BROADCASTRADIO_H