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/
33 #include "CECParser.h"
39 * C interface implementation
42 ICECDevice
*cec_parser
;
44 bool cec_init(const char *strDeviceName
, cec_logical_address iLogicalAddress
/* = CECDEVICE_PLAYBACKDEVICE1 */, int iPhysicalAddress
/* = CEC_DEFAULT_PHYSICAL_ADDRESS */)
46 cec_parser
= (ICECDevice
*) CECCreate(strDeviceName
, iLogicalAddress
, iPhysicalAddress
);
47 return (cec_parser
!= NULL
);
50 bool cec_open(const char *strPort
, int iTimeout
)
53 return cec_parser
->Open(strPort
, iTimeout
);
57 bool cec_close(int iTimeout
)
61 bReturn
= cec_parser
->Close(iTimeout
);
71 return cec_parser
->Ping();
75 bool cec_start_bootloader(void)
78 return cec_parser
->StartBootloader();
82 bool cec_power_off_devices(cec_logical_address address
/* = CECDEVICE_BROADCAST */)
85 return cec_parser
->PowerOffDevices(address
);
89 bool cec_power_on_devices(cec_logical_address address
/* = CECDEVICE_BROADCAST */)
92 return cec_parser
->PowerOnDevices(address
);
96 bool cec_standby_devices(cec_logical_address address
/* = CECDEVICE_BROADCAST */)
99 return cec_parser
->StandbyDevices(address
);
103 bool cec_set_active_view(void)
106 return cec_parser
->SetActiveView();
110 bool cec_set_inactive_view(void)
113 return cec_parser
->SetInactiveView();
117 bool cec_get_next_log_message(cec_log_message
*message
)
120 return cec_parser
->GetNextLogMessage(message
);
124 bool cec_get_next_keypress(cec_keypress
*key
)
127 return cec_parser
->GetNextKeypress(key
);
131 bool cec_get_next_command(cec_command
*command
)
134 return cec_parser
->GetNextCommand(command
);
138 bool cec_transmit(const CEC::cec_frame
&data
, bool bWaitForAck
/* = true */, int64_t iTimeout
/* = 2000 */)
141 return cec_parser
->Transmit(data
, bWaitForAck
, iTimeout
);
145 bool cec_set_logical_address(cec_logical_address iLogicalAddress
)
148 return cec_parser
->SetLogicalAddress(iLogicalAddress
);
152 bool cec_set_ack_mask(uint16_t iMask
)
155 return cec_parser
->SetAckMask(iMask
);
159 int cec_get_min_version(void)
162 return cec_parser
->GetMinVersion();
166 int cec_get_lib_version(void)
169 return cec_parser
->GetLibVersion();
173 int cec_find_devices(vector
<cec_device
> &deviceList
, const char *strDevicePath
/* = NULL */)
176 return cec_parser
->FindDevices(deviceList
, strDevicePath
);