2 * This file is part of the libCEC(R) library.
4 * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
5 * libCEC(R) is an original work, containing original code.
7 * libCEC(R) is a trademark of Pulse-Eight Limited.
9 * This program is dual-licensed; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * Alternatively, you can license this library under a commercial license,
25 * please contact Pulse-Eight Licensing for more information.
27 * For more information contact:
28 * Pulse-Eight Licensing <license@pulse-eight.com>
29 * http://www.pulse-eight.com/
30 * http://www.pulse-eight.net/
40 * C interface implementation
43 ICECAdapter
*cec_parser
;
45 int cec_init(const char *strDeviceName
, cec_logical_address iLogicalAddress
/* = CECDEVICE_PLAYBACKDEVICE1 */, uint8_t iPhysicalAddress
/* = CEC_DEFAULT_PHYSICAL_ADDRESS */)
47 cec_parser
= (ICECAdapter
*) CECCreate(strDeviceName
, iLogicalAddress
, iPhysicalAddress
);
48 return (cec_parser
!= NULL
) ? 1 : 0;
51 void cec_destroy(void)
54 CECDestroy(cec_parser
);
58 int cec_open(const char *strPort
, uint32_t iTimeout
)
61 return cec_parser
->Open(strPort
, iTimeout
);
71 int8_t cec_find_adapters(cec_adapter
*deviceList
, uint8_t iBufSize
, const char *strDevicePath
/* = NULL */)
74 return cec_parser
->FindAdapters(deviceList
, iBufSize
, strDevicePath
);
78 int cec_ping_adapters(void)
81 return cec_parser
->PingAdapter() ? 1 : 0;
85 int cec_start_bootloader(void)
88 return cec_parser
->StartBootloader() ? 1 : 0;
92 int8_t cec_get_min_version(void)
95 return cec_parser
->GetMinVersion();
99 int8_t cec_get_lib_version(void)
102 return cec_parser
->GetLibVersion();
106 int cec_get_next_log_message(cec_log_message
*message
)
109 return cec_parser
->GetNextLogMessage(message
) ? 1 : 0;
113 int cec_get_next_keypress(cec_keypress
*key
)
116 return cec_parser
->GetNextKeypress(key
) ? 1 : 0;
120 int cec_get_next_command(cec_command
*command
)
123 return cec_parser
->GetNextCommand(command
) ? 1 : 0;
127 int cec_transmit(const CEC::cec_command
&data
)
130 return cec_parser
->Transmit(data
) ? 1 : 0;
134 int cec_set_logical_address(cec_logical_address iLogicalAddress
/* = CECDEVICE_PLAYBACKDEVICE1 */)
137 return cec_parser
->SetLogicalAddress(iLogicalAddress
) ? 1 : 0;
141 int cec_set_physical_address(uint16_t iPhysicalAddress
/* = CEC_DEFAULT_PHYSICAL_ADDRESS */)
144 return cec_parser
->SetPhysicalAddress(iPhysicalAddress
) ? 1 : 0;
148 int cec_power_on_devices(cec_logical_address address
/* = CECDEVICE_TV */)
151 return cec_parser
->PowerOnDevices(address
) ? 1 : 0;
155 int cec_standby_devices(cec_logical_address address
/* = CECDEVICE_BROADCAST */)
158 return cec_parser
->StandbyDevices(address
) ? 1 : 0;
162 int cec_set_active_view(void)
165 return cec_parser
->SetActiveView() ? 1 : 0;
169 int cec_set_inactive_view(void)
172 return cec_parser
->SetInactiveView() ? 1 : 0;
176 int cec_set_osd_string(cec_logical_address iLogicalAddress
, cec_display_control duration
, const char *strMessage
)
179 return cec_parser
->SetOSDString(iLogicalAddress
, duration
, strMessage
) ? 1 : 0;
183 int cec_switch_monitoring(int bEnable
)
186 return cec_parser
->SwitchMonitoring(bEnable
== 1) ? 1 : 0;
190 cec_version
cec_get_device_cec_version(cec_logical_address iLogicalAddress
)
193 return cec_parser
->GetDeviceCecVersion(iLogicalAddress
);
194 return CEC_VERSION_UNKNOWN
;
197 int cec_get_device_menu_language(cec_logical_address iLogicalAddress
, cec_menu_language
*language
)
200 return cec_parser
->GetDeviceMenuLanguage(iLogicalAddress
, language
) ? 1 : 0;