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