1 /* 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.1/IBroadcastRadio.h> 20 #include <android/hardware/broadcastradio/1.1/types.h> 21 #include <hardware/radio.h> 22 23 namespace android { 24 namespace hardware { 25 namespace broadcastradio { 26 namespace V1_1 { 27 namespace implementation { 28 29 using V1_0::Class; 30 using V1_0::BandConfig; 31 using V1_0::Properties; 32 33 struct BroadcastRadio : public V1_1::IBroadcastRadio { 34 35 BroadcastRadio(Class classId); 36 37 // Methods from ::android::hardware::broadcastradio::V1_1::IBroadcastRadio follow. 38 Return<void> getProperties(getProperties_cb _hidl_cb) override; 39 Return<void> getProperties_1_1(getProperties_1_1_cb _hidl_cb) override; 40 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 initCheckBroadcastRadio46 Result initCheck() { return mStatus; } 47 int closeHalTuner(const struct radio_tuner *halTuner); 48 49 private: 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 74