blob: f3d5ff70930fc5ad815fe4da37257576b376f4fa [file] [log] [blame]
shubang23aa3ac2020-09-07 18:56:28 -07001/**
2 * Copyright (c) 2020, 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
17#ifndef ANDROID_MEDIA_TUNERSERVICE_H
18#define ANDROID_MEDIA_TUNERSERVICE_H
19
20#include <aidl/android/media/tv/tuner/BnTunerService.h>
Amy Zhang70de35a2020-10-12 20:13:16 -070021#include <aidl/android/media/tv/tuner/TunerServiceFrontendInfo.h>
shubang23aa3ac2020-09-07 18:56:28 -070022#include <android/hardware/tv/tuner/1.0/ITuner.h>
23
24using Status = ::ndk::ScopedAStatus;
25using ::aidl::android::media::tv::tuner::BnTunerService;
Amy Zhang70de35a2020-10-12 20:13:16 -070026using ::aidl::android::media::tv::tuner::TunerServiceFrontendInfo;
27using ::android::hardware::tv::tuner::V1_0::FrontendInfo;
shubang23aa3ac2020-09-07 18:56:28 -070028using ::android::hardware::tv::tuner::V1_0::ITuner;
29
30namespace android {
31
32class TunerService : public BnTunerService {
33
34public:
35 static char const *getServiceName() { return "media.tuner"; }
36 static void instantiate();
37 TunerService();
38 virtual ~TunerService();
39 Status getFrontendIds(std::vector<int32_t>* ids, int32_t* _aidl_return) override;
Amy Zhang70de35a2020-10-12 20:13:16 -070040 Status getFrontendInfo(int32_t frontendHandle, TunerServiceFrontendInfo* _aidl_return) override;
shubang23aa3ac2020-09-07 18:56:28 -070041
42private:
43 static sp<ITuner> mTuner;
Amy Zhang70de35a2020-10-12 20:13:16 -070044
45 int getResourceIdFromHandle(int resourceHandle);
46 TunerServiceFrontendInfo convertToAidlFrontendInfo(int feId, FrontendInfo halInfo);
shubang23aa3ac2020-09-07 18:56:28 -070047};
48
49} // namespace android
50
51#endif // ANDROID_MEDIA_TUNERSERVICE_H