Eric Laurent | a174588 | 2016-11-21 10:41:22 -0800 | [diff] [blame] | 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 | */ |
Steven Moreland | d6e4f03 | 2016-11-28 18:37:07 -0800 | [diff] [blame] | 16 | #ifndef ANDROID_HARDWARE_BROADCASTRADIO_V1_0_TUNER_H |
| 17 | #define ANDROID_HARDWARE_BROADCASTRADIO_V1_0_TUNER_H |
Eric Laurent | a174588 | 2016-11-21 10:41:22 -0800 | [diff] [blame] | 18 | |
| 19 | #include <android/hardware/broadcastradio/1.0/ITuner.h> |
| 20 | #include <android/hardware/broadcastradio/1.0/ITunerCallback.h> |
| 21 | #include <hidl/Status.h> |
| 22 | #include <hardware/radio.h> |
| 23 | |
| 24 | namespace android { |
| 25 | namespace hardware { |
| 26 | namespace broadcastradio { |
| 27 | namespace V1_0 { |
| 28 | namespace implementation { |
| 29 | |
| 30 | struct BroadcastRadio; |
| 31 | |
| 32 | struct Tuner : public ITuner { |
| 33 | |
| 34 | Tuner(const sp<ITunerCallback>& callback, const wp<BroadcastRadio>& mParentDevice); |
| 35 | |
| 36 | // Methods from ::android::hardware::broadcastradio::V1_0::ITuner follow. |
| 37 | Return<Result> setConfiguration(const BandConfig& config) override; |
| 38 | Return<void> getConfiguration(getConfiguration_cb _hidl_cb) override; |
| 39 | Return<Result> scan(Direction direction, bool skipSubChannel) override; |
| 40 | Return<Result> step(Direction direction, bool skipSubChannel) override; |
| 41 | Return<Result> tune(uint32_t channel, uint32_t subChannel) override; |
| 42 | Return<Result> cancel() override; |
Tomasz Wasilczyk | 5cc9d86 | 2017-01-06 14:19:11 -0800 | [diff] [blame] | 43 | Return<void> getProgramInformation(getProgramInformation_cb _hidl_cb) override; |
Eric Laurent | a174588 | 2016-11-21 10:41:22 -0800 | [diff] [blame] | 44 | |
| 45 | static void callback(radio_hal_event_t *halEvent, void *cookie); |
| 46 | void onCallback(radio_hal_event_t *halEvent); |
| 47 | |
| 48 | void setHalTuner(const struct radio_tuner *halTuner) { mHalTuner = halTuner; } |
| 49 | const struct radio_tuner *getHalTuner() { return mHalTuner; } |
| 50 | |
| 51 | private: |
| 52 | ~Tuner(); |
| 53 | |
| 54 | const struct radio_tuner *mHalTuner; |
| 55 | const sp<ITunerCallback> mCallback; |
| 56 | const wp<BroadcastRadio> mParentDevice; |
| 57 | }; |
| 58 | |
| 59 | |
| 60 | } // namespace implementation |
| 61 | } // namespace V1_0 |
| 62 | } // namespace broadcastradio |
| 63 | } // namespace hardware |
| 64 | } // namespace android |
| 65 | |
Steven Moreland | d6e4f03 | 2016-11-28 18:37:07 -0800 | [diff] [blame] | 66 | #endif // ANDROID_HARDWARE_BROADCASTRADIO_V1_0_TUNER_H |