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 | ||
761dcc45 | 37 | #include <cectypes.h> |
acec5f48 | 38 | |
abbca718 LOK |
39 | #ifdef __cplusplus |
40 | extern "C" { | |
41 | #endif | |
42 | ||
43 | /*! | |
df7339c6 | 44 | * @brief Load the CEC adapter library. |
abbca718 | 45 | * @param strDeviceName How to present this device to other devices. |
df7339c6 LOK |
46 | * @param iLogicalAddress The logical of this device. PLAYBACKDEVICE1 by default. |
47 | * @param iPhysicalAddress The physical address of this device. 0x1000 by default. | |
abbca718 LOK |
48 | * @return True when initialised, false otherwise. |
49 | */ | |
df7339c6 | 50 | #ifdef __cplusplus |
02ee2c68 | 51 | extern DECLSPEC int cec_init(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS); |
df7339c6 | 52 | #else |
02ee2c68 | 53 | extern DECLSPEC int cec_init(const char *strDeviceName, cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1, uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS); |
df7339c6 | 54 | #endif |
abbca718 | 55 | |
f8513317 LOK |
56 | /*! |
57 | * @brief Load the CEC adapter library. | |
58 | * @param strDeviceName How to present this device to other devices. | |
59 | * @param deviceTypes The device types to use on the CEC bus. | |
60 | * @return True when initialised, false otherwise. | |
61 | */ | |
62 | #ifdef __cplusplus | |
63 | extern DECLSPEC int cec_init_typed(const char *strDeviceName, CEC::cec_device_type_list devicesTypes); | |
64 | #else | |
65 | extern DECLSPEC int cec_init_typed(const char *strDeviceName, cec_device_type_list devicesTypes); | |
66 | #endif | |
67 | ||
68 | ||
5f39c4d8 LOK |
69 | /*! |
70 | * @brief Unload the CEC adapter library. | |
71 | */ | |
72 | extern DECLSPEC void cec_destroy(void); | |
73 | ||
abbca718 LOK |
74 | /*! |
75 | * @brief Open a connection to the CEC adapter. | |
76 | * @param strPort The path to the port. | |
77 | * @param iTimeout Connection timeout in ms. | |
78 | * @return True when connected, false otherwise. | |
79 | */ | |
02ee2c68 | 80 | extern DECLSPEC int cec_open(const char *strPort, uint32_t iTimeout); |
abbca718 | 81 | |
f99bc831 LOK |
82 | /*! |
83 | * @brief Close the connection to the CEC adapter. | |
f99bc831 | 84 | */ |
5f39c4d8 | 85 | extern DECLSPEC void cec_close(void); |
f99bc831 | 86 | |
2abe74eb LOK |
87 | /*! |
88 | * @brief Try to find all connected CEC adapters. Only implemented on Linux at the moment. | |
89 | * @param deviceList The vector to store device descriptors in. | |
90 | * @param strDevicePath Optional device path. Only adds device descriptors that match the given device path. | |
91 | * @return The number of devices that were found, or -1 when an error occured. | |
92 | */ | |
93 | #ifdef __cplusplus | |
25701fa6 | 94 | extern DECLSPEC int8_t cec_find_adapters(CEC::cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); |
2abe74eb | 95 | #else |
25701fa6 | 96 | extern DECLSPEC int8_t cec_find_adapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL); |
2abe74eb LOK |
97 | #endif |
98 | ||
abbca718 LOK |
99 | /*! |
100 | * @brief Ping the CEC adapter. | |
101 | * @return True when the ping was succesful, false otherwise. | |
102 | */ | |
02ee2c68 | 103 | extern DECLSPEC int cec_ping_adapters(void); |
abbca718 LOK |
104 | |
105 | /*! | |
106 | * @brief Start the bootloader of the CEC adapter. | |
107 | * @return True when the command was sent succesfully, false otherwise. | |
108 | */ | |
02ee2c68 | 109 | extern DECLSPEC int cec_start_bootloader(void); |
abbca718 LOK |
110 | |
111 | /*! | |
2abe74eb LOK |
112 | * @return Get the minimal version of libcec that this version of libcec can interface with. |
113 | */ | |
d75be19b | 114 | extern DECLSPEC int8_t cec_get_min_lib_version(void); |
2abe74eb LOK |
115 | |
116 | /*! | |
d75be19b | 117 | * @return Get the major version of libcec. |
abbca718 | 118 | */ |
d75be19b | 119 | extern DECLSPEC int8_t cec_get_lib_version_major(void); |
abbca718 | 120 | |
eafd9bed LOK |
121 | /*! |
122 | * @return Get the minor version of libcec. | |
123 | */ | |
124 | extern DECLSPEC int8_t cec_get_lib_version_minor(void); | |
125 | ||
abbca718 LOK |
126 | /*! |
127 | * @brief Power on the connected CEC capable devices. | |
df7339c6 | 128 | * @param address The logical address to power on. |
abbca718 LOK |
129 | * @return True when the command was sent succesfully, false otherwise. |
130 | */ | |
131 | #ifdef __cplusplus | |
02ee2c68 | 132 | extern DECLSPEC int cec_power_on_devices(CEC::cec_logical_address address = CEC::CECDEVICE_TV); |
abbca718 | 133 | #else |
02ee2c68 | 134 | extern DECLSPEC int cec_power_on_devices(cec_logical_address address = CECDEVICE_TV); |
abbca718 LOK |
135 | #endif |
136 | ||
137 | /*! | |
138 | * @brief Put connected CEC capable devices in standby mode. | |
df7339c6 | 139 | * @brief address The logical address of the device to put in standby. |
abbca718 LOK |
140 | * @return True when the command was sent succesfully, false otherwise. |
141 | */ | |
142 | #ifdef __cplusplus | |
02ee2c68 | 143 | extern DECLSPEC int cec_standby_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST); |
abbca718 | 144 | #else |
02ee2c68 | 145 | extern DECLSPEC int cec_standby_devices(cec_logical_address address = CECDEVICE_BROADCAST); |
abbca718 LOK |
146 | #endif |
147 | ||
148 | /*! | |
df7339c6 | 149 | * @brief Broadcast a message that notifies connected CEC capable devices that this device is the active source. |
abbca718 LOK |
150 | * @return True when the command was sent succesfully, false otherwise. |
151 | */ | |
02ee2c68 | 152 | extern DECLSPEC int cec_set_active_view(void); |
abbca718 LOK |
153 | |
154 | /*! | |
df7339c6 | 155 | * @brief Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source. |
abbca718 LOK |
156 | * @return True when the command was sent succesfully, false otherwise. |
157 | */ | |
02ee2c68 | 158 | extern DECLSPEC int cec_set_inactive_view(void); |
abbca718 LOK |
159 | |
160 | /*! | |
161 | * @brief Get the next log message in the queue, if there is one. | |
162 | * @param message The next message. | |
163 | * @return True if a message was passed, false otherwise. | |
164 | */ | |
165 | #ifdef __cplusplus | |
02ee2c68 | 166 | extern DECLSPEC int cec_get_next_log_message(CEC::cec_log_message *message); |
abbca718 | 167 | #else |
02ee2c68 | 168 | extern DECLSPEC int cec_get_next_log_message(cec_log_message *message); |
abbca718 LOK |
169 | #endif |
170 | ||
171 | /*! | |
172 | * @brief Get the next keypress in the queue, if there is one. | |
df7339c6 | 173 | * @param key The next keypress. |
abbca718 LOK |
174 | * @return True if a key was passed, false otherwise. |
175 | */ | |
176 | #ifdef __cplusplus | |
02ee2c68 | 177 | extern DECLSPEC int cec_get_next_keypress(CEC::cec_keypress *key); |
abbca718 | 178 | #else |
02ee2c68 | 179 | extern DECLSPEC int cec_get_next_keypress(cec_keypress *key); |
abbca718 LOK |
180 | #endif |
181 | ||
825ddb96 LOK |
182 | /*! |
183 | * @brief Get the next CEC command that was received by the adapter. | |
184 | * @param action The next command. | |
185 | * @return True when a command was passed, false otherwise. | |
186 | */ | |
187 | #ifdef __cplusplus | |
02ee2c68 | 188 | extern DECLSPEC int cec_get_next_command(CEC::cec_command *command); |
825ddb96 | 189 | #else |
02ee2c68 | 190 | extern DECLSPEC int cec_get_next_command(cec_command *command); |
825ddb96 LOK |
191 | #endif |
192 | ||
abbca718 | 193 | /*! |
df7339c6 | 194 | * @brief Transmit a frame on the CEC line. |
abbca718 LOK |
195 | * @param data The frame to send. |
196 | * @return True when the data was sent and acked, false otherwise. | |
197 | */ | |
198 | #ifdef __cplusplus | |
8d84e2c0 | 199 | extern DECLSPEC int cec_transmit(const CEC::cec_command &data); |
abbca718 | 200 | #else |
8d84e2c0 | 201 | extern DECLSPEC int cec_transmit(const cec_command &data); |
abbca718 LOK |
202 | #endif |
203 | ||
204 | /*! | |
2492216a LOK |
205 | * @brief Change the logical address of the CEC adapter. |
206 | * @param iLogicalAddress The CEC adapter's new logical address. | |
207 | * @return True when the logical address was set successfully, false otherwise. | |
6dfe9213 LOK |
208 | */ |
209 | #ifdef __cplusplus | |
2492216a | 210 | extern DECLSPEC int cec_set_logical_address(CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1); |
6dfe9213 | 211 | #else |
02ee2c68 | 212 | extern DECLSPEC int cec_set_logical_address(cec_logical_address myAddress, cec_logical_address targetAddress); |
6dfe9213 LOK |
213 | #endif |
214 | ||
2492216a LOK |
215 | /*! |
216 | * @brief Change the physical address (HDMI port) of the CEC adapter. | |
217 | * @param iPhysicalAddress The CEC adapter's new physical address. | |
218 | * @brief True when the physical address was set successfully, false otherwise. | |
219 | */ | |
220 | extern DECLSPEC int cec_set_physical_address(uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS); | |
221 | ||
1969b140 | 222 | /*! |
6a1c0009 LOK |
223 | * @brief Display a message on the device with the given logical address. |
224 | * @param iLogicalAddres The device to display the message on. | |
225 | * @param duration The duration of the message | |
226 | * @param strMessage The message to display. | |
1969b140 LOK |
227 | * @return True when the command was sent, false otherwise. |
228 | */ | |
229 | #ifdef __cplusplus | |
230 | extern DECLSPEC int cec_set_osd_string(CEC::cec_logical_address iLogicalAddress, CEC::cec_display_control duration, const char *strMessage); | |
231 | #else | |
232 | extern DECLSPEC int cec_set_osd_string(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage); | |
233 | #endif | |
234 | ||
6a1c0009 LOK |
235 | /*! |
236 | * @brief Enable or disable monitoring mode. | |
237 | * @param bEnable True to enable, false to disable. | |
238 | * @return True when switched successfully, false otherwise. | |
239 | */ | |
8b7e5ff6 LOK |
240 | extern DECLSPEC int cec_switch_monitoring(int bEnable); |
241 | ||
6a1c0009 LOK |
242 | /*! |
243 | * @brief Get the CEC version of the device with the given logical address | |
244 | * @param iLogicalAddress The device to get the CEC version for. | |
245 | * @return The version or CEC_VERSION_UNKNOWN when the version couldn't be fetched. | |
246 | */ | |
247 | #ifdef __cplusplus | |
248 | extern DECLSPEC CEC::cec_version cec_get_device_cec_version(CEC::cec_logical_address iLogicalAddress); | |
249 | #else | |
250 | extern DECLSPEC cec_version cec_get_device_cec_version(cec_logical_address iLogicalAddress); | |
251 | #endif | |
252 | ||
a3269a0a LOK |
253 | /*! |
254 | * @brief Get the menu language of the device with the given logical address | |
255 | * @param iLogicalAddress The device to get the menu language for. | |
256 | * @param language The requested menu language. | |
257 | * @return True when fetched succesfully, false otherwise. | |
258 | */ | |
259 | #ifdef __cplusplus | |
260 | extern DECLSPEC int cec_get_device_menu_language(CEC::cec_logical_address iLogicalAddress, CEC::cec_menu_language *language); | |
261 | #else | |
44c74256 | 262 | extern DECLSPEC int cec_get_device_menu_language(cec_logical_address iLogicalAddress, cec_menu_language *language); |
a3269a0a | 263 | #endif |
44c74256 LOK |
264 | |
265 | /*! | |
266 | * @brief Get the vendor ID of the device with the given logical address. | |
267 | * @param iLogicalAddress The device to get the vendor id for. | |
268 | * @return The vendor ID or 0 if it wasn't found. | |
269 | */ | |
270 | #ifdef __cplusplus | |
271 | extern DECLSPEC uint64_t cec_get_device_vendor_id(CEC::cec_logical_address iLogicalAddress); | |
272 | #else | |
273 | extern DECLSPEC uint64_t cec_get_device_vendor_id(cec_logical_address iLogicalAddress); | |
274 | #endif | |
275 | ||
e55f3f70 LOK |
276 | /*! |
277 | * @brief Get the power status of the device with the given logical address. | |
278 | * @param iLogicalAddress The device to get the power status for. | |
279 | * @return The power status or CEC_POWER_STATUS_UNKNOWN if it wasn't found. | |
280 | */ | |
281 | #ifdef __cplusplus | |
282 | extern DECLSPEC CEC::cec_power_status cec_get_device_power_status(CEC::cec_logical_address iLogicalAddress); | |
283 | #else | |
284 | extern DECLSPEC cec_power_status cec_get_device_power_status(cec_logical_address iLogicalAddress); | |
285 | #endif | |
286 | ||
57f45e6c LOK |
287 | /*! |
288 | * @brief Sends a POLL message to a device. | |
289 | * @param iAddress The device to send the message to. | |
290 | * @return True if the POLL was acked, false otherwise. | |
291 | */ | |
292 | #ifdef __cplusplus | |
293 | extern DECLSPEC int cec_poll_device(CEC::cec_logical_address iLogicalAddress); | |
294 | #else | |
295 | extern DECLSPEC int cec_poll_device(cec_logical_address iLogicalAddress); | |
296 | #endif | |
297 | ||
abbca718 LOK |
298 | #ifdef __cplusplus |
299 | }; | |
300 | #endif | |
301 | ||
302 | #endif /* CECEXPORTS_C_H_ */ |