cec: added GetDeviceMenuLanguage()/cec_get_device_menu_language()
[deb_libcec.git] / include / cecc.h
CommitLineData
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
40extern "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 51extern 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 53extern 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
5f39c4d8
LOK
56/*!
57 * @brief Unload the CEC adapter library.
58 */
59extern DECLSPEC void cec_destroy(void);
60
abbca718
LOK
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 */
02ee2c68 67extern DECLSPEC int cec_open(const char *strPort, uint32_t iTimeout);
abbca718 68
f99bc831
LOK
69/*!
70 * @brief Close the connection to the CEC adapter.
f99bc831 71 */
5f39c4d8 72extern DECLSPEC void cec_close(void);
f99bc831 73
2abe74eb
LOK
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
25701fa6 81extern DECLSPEC int8_t cec_find_adapters(CEC::cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL);
2abe74eb 82#else
25701fa6 83extern DECLSPEC int8_t cec_find_adapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL);
2abe74eb
LOK
84#endif
85
abbca718
LOK
86/*!
87 * @brief Ping the CEC adapter.
88 * @return True when the ping was succesful, false otherwise.
89 */
02ee2c68 90extern DECLSPEC int cec_ping_adapters(void);
abbca718
LOK
91
92/*!
93 * @brief Start the bootloader of the CEC adapter.
94 * @return True when the command was sent succesfully, false otherwise.
95 */
02ee2c68 96extern DECLSPEC int cec_start_bootloader(void);
abbca718
LOK
97
98/*!
2abe74eb
LOK
99 * @return Get the minimal version of libcec that this version of libcec can interface with.
100 */
25701fa6 101extern DECLSPEC int8_t cec_get_min_version(void);
2abe74eb
LOK
102
103/*!
104 * @return Get the version of libcec.
abbca718 105 */
25701fa6 106extern DECLSPEC int8_t cec_get_lib_version(void);
abbca718
LOK
107
108/*!
109 * @brief Power on the connected CEC capable devices.
df7339c6 110 * @param address The logical address to power on.
abbca718
LOK
111 * @return True when the command was sent succesfully, false otherwise.
112 */
113#ifdef __cplusplus
02ee2c68 114extern DECLSPEC int cec_power_on_devices(CEC::cec_logical_address address = CEC::CECDEVICE_TV);
abbca718 115#else
02ee2c68 116extern DECLSPEC int cec_power_on_devices(cec_logical_address address = CECDEVICE_TV);
abbca718
LOK
117#endif
118
119/*!
120 * @brief Put connected CEC capable devices in standby mode.
df7339c6 121 * @brief address The logical address of the device to put in standby.
abbca718
LOK
122 * @return True when the command was sent succesfully, false otherwise.
123 */
124#ifdef __cplusplus
02ee2c68 125extern DECLSPEC int cec_standby_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST);
abbca718 126#else
02ee2c68 127extern DECLSPEC int cec_standby_devices(cec_logical_address address = CECDEVICE_BROADCAST);
abbca718
LOK
128#endif
129
130/*!
df7339c6 131 * @brief Broadcast a message that notifies connected CEC capable devices that this device is the active source.
abbca718
LOK
132 * @return True when the command was sent succesfully, false otherwise.
133 */
02ee2c68 134extern DECLSPEC int cec_set_active_view(void);
abbca718
LOK
135
136/*!
df7339c6 137 * @brief Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source.
abbca718
LOK
138 * @return True when the command was sent succesfully, false otherwise.
139 */
02ee2c68 140extern DECLSPEC int cec_set_inactive_view(void);
abbca718
LOK
141
142/*!
143 * @brief Get the next log message in the queue, if there is one.
144 * @param message The next message.
145 * @return True if a message was passed, false otherwise.
146 */
147#ifdef __cplusplus
02ee2c68 148extern DECLSPEC int cec_get_next_log_message(CEC::cec_log_message *message);
abbca718 149#else
02ee2c68 150extern DECLSPEC int cec_get_next_log_message(cec_log_message *message);
abbca718
LOK
151#endif
152
153/*!
154 * @brief Get the next keypress in the queue, if there is one.
df7339c6 155 * @param key The next keypress.
abbca718
LOK
156 * @return True if a key was passed, false otherwise.
157 */
158#ifdef __cplusplus
02ee2c68 159extern DECLSPEC int cec_get_next_keypress(CEC::cec_keypress *key);
abbca718 160#else
02ee2c68 161extern DECLSPEC int cec_get_next_keypress(cec_keypress *key);
abbca718
LOK
162#endif
163
825ddb96
LOK
164/*!
165 * @brief Get the next CEC command that was received by the adapter.
166 * @param action The next command.
167 * @return True when a command was passed, false otherwise.
168 */
169#ifdef __cplusplus
02ee2c68 170extern DECLSPEC int cec_get_next_command(CEC::cec_command *command);
825ddb96 171#else
02ee2c68 172extern DECLSPEC int cec_get_next_command(cec_command *command);
825ddb96
LOK
173#endif
174
abbca718 175/*!
df7339c6 176 * @brief Transmit a frame on the CEC line.
abbca718
LOK
177 * @param data The frame to send.
178 * @return True when the data was sent and acked, false otherwise.
179 */
180#ifdef __cplusplus
8d84e2c0 181extern DECLSPEC int cec_transmit(const CEC::cec_command &data);
abbca718 182#else
8d84e2c0 183extern DECLSPEC int cec_transmit(const cec_command &data);
abbca718
LOK
184#endif
185
186/*!
2492216a
LOK
187 * @brief Change the logical address of the CEC adapter.
188 * @param iLogicalAddress The CEC adapter's new logical address.
189 * @return True when the logical address was set successfully, false otherwise.
6dfe9213
LOK
190 */
191#ifdef __cplusplus
2492216a 192extern DECLSPEC int cec_set_logical_address(CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1);
6dfe9213 193#else
02ee2c68 194extern DECLSPEC int cec_set_logical_address(cec_logical_address myAddress, cec_logical_address targetAddress);
6dfe9213
LOK
195#endif
196
2492216a
LOK
197/*!
198 * @brief Change the physical address (HDMI port) of the CEC adapter.
199 * @param iPhysicalAddress The CEC adapter's new physical address.
200 * @brief True when the physical address was set successfully, false otherwise.
201 */
202extern DECLSPEC int cec_set_physical_address(uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
203
1969b140 204/*!
6a1c0009
LOK
205 * @brief Display a message on the device with the given logical address.
206 * @param iLogicalAddres The device to display the message on.
207 * @param duration The duration of the message
208 * @param strMessage The message to display.
1969b140
LOK
209 * @return True when the command was sent, false otherwise.
210 */
211#ifdef __cplusplus
212extern DECLSPEC int cec_set_osd_string(CEC::cec_logical_address iLogicalAddress, CEC::cec_display_control duration, const char *strMessage);
213#else
214extern DECLSPEC int cec_set_osd_string(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
215#endif
216
6a1c0009
LOK
217/*!
218 * @brief Enable or disable monitoring mode.
219 * @param bEnable True to enable, false to disable.
220 * @return True when switched successfully, false otherwise.
221 */
8b7e5ff6
LOK
222extern DECLSPEC int cec_switch_monitoring(int bEnable);
223
6a1c0009
LOK
224/*!
225 * @brief Get the CEC version of the device with the given logical address
226 * @param iLogicalAddress The device to get the CEC version for.
227 * @return The version or CEC_VERSION_UNKNOWN when the version couldn't be fetched.
228 */
229#ifdef __cplusplus
230extern DECLSPEC CEC::cec_version cec_get_device_cec_version(CEC::cec_logical_address iLogicalAddress);
231#else
232extern DECLSPEC cec_version cec_get_device_cec_version(cec_logical_address iLogicalAddress);
233#endif
234
a3269a0a
LOK
235/*!
236 * @brief Get the menu language of the device with the given logical address
237 * @param iLogicalAddress The device to get the menu language for.
238 * @param language The requested menu language.
239 * @return True when fetched succesfully, false otherwise.
240 */
241#ifdef __cplusplus
242extern DECLSPEC int cec_get_device_menu_language(CEC::cec_logical_address iLogicalAddress, CEC::cec_menu_language *language);
243#else
244extern DECLSPEC cec_version cec_get_device_menu_language(cec_logical_address iLogicalAddress, cec_menu_language *language);
245#endif
abbca718
LOK
246#ifdef __cplusplus
247};
248#endif
249
250#endif /* CECEXPORTS_C_H_ */