Shraddha Basantwani | f3a43c8 | 2021-05-27 19:40:17 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | namespace android { |
| 21 | namespace hardware { |
| 22 | namespace tv { |
| 23 | namespace cec { |
| 24 | namespace V1_0 { |
| 25 | namespace implementation { |
| 26 | |
| 27 | struct 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 Basantwani | 0c8a054 | 2021-06-04 15:10:06 +0530 | [diff] [blame] | 50 | static void* event_thread(void*); |
Shraddha Basantwani | 05c454f | 2021-06-18 12:42:27 +0530 | [diff] [blame] | 51 | static int getOpcode(struct cec_msg message); |
| 52 | static bool isWakeupMessage(struct cec_msg message); |
Shraddha Basantwani | f3a43c8 | 2021-05-27 19:40:17 +0530 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | } // namespace implementation |
| 56 | } // namespace V1_0 |
| 57 | } // namespace cec |
| 58 | } // namespace tv |
| 59 | } // namespace hardware |
| 60 | } // namespace android |