initial commit containing libcec v0.1. see README for details.
[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/*!
42 * @brief Initialise the cec device.
43 * @param strDeviceName How to present this device to other devices.
44 * @return True when initialised, false otherwise.
45 */
46extern DECLSPEC bool cec_init(const char *strDeviceName);
47
48/*!
49 * @brief Close the cec device.
50 * @return True when the device was closed, false otherwise.
51 */
52extern DECLSPEC bool cec_close(void);
53
54/*!
55 * @brief Open a connection to the CEC adapter.
56 * @param strPort The path to the port.
57 * @param iTimeout Connection timeout in ms.
58 * @return True when connected, false otherwise.
59 */
60extern DECLSPEC bool cec_open(const char *strPort, int iTimeout);
61
62/*!
63 * @brief Ping the CEC adapter.
64 * @return True when the ping was succesful, false otherwise.
65 */
66extern DECLSPEC bool cec_ping(void);
67
68/*!
69 * @brief Start the bootloader of the CEC adapter.
70 * @return True when the command was sent succesfully, false otherwise.
71 */
72extern DECLSPEC bool cec_start_bootloader(void);
73
74/*!
75 * @brief Power off connected CEC capable devices.
76 * @return True when the command was sent succesfully, false otherwise.
77 */
78#ifdef __cplusplus
79extern DECLSPEC bool cec_power_off_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST);
80#else
81extern DECLSPEC bool cec_power_off_devices(cec_logical_address address = CECDEVICE_BROADCAST);
82#endif
83
84/*!
85 * @brief Power on the connected CEC capable devices.
86 * @return True when the command was sent succesfully, false otherwise.
87 */
88#ifdef __cplusplus
89extern DECLSPEC bool cec_power_on_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST);
90#else
91extern DECLSPEC bool cec_power_on_devices(cec_logical_address address = CECDEVICE_BROADCAST);
92#endif
93
94/*!
95 * @brief Put connected CEC capable devices in standby mode.
96 * @return True when the command was sent succesfully, false otherwise.
97 */
98#ifdef __cplusplus
99extern DECLSPEC bool cec_standby_devices(CEC::cec_logical_address address = CEC::CECDEVICE_BROADCAST);
100#else
101extern DECLSPEC bool cec_standby_devices(cec_logical_address address = CECDEVICE_BROADCAST);
102#endif
103
104/*!
105 * @brief Set this device as the active source on connected CEC capable devices.
106 * @return True when the command was sent succesfully, false otherwise.
107 */
108extern DECLSPEC bool cec_set_active_view(void);
109
110/*!
111 * @brief Mark this device as inactive on connected CEC capable devices.
112 * @return True when the command was sent succesfully, false otherwise.
113 */
114extern DECLSPEC bool cec_set_inactive_view(void);
115
116/*!
117 * @brief Get the next log message in the queue, if there is one.
118 * @param message The next message.
119 * @return True if a message was passed, false otherwise.
120 */
121#ifdef __cplusplus
122extern DECLSPEC bool cec_get_next_log_message(CEC::cec_log_message *message);
123#else
124extern DECLSPEC bool cec_get_next_log_message(cec_log_message *message);
125#endif
126
127/*!
128 * @brief Get the next keypress in the queue, if there is one.
129 * @param key The next keypress
130 * @return True if a key was passed, false otherwise.
131 */
132#ifdef __cplusplus
133extern DECLSPEC bool cec_get_next_keypress(CEC::cec_keypress *key);
134#else
135extern DECLSPEC bool cec_get_next_keypress(cec_keypress *key);
136#endif
137
138/*!
139 * @brief Transmit a frame and wait for ACK.
140 * @param data The frame to send.
141 * @return True when the data was sent and acked, false otherwise.
142 */
143#ifdef __cplusplus
144extern DECLSPEC bool cec_transmit(const CEC::cec_frame &data, bool bWaitForAck = true, int64_t iTimeout = (int64_t) 5000);
145#else
146extern DECLSPEC bool cec_transmit(const cec_frame &data, bool bWaitForAck = true, int64_t iTimeout = (int64_t) 5000);
147#endif
148
149/*!
150 * @brief Set the ack mask for the CEC adapter.
151 * @param ackmask The new ack mask.
152 * @return True when the ack mask was sent succesfully, false otherwise.
153 */
154extern DECLSPEC bool cec_set_ack_mask(uint16_t ackmask);
155
156extern DECLSPEC int cec_get_min_version(void);
157extern DECLSPEC int cec_get_lib_version(void);
158
159#ifdef __cplusplus
160extern DECLSPEC int cec_find_devices(std::vector<CEC::cec_device> &deviceList, const char *strDevicePath = NULL);
161#else
162extern DECLSPEC int cec_find_devices(std::vector<cec_device> &deviceList, const char *strDevicePath = NULL);
163#endif
164
165#ifdef __cplusplus
166};
167#endif
168
169#endif /* CECEXPORTS_C_H_ */