void CLibCEC::Close(void)
{
+ if (!m_cec)
+ return;
+
// unregister all clients
- UnregisterClients();
+ m_cec->UnregisterClients();
// close the connection
- if (m_cec)
- m_cec->Close();
+ m_cec->Close();
}
int8_t CLibCEC::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */)
{
+ if (!CUSBCECAdapterDetection::CanAutodetect())
+ {
+ AddLog(CEC_LOG_WARNING, "libCEC has not been compiled with adapter detection code for this target, so the path to the COM port has to be provided to libCEC");
+ return 0;
+ }
+
return CUSBCECAdapterDetection::FindAdapters(deviceList, iBufSize, strDevicePath);
}
(*it)->AddLog(message);
}
+void CLibCEC::AddCommand(const cec_command &command)
+{
+ // send the command to all clients
+ for (vector<CCECClient *>::iterator it = m_clients.begin(); it != m_clients.end(); it++)
+ (*it)->AddCommand(command);
+}
+
void CLibCEC::Alert(const libcec_alert type, const libcec_parameter ¶m)
{
// send the alert to all clients
return static_cast< void* > (lib);
}
-void * CECInit(const char *strDeviceName, CEC::cec_device_type_list types, uint16_t iPhysicalAddress /* = 0 */)
+void * CECInit(const char *strDeviceName, CEC::cec_device_type_list types)
{
- libcec_configuration configuration;
+ libcec_configuration configuration; configuration.Clear();
// client version < 1.5.0
snprintf(configuration.strDeviceName, 13, "%s", strDeviceName);
configuration.deviceTypes = types;
- configuration.iPhysicalAddress = iPhysicalAddress;
+ configuration.iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS;
if (configuration.deviceTypes.IsEmpty())
configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
return CECInitialise(&configuration);
}
+void * CECCreate(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress /* = CEC::CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS */)
+{
+ libcec_configuration configuration; configuration.Clear();
+
+ // client version < 1.5.0
+ snprintf(configuration.strDeviceName, 13, "%s", strDeviceName);
+ configuration.iPhysicalAddress = iPhysicalAddress;
+ configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
+
+ return CECInitialise(&configuration);
+}
+
bool CECStartBootloader(void)
{
bool bReturn(false);
// no longer being used
void CLibCEC::AddKey(const cec_keypress &UNUSED(key)) {}
-void CLibCEC::AddCommand(const cec_command &UNUSED(command)) {}
void CLibCEC::ConfigurationChanged(const libcec_configuration &UNUSED(config)) {}
void CLibCEC::SetCurrentButton(cec_user_control_code UNUSED(iButtonCode)) {}
CLibCEC *CLibCEC::GetInstance(void) { return NULL; }