• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_TV_INPUT_V1_0_TVINPUT_H
17 #define ANDROID_HARDWARE_TV_INPUT_V1_0_TVINPUT_H
18 
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 
25 namespace android {
26 namespace hardware {
27 namespace tv {
28 namespace input {
29 namespace V1_0 {
30 namespace implementation {
31 
32 using ::android::hardware::audio::common::V2_0::AudioDevice;
33 using ::android::hardware::tv::input::V1_0::ITvInput;
34 using ::android::hardware::tv::input::V1_0::ITvInputCallback;
35 using ::android::hardware::tv::input::V1_0::Result;
36 using ::android::hardware::tv::input::V1_0::TvInputEvent;
37 using ::android::hardware::tv::input::V1_0::TvStreamConfig;
38 using ::android::hardware::Return;
39 using ::android::hardware::Void;
40 using ::android::hardware::hidl_vec;
41 using ::android::hardware::hidl_string;
42 using ::android::sp;
43 
44 struct 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 
66 extern "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 
75 #endif  // ANDROID_HARDWARE_TV_INPUT_V1_0_TVINPUT_H
76