Commit | Line | Data |
---|---|---|
cbbe90dd JB |
1 | #pragma once |
2 | /* | |
3 | * This file is part of the libCEC(R) library. | |
4 | * | |
5 | * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea | |
6 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. | |
7 | * libCEC(R) is an original work, containing original code. | |
8 | * | |
9 | * libCEC(R) is a trademark of Pulse-Eight Limited. | |
10 | * | |
11 | * This program is dual-licensed; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License as published by | |
13 | * the Free Software Foundation; either version 2 of the License, or | |
14 | * (at your option) any later version. | |
15 | * | |
16 | * This program is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | * GNU General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU General Public License | |
22 | * along with this program; if not, write to the Free Software | |
23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
24 | * | |
25 | * | |
26 | * Alternatively, you can license this library under a commercial license, | |
27 | * please contact Pulse-Eight Licensing for more information. | |
28 | * | |
29 | * For more information contact: | |
30 | * Pulse-Eight Licensing <license@pulse-eight.com> | |
31 | * http://www.pulse-eight.com/ | |
32 | * http://www.pulse-eight.net/ | |
33 | */ | |
34 | ||
35 | #if defined(HAVE_EXYNOS_API) | |
36 | ||
37 | #include "lib/platform/threads/mutex.h" | |
38 | #include "lib/platform/threads/threads.h" | |
39 | #include "lib/adapter/AdapterCommunication.h" | |
40 | #include <map> | |
41 | ||
42 | namespace CEC | |
43 | { | |
44 | class CExynosCECAdapterCommunication : public IAdapterCommunication, public PLATFORM::CThread | |
45 | { | |
46 | public: | |
47 | /*! | |
48 | * @brief Create a new Exynos HDMI CEC communication handler. | |
49 | * @param callback The callback to use for incoming CEC commands. | |
50 | */ | |
51 | CExynosCECAdapterCommunication(IAdapterCommunicationCallback *callback); | |
52 | virtual ~CExynosCECAdapterCommunication(void); | |
53 | ||
54 | /** @name IAdapterCommunication implementation */ | |
55 | ///{ | |
56 | bool Open(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT, bool bSkipChecks = false, bool bStartListening = true); | |
57 | void Close(void); | |
58 | bool IsOpen(void); | |
59 | std::string GetError(void) const; | |
60 | cec_adapter_message_state Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout, bool bIsReply); | |
61 | ||
62 | bool SetLineTimeout(uint8_t UNUSED(iTimeout)) { return true; } | |
63 | bool StartBootloader(void) { return false; } | |
64 | bool SetLogicalAddresses(const cec_logical_addresses &addresses); | |
65 | cec_logical_addresses GetLogicalAddresses(void); | |
66 | bool PingAdapter(void) { return IsInitialised(); } | |
67 | uint16_t GetFirmwareVersion(void); | |
68 | uint32_t GetFirmwareBuildDate(void) { return 0; } | |
69 | bool IsRunningLatestFirmware(void) { return true; } | |
70 | bool PersistConfiguration(const libcec_configuration & UNUSED(configuration)) { return false; } | |
71 | bool GetConfiguration(libcec_configuration & UNUSED(configuration)) { return false; } | |
72 | std::string GetPortName(void) { return std::string("EXYNOS"); } | |
73 | uint16_t GetPhysicalAddress(void); | |
74 | bool SetControlledMode(bool UNUSED(controlled)) { return true; } | |
75 | cec_vendor_id GetVendorId(void); | |
76 | bool SupportsSourceLogicalAddress(const cec_logical_address address) { return address > CECDEVICE_TV && address <= CECDEVICE_BROADCAST; } | |
77 | cec_adapter_type GetAdapterType(void) { return ADAPTERTYPE_EXYNOS; } | |
78 | uint16_t GetAdapterVendorId(void) const { return 1; } | |
79 | uint16_t GetAdapterProductId(void) const { return 1; } | |
80 | void HandleLogicalAddressLost(cec_logical_address oldAddress); | |
81 | void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) {} | |
82 | ///} | |
83 | ||
84 | /** @name PLATFORM::CThread implementation */ | |
85 | ///{ | |
86 | void *Process(void); | |
87 | ///} | |
88 | ||
89 | private: | |
90 | bool IsInitialised(void) const { return 1; }; | |
91 | ||
92 | std::string m_strError; /**< current error message */ | |
93 | ||
94 | bool m_bLogicalAddressChanged; | |
95 | cec_logical_addresses m_logicalAddresses; | |
96 | ||
97 | PLATFORM::CMutex m_mutex; | |
98 | int m_fd; | |
99 | }; | |
100 | }; | |
101 | #endif |