Commit | Line | Data |
---|---|---|
abbca718 LOK |
1 | #pragma once |
2 | /* | |
3 | * This file is part of the libCEC(R) library. | |
4 | * | |
5 | * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved. | |
6 | * libCEC(R) is an original work, containing original code. | |
7 | * | |
8 | * libCEC(R) is a trademark of Pulse-Eight Limited. | |
9 | * | |
10 | * This program is dual-licensed; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
23 | * | |
24 | * | |
25 | * Alternatively, you can license this library under a commercial license, | |
26 | * please contact Pulse-Eight Licensing for more information. | |
27 | * | |
28 | * For more information contact: | |
29 | * Pulse-Eight Licensing <license@pulse-eight.com> | |
30 | * http://www.pulse-eight.com/ | |
31 | * http://www.pulse-eight.net/ | |
32 | */ | |
33 | ||
34 | #ifndef CECEXPORTS_C_H_ | |
35 | #define CECEXPORTS_C_H_ | |
36 | ||
37 | #ifdef __cplusplus | |
38 | extern "C" { | |
39 | #endif | |
40 | ||
41 | /*! | |
df7339c6 | 42 | * @brief Load the CEC adapter library. |
abbca718 | 43 | * @param strDeviceName How to present this device to other devices. |
df7339c6 LOK |
44 | * @param iLogicalAddress The logical of this device. PLAYBACKDEVICE1 by default. |
45 | * @param iPhysicalAddress The physical address of this device. 0x1000 by default. | |
abbca718 LOK |
46 | * @return True when initialised, false otherwise. |
47 | */ | |
df7339c6 LOK |
48 | |
49 | #ifdef __cplusplus | |
50 | extern DECLSPEC bool cec_init(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1, int iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS); | |
51 | #else | |
52 | extern DECLSPEC bool cec_init(const char *strDeviceName, cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1, int iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS); | |
53 | #endif | |
abbca718 | 54 | |
abbca718 LOK |
55 | /*! |
56 | * @brief Open a connection to the CEC adapter. | |
57 | * @param strPort The path to the port. | |
58 | * @param iTimeout Connection timeout in ms. | |
59 | * @return True when connected, false otherwise. | |
60 | */ | |
61 | extern DECLSPEC bool cec_open(const char *strPort, int iTimeout); | |
62 | ||
f99bc831 LOK |
63 | /*! |
64 | * @brief Close the connection to the CEC adapter. | |
65 | * @param iTimeout Timeout in ms | |
66 | */ | |
67 | extern DECLSPEC bool cec_close(int iTimeout); | |
68 | ||
abbca718 LOK |
69 | /*! |
70 | * @brief Ping the CEC adapter. | |
71 | * @return True when the ping was succesful, false otherwise. | |
72 | */ | |
73 | extern DECLSPEC bool cec_ping(void); | |
74 | ||
75 | /*! | |
76 | * @brief Start the bootloader of the CEC adapter. | |
77 | * @return True when the command was sent succesfully, false otherwise. | |
78 | */ | |
79 | extern DECLSPEC bool cec_start_bootloader(void); | |
80 | ||
81 | /*! | |
8148859e | 82 | * @depcrecated Use cec_standby_devices() instead |
abbca718 LOK |
83 | */ |
84 | #ifdef __cplusplus | |
85 | extern DECLSPEC bool cec_power_off_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST); | |
86 | #else | |
87 | extern DECLSPEC bool cec_power_off_devices(cec_logical_address address = CECDEVICE_BROADCAST); | |
88 | #endif | |
89 | ||
90 | /*! | |
91 | * @brief Power on the connected CEC capable devices. | |
df7339c6 | 92 | * @param address The logical address to power on. |
abbca718 LOK |
93 | * @return True when the command was sent succesfully, false otherwise. |
94 | */ | |
95 | #ifdef __cplusplus | |
8148859e | 96 | extern DECLSPEC bool cec_power_on_devices(CEC::cec_logical_address address = CEC::CECDEVICE_TV); |
abbca718 | 97 | #else |
8148859e | 98 | extern DECLSPEC bool cec_power_on_devices(cec_logical_address address = CECDEVICE_TV); |
abbca718 LOK |
99 | #endif |
100 | ||
101 | /*! | |
102 | * @brief Put connected CEC capable devices in standby mode. | |
df7339c6 | 103 | * @brief address The logical address of the device to put in standby. |
abbca718 LOK |
104 | * @return True when the command was sent succesfully, false otherwise. |
105 | */ | |
106 | #ifdef __cplusplus | |
107 | extern DECLSPEC bool cec_standby_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST); | |
108 | #else | |
109 | extern DECLSPEC bool cec_standby_devices(cec_logical_address address = CECDEVICE_BROADCAST); | |
110 | #endif | |
111 | ||
112 | /*! | |
df7339c6 | 113 | * @brief Broadcast a message that notifies connected CEC capable devices that this device is the active source. |
abbca718 LOK |
114 | * @return True when the command was sent succesfully, false otherwise. |
115 | */ | |
116 | extern DECLSPEC bool cec_set_active_view(void); | |
117 | ||
118 | /*! | |
df7339c6 | 119 | * @brief Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source. |
abbca718 LOK |
120 | * @return True when the command was sent succesfully, false otherwise. |
121 | */ | |
122 | extern DECLSPEC bool cec_set_inactive_view(void); | |
123 | ||
124 | /*! | |
125 | * @brief Get the next log message in the queue, if there is one. | |
126 | * @param message The next message. | |
127 | * @return True if a message was passed, false otherwise. | |
128 | */ | |
129 | #ifdef __cplusplus | |
130 | extern DECLSPEC bool cec_get_next_log_message(CEC::cec_log_message *message); | |
131 | #else | |
132 | extern DECLSPEC bool cec_get_next_log_message(cec_log_message *message); | |
133 | #endif | |
134 | ||
135 | /*! | |
136 | * @brief Get the next keypress in the queue, if there is one. | |
df7339c6 | 137 | * @param key The next keypress. |
abbca718 LOK |
138 | * @return True if a key was passed, false otherwise. |
139 | */ | |
140 | #ifdef __cplusplus | |
141 | extern DECLSPEC bool cec_get_next_keypress(CEC::cec_keypress *key); | |
142 | #else | |
143 | extern DECLSPEC bool cec_get_next_keypress(cec_keypress *key); | |
144 | #endif | |
145 | ||
825ddb96 LOK |
146 | /*! |
147 | * @brief Get the next CEC command that was received by the adapter. | |
148 | * @param action The next command. | |
149 | * @return True when a command was passed, false otherwise. | |
150 | */ | |
151 | #ifdef __cplusplus | |
152 | extern DECLSPEC bool cec_get_next_command(CEC::cec_command *command); | |
153 | #else | |
154 | extern DECLSPEC bool cec_get_next_command(cec_command *command); | |
155 | #endif | |
156 | ||
abbca718 | 157 | /*! |
df7339c6 | 158 | * @brief Transmit a frame on the CEC line. |
abbca718 | 159 | * @param data The frame to send. |
df7339c6 | 160 | * @param bWaitForAck Wait for an ACK message for 1 second after this frame has been sent. |
abbca718 LOK |
161 | * @return True when the data was sent and acked, false otherwise. |
162 | */ | |
163 | #ifdef __cplusplus | |
390b42d6 | 164 | extern DECLSPEC bool cec_transmit(const CEC::cec_frame &data, bool bWaitForAck = true); |
abbca718 | 165 | #else |
390b42d6 | 166 | extern DECLSPEC bool cec_transmit(const cec_frame &data, bool bWaitForAck = true); |
abbca718 LOK |
167 | #endif |
168 | ||
169 | /*! | |
6dfe9213 LOK |
170 | * @brief Set the logical address of the CEC adapter. |
171 | * @param iLogicalAddress The cec adapter's logical address. | |
172 | * @return True when the logical address was set succesfully, false otherwise. | |
173 | */ | |
174 | #ifdef __cplusplus | |
175 | extern DECLSPEC bool cec_set_logical_address(CEC::cec_logical_address iLogicalAddress); | |
176 | #else | |
177 | extern DECLSPEC bool cec_set_logical_address(cec_logical_address myAddress, cec_logical_address targetAddress); | |
178 | #endif | |
179 | ||
180 | /*! | |
181 | * @deprecated Use cec_set_logical_address() instead. | |
182 | * @brief Set the ack mask of the CEC adapter. | |
183 | * @param iMask The cec adapter's ack mask. | |
abbca718 LOK |
184 | * @return True when the ack mask was sent succesfully, false otherwise. |
185 | */ | |
6dfe9213 | 186 | extern DECLSPEC bool cec_set_ack_mask(uint16_t iMask); |
abbca718 | 187 | |
df7339c6 LOK |
188 | /*! |
189 | * @return Get the minimal version of libcec that this version of libcec can interface with. | |
190 | */ | |
abbca718 | 191 | extern DECLSPEC int cec_get_min_version(void); |
df7339c6 LOK |
192 | |
193 | /*! | |
194 | * @return Get the version of libcec. | |
195 | */ | |
abbca718 LOK |
196 | extern DECLSPEC int cec_get_lib_version(void); |
197 | ||
df7339c6 LOK |
198 | /*! |
199 | * @brief Try to find all connected CEC adapters. Only implemented on Linux at the moment. | |
200 | * @param deviceList The vector to store device descriptors in. | |
201 | * @param strDevicePath Optional device path. Only adds device descriptors that match the given device path. | |
202 | * @return The number of devices that were found, or -1 when an error occured. | |
203 | */ | |
abbca718 LOK |
204 | #ifdef __cplusplus |
205 | extern DECLSPEC int cec_find_devices(std::vector<CEC::cec_device> &deviceList, const char *strDevicePath = NULL); | |
206 | #else | |
207 | extern DECLSPEC int cec_find_devices(std::vector<cec_device> &deviceList, const char *strDevicePath = NULL); | |
208 | #endif | |
209 | ||
210 | #ifdef __cplusplus | |
211 | }; | |
212 | #endif | |
213 | ||
214 | #endif /* CECEXPORTS_C_H_ */ |