blob: c1bb2c74d09d973c5a8f5ff10b21290a369390a4 [file] [log] [blame]
Shraddha Basantwanif3a43c82021-05-27 19:40:17 +05301/*
2 * Copyright (C) 2021 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#include <android/hardware/tv/cec/1.0/IHdmiCec.h>
18#include <hardware/hdmi_cec.h>
19
20namespace android {
21namespace hardware {
22namespace tv {
23namespace cec {
24namespace V1_0 {
25namespace implementation {
26
27struct HdmiCecDefault : public IHdmiCec, public hidl_death_recipient {
28 HdmiCecDefault();
29 ~HdmiCecDefault();
30 // Methods from ::android::hardware::tv::cec::V1_0::IHdmiCec follow.
31 Return<Result> addLogicalAddress(CecLogicalAddress addr) override;
32 Return<void> clearLogicalAddress() override;
33 Return<void> getPhysicalAddress(getPhysicalAddress_cb _hidl_cb) override;
34 Return<SendMessageResult> sendMessage(const CecMessage& message) override;
35 Return<void> setCallback(const sp<IHdmiCecCallback>& callback) override;
36 Return<int32_t> getCecVersion() override;
37 Return<uint32_t> getVendorId() override;
38 Return<void> getPortInfo(getPortInfo_cb _hidl_cb) override;
39 Return<void> setOption(OptionKey key, bool value) override;
40 Return<void> setLanguage(const hidl_string& language) override;
41 Return<void> enableAudioReturnChannel(int32_t portId, bool enable) override;
42 Return<bool> isConnected(int32_t portId) override;
43
44 virtual void serviceDied(uint64_t, const wp<::android::hidl::base::V1_0::IBase>&) {
45 setCallback(nullptr);
46 }
47
48 Return<Result> init();
49 Return<void> release();
Shraddha Basantwani0c8a0542021-06-04 15:10:06 +053050 static void* event_thread(void*);
Shraddha Basantwani05c454f2021-06-18 12:42:27 +053051 static int getOpcode(struct cec_msg message);
52 static bool isWakeupMessage(struct cec_msg message);
Shraddha Basantwanif3a43c82021-05-27 19:40:17 +053053};
54
55} // namespace implementation
56} // namespace V1_0
57} // namespace cec
58} // namespace tv
59} // namespace hardware
60} // namespace android