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_V2_0_BROADCASTRADIO_H 17 #define ANDROID_HARDWARE_BROADCASTRADIO_V2_0_BROADCASTRADIO_H 18 19 #include "TunerSession.h" 20 21 #include <android/hardware/broadcastradio/2.0/IBroadcastRadio.h> 22 #include <android/hardware/broadcastradio/2.0/types.h> 23 24 namespace android { 25 namespace hardware { 26 namespace broadcastradio { 27 namespace V2_0 { 28 namespace implementation { 29 30 struct BroadcastRadio : public IBroadcastRadio { 31 BroadcastRadio(const VirtualRadio& virtualRadio); 32 33 // V2_0::IBroadcastRadio methods 34 Return<void> getProperties(getProperties_cb _hidl_cb) override; 35 Return<void> getAmFmRegionConfig(bool full, getAmFmRegionConfig_cb _hidl_cb); 36 Return<void> getDabRegionConfig(getDabRegionConfig_cb _hidl_cb); 37 Return<void> openSession(const sp<ITunerCallback>& callback, openSession_cb _hidl_cb) override; 38 Return<void> getImage(uint32_t id, getImage_cb _hidl_cb); 39 Return<void> registerAnnouncementListener(const hidl_vec<AnnouncementType>& enabled, 40 const sp<IAnnouncementListener>& listener, 41 registerAnnouncementListener_cb _hidl_cb); 42 43 std::reference_wrapper<const VirtualRadio> mVirtualRadio; 44 Properties mProperties; 45 46 AmFmRegionConfig getAmFmConfig() const; 47 48 private: 49 mutable std::mutex mMut; 50 AmFmRegionConfig mAmFmConfig; 51 wp<TunerSession> mSession; 52 }; 53 54 } // namespace implementation 55 } // namespace V2_0 56 } // namespace broadcastradio 57 } // namespace hardware 58 } // namespace android 59 60 #endif // ANDROID_HARDWARE_BROADCASTRADIO_V2_0_BROADCASTRADIO_H 61