blob: beb69f5d7bb0e41ffecb17215c1e2e78b8354c5a [file] [log] [blame]
Dongwon Kang74088492016-10-13 16:17:01 -07001/*
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 Morelandd6e4f032016-11-28 18:37:07 -080016#ifndef ANDROID_HARDWARE_TV_INPUT_V1_0_TVINPUT_H
17#define ANDROID_HARDWARE_TV_INPUT_V1_0_TVINPUT_H
Dongwon Kang74088492016-10-13 16:17:01 -070018
19#include <android/hardware/tv/input/1.0/ITvInput.h>
20#include <hidl/Status.h>
21#include <hardware/tv_input.h>
22
23#include <hidl/MQDescriptor.h>
24
25namespace android {
26namespace hardware {
27namespace tv {
28namespace input {
29namespace V1_0 {
30namespace implementation {
31
32using ::android::hardware::audio::common::V2_0::AudioDevice;
33using ::android::hardware::tv::input::V1_0::ITvInput;
34using ::android::hardware::tv::input::V1_0::ITvInputCallback;
35using ::android::hardware::tv::input::V1_0::Result;
36using ::android::hardware::tv::input::V1_0::TvInputEvent;
37using ::android::hardware::tv::input::V1_0::TvStreamConfig;
38using ::android::hardware::Return;
39using ::android::hardware::Void;
40using ::android::hardware::hidl_vec;
41using ::android::hardware::hidl_string;
42using ::android::sp;
43
44struct TvInput : public ITvInput {
45 TvInput(tv_input_device_t* device);
46 ~TvInput();
47 Return<void> setCallback(const sp<ITvInputCallback>& callback) override;
48 Return<void> getStreamConfigurations(int32_t deviceId,
49 getStreamConfigurations_cb _hidl_cb) override;
50 Return<void> openStream(int32_t deviceId, int32_t streamId,
51 openStream_cb _hidl_cb) override;
52 Return<Result> closeStream(int32_t deviceId, int32_t streamId) override;
53
54 static void notify(struct tv_input_device* __unused, tv_input_event_t* event,
55 void* __unused);
56 static uint32_t getSupportedConfigCount(uint32_t configCount,
57 const tv_stream_config_t* configs);
58 static bool isSupportedStreamType(int type);
59
60 private:
61 static sp<ITvInputCallback> mCallback;
62 tv_input_callback_ops_t mCallbackOps;
63 tv_input_device_t* mDevice;
64};
65
66extern "C" ITvInput* HIDL_FETCH_ITvInput(const char* name);
67
68} // namespace implementation
69} // namespace V1_0
70} // namespace input
71} // namespace tv
72} // namespace hardware
73} // namespace android
74
Steven Morelandd6e4f032016-11-28 18:37:07 -080075#endif // ANDROID_HARDWARE_TV_INPUT_V1_0_TVINPUT_H