1 /* 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 */ 16 #ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H 17 #define ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H 18 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> 24 namespace android { 25 namespace hardware { 26 namespace broadcastradio { 27 namespace V1_0 { 28 namespace implementation { 29 30 struct 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 initCheckBroadcastRadio44 Result initCheck() { return mStatus; } 45 int closeHalTuner(const struct radio_tuner *halTuner); 46 47 private: 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 71 #endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_0_BROADCASTRADIO_H 72