cec: split up CEC processing and the public interface. removed obsolete methods from...
[deb_libcec.git] / include / CECExportsC.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
37#ifdef __cplusplus
38extern "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#ifdef __cplusplus
49extern DECLSPEC bool cec_init(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress = CEC::CECDEVICE_PLAYBACKDEVICE1, int iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
50#else
51extern DECLSPEC bool cec_init(const char *strDeviceName, cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1, int iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
52#endif
abbca718 53
5f39c4d8
LOK
54/*!
55 * @brief Unload the CEC adapter library.
56 */
57extern DECLSPEC void cec_destroy(void);
58
abbca718
LOK
59/*!
60 * @brief Open a connection to the CEC adapter.
61 * @param strPort The path to the port.
62 * @param iTimeout Connection timeout in ms.
63 * @return True when connected, false otherwise.
64 */
65extern DECLSPEC bool cec_open(const char *strPort, int iTimeout);
66
f99bc831
LOK
67/*!
68 * @brief Close the connection to the CEC adapter.
f99bc831 69 */
5f39c4d8 70extern DECLSPEC void cec_close(void);
f99bc831 71
2abe74eb
LOK
72/*!
73 * @brief Try to find all connected CEC adapters. Only implemented on Linux at the moment.
74 * @param deviceList The vector to store device descriptors in.
75 * @param strDevicePath Optional device path. Only adds device descriptors that match the given device path.
76 * @return The number of devices that were found, or -1 when an error occured.
77 */
78#ifdef __cplusplus
79extern DECLSPEC int cec_find_adapters(std::vector<CEC::cec_adapter> &deviceList, const char *strDevicePath = NULL);
80#else
81extern DECLSPEC int cec_find_adapters(std::vector<cec_adapter> &deviceList, const char *strDevicePath = NULL);
82#endif
83
abbca718
LOK
84/*!
85 * @brief Ping the CEC adapter.
86 * @return True when the ping was succesful, false otherwise.
87 */
2abe74eb 88extern DECLSPEC bool cec_ping_adapters(void);
abbca718
LOK
89
90/*!
91 * @brief Start the bootloader of the CEC adapter.
92 * @return True when the command was sent succesfully, false otherwise.
93 */
94extern DECLSPEC bool cec_start_bootloader(void);
95
96/*!
2abe74eb
LOK
97 * @return Get the minimal version of libcec that this version of libcec can interface with.
98 */
99extern DECLSPEC int cec_get_min_version(void);
100
101/*!
102 * @return Get the version of libcec.
abbca718 103 */
2abe74eb 104extern DECLSPEC int cec_get_lib_version(void);
abbca718
LOK
105
106/*!
107 * @brief Power on the connected CEC capable devices.
df7339c6 108 * @param address The logical address to power on.
abbca718
LOK
109 * @return True when the command was sent succesfully, false otherwise.
110 */
111#ifdef __cplusplus
8148859e 112extern DECLSPEC bool cec_power_on_devices(CEC::cec_logical_address address = CEC::CECDEVICE_TV);
abbca718 113#else
8148859e 114extern DECLSPEC bool cec_power_on_devices(cec_logical_address address = CECDEVICE_TV);
abbca718
LOK
115#endif
116
117/*!
118 * @brief Put connected CEC capable devices in standby mode.
df7339c6 119 * @brief address The logical address of the device to put in standby.
abbca718
LOK
120 * @return True when the command was sent succesfully, false otherwise.
121 */
122#ifdef __cplusplus
123extern DECLSPEC bool cec_standby_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST);
124#else
125extern DECLSPEC bool cec_standby_devices(cec_logical_address address = CECDEVICE_BROADCAST);
126#endif
127
128/*!
df7339c6 129 * @brief Broadcast a message that notifies connected CEC capable devices that this device is the active source.
abbca718
LOK
130 * @return True when the command was sent succesfully, false otherwise.
131 */
132extern DECLSPEC bool cec_set_active_view(void);
133
134/*!
df7339c6 135 * @brief Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source.
abbca718
LOK
136 * @return True when the command was sent succesfully, false otherwise.
137 */
138extern DECLSPEC bool cec_set_inactive_view(void);
139
140/*!
141 * @brief Get the next log message in the queue, if there is one.
142 * @param message The next message.
143 * @return True if a message was passed, false otherwise.
144 */
145#ifdef __cplusplus
146extern DECLSPEC bool cec_get_next_log_message(CEC::cec_log_message *message);
147#else
148extern DECLSPEC bool cec_get_next_log_message(cec_log_message *message);
149#endif
150
151/*!
152 * @brief Get the next keypress in the queue, if there is one.
df7339c6 153 * @param key The next keypress.
abbca718
LOK
154 * @return True if a key was passed, false otherwise.
155 */
156#ifdef __cplusplus
157extern DECLSPEC bool cec_get_next_keypress(CEC::cec_keypress *key);
158#else
159extern DECLSPEC bool cec_get_next_keypress(cec_keypress *key);
160#endif
161
825ddb96
LOK
162/*!
163 * @brief Get the next CEC command that was received by the adapter.
164 * @param action The next command.
165 * @return True when a command was passed, false otherwise.
166 */
167#ifdef __cplusplus
168extern DECLSPEC bool cec_get_next_command(CEC::cec_command *command);
169#else
170extern DECLSPEC bool cec_get_next_command(cec_command *command);
171#endif
172
abbca718 173/*!
df7339c6 174 * @brief Transmit a frame on the CEC line.
abbca718 175 * @param data The frame to send.
df7339c6 176 * @param bWaitForAck Wait for an ACK message for 1 second after this frame has been sent.
abbca718
LOK
177 * @return True when the data was sent and acked, false otherwise.
178 */
179#ifdef __cplusplus
390b42d6 180extern DECLSPEC bool cec_transmit(const CEC::cec_frame &data, bool bWaitForAck = true);
abbca718 181#else
390b42d6 182extern DECLSPEC bool cec_transmit(const cec_frame &data, bool bWaitForAck = true);
abbca718
LOK
183#endif
184
185/*!
6dfe9213
LOK
186 * @brief Set the logical address of the CEC adapter.
187 * @param iLogicalAddress The cec adapter's logical address.
188 * @return True when the logical address was set succesfully, false otherwise.
189 */
190#ifdef __cplusplus
191extern DECLSPEC bool cec_set_logical_address(CEC::cec_logical_address iLogicalAddress);
192#else
193extern DECLSPEC bool cec_set_logical_address(cec_logical_address myAddress, cec_logical_address targetAddress);
194#endif
195
abbca718
LOK
196#ifdef __cplusplus
197};
198#endif
199
200#endif /* CECEXPORTS_C_H_ */