CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress) :
m_iPhysicalAddress(iPhysicalAddress),
+ m_iStreamPath(0),
m_iLogicalAddress(iLogicalAddress),
m_powerStatus(CEC_POWER_STATUS_UNKNOWN),
m_processor(processor),
m_bMenuActive(true),
m_iVendorClass(CEC_VENDOR_UNKNOWN),
m_iLastActive(0),
- m_cecVersion(CEC_VERSION_1_3A)
+ m_cecVersion(CEC_VERSION_UNKNOWN)
{
m_handler = new CCECCommandHandler(this);
CLockObject lock(&m_mutex);
if (m_iLastActive > 0 && m_iLogicalAddress != CECDEVICE_BROADCAST &&
m_vendor.vendor == CEC_VENDOR_UNKNOWN &&
- GetTimeMs() - m_iLastActive > 5000)
+ GetTimeMs() - m_iLastActive > 5000 &&
+ !m_processor->IsMonitoring())
{
+ CStdString strLog;
+ strLog.Format("<< requesting vendor ID of device %x", m_iLogicalAddress);
+ AddLog(CEC_LOG_NOTICE, strLog);
m_iLastActive = GetTimeMs();
cec_command command;
{
if (!MyLogicalAddressContains(m_iLogicalAddress))
{
- AddLog(CEC_LOG_NOTICE, "<< requesting CEC version");
+ CStdString strLog;
+ strLog.Format("<< requesting CEC version of device %x", m_iLogicalAddress);
+ AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_CEC_VERSION);
CLockObject lock(&m_mutex);
{
if (!MyLogicalAddressContains(m_iLogicalAddress))
{
- AddLog(CEC_LOG_NOTICE, "<< requesting menu language");
+ CStdString strLog;
+ strLog.Format("<< requesting menu language of device %x", m_iLogicalAddress);
+ AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_MENU_LANGUAGE);
CLockObject lock(&m_mutex);
{
if (!MyLogicalAddressContains(m_iLogicalAddress))
{
- AddLog(CEC_LOG_NOTICE, "<< requesting power status");
+ CStdString strLog;
+ strLog.Format("<< requesting power status of device %x", m_iLogicalAddress);
+ AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS);
CLockObject lock(&m_mutex);
{
if (!MyLogicalAddressContains(m_iLogicalAddress))
{
- AddLog(CEC_LOG_NOTICE, "<< requesting vendor ID");
+ CStdString strLog;
+ strLog.Format("<< requesting vendor ID of device %x", m_iLogicalAddress);
+ AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
CLockObject lock(&m_mutex);
switch (newVersion)
{
case CEC_VERSION_1_2:
- strLog.Format("device %d reports CEC version 1.2", m_iLogicalAddress);
+ strLog.Format("device %d: CEC version 1.2", m_iLogicalAddress);
break;
case CEC_VERSION_1_2A:
- strLog.Format("device %d reports CEC version 1.2a", m_iLogicalAddress);
+ strLog.Format("device %d: CEC version 1.2a", m_iLogicalAddress);
break;
case CEC_VERSION_1_3:
- strLog.Format("device %d reports CEC version 1.3", m_iLogicalAddress);
+ strLog.Format("device %d: CEC version 1.3", m_iLogicalAddress);
break;
case CEC_VERSION_1_3A:
- strLog.Format("device %d reports CEC version 1.3a", m_iLogicalAddress);
+ strLog.Format("device %d: CEC version 1.3a", m_iLogicalAddress);
break;
default:
- strLog.Format("device %d reports an unknown CEC version", m_iLogicalAddress);
+ strLog.Format("device %d: unknown CEC version", m_iLogicalAddress);
m_cecVersion = CEC_VERSION_UNKNOWN;
break;
}
}
}
-void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */)
+void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress)
{
if (iNewAddress > 0)
{
}
}
-void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus)
+void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */)
{
- if (m_powerStatus != powerStatus)
+ if (iNewAddress > 0)
{
CStdString strLog;
- strLog.Format("device %d power status changed from %2x to %2x", m_iLogicalAddress, m_powerStatus, powerStatus);
- m_processor->AddLog(CEC_LOG_DEBUG, strLog);
- m_powerStatus = powerStatus;
+ strLog.Format(">> %i stream path from %04x to %04x", m_iLogicalAddress, iOldAddress, iNewAddress);
+ AddLog(CEC_LOG_DEBUG, strLog.c_str());
+
+ m_iStreamPath = iNewAddress;
}
}
-void CCECBusDevice::SetVendorId(const cec_datapacket &data)
+void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus)
{
- if (data.size < 3)
+ if (m_powerStatus != powerStatus)
{
- AddLog(CEC_LOG_WARNING, "invalid vendor ID received");
- return;
+ CStdString strLog;
+ strLog.Format("device %d power status changed from %2x to %2x", m_iLogicalAddress, m_powerStatus, powerStatus);
+ m_processor->AddLog(CEC_LOG_DEBUG, strLog);
+ m_powerStatus = powerStatus;
}
-
- uint64_t iVendorId = ((uint64_t)data[0] << 3) +
- ((uint64_t)data[1] << 2) +
- (uint64_t)data[2];
-
- SetVendorId(iVendorId, data.size >= 4 ? data[3] : 0);
}
void CCECBusDevice::SetVendorId(uint64_t iVendorId, uint8_t iVendorClass /* = 0 */)
bool CCECBusDevice::TransmitActiveSource(void)
{
CStdString strLog;
- strLog.Format("<< %x -> broadcast: active source", m_iLogicalAddress);
+ strLog.Format("<< %x -> broadcast: active source (%4x)", m_iLogicalAddress, m_iPhysicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
bool CCECBusDevice::TransmitActiveView(void)
{
CStdString strLog;
- strLog.Format("<< %x -> broadcast: active view", m_iLogicalAddress);
+ strLog.Format("<< %x -> broadcast: active view (%4x)", m_iLogicalAddress, m_iPhysicalAddress);
AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
cec_command::format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
command.parameters.push_back((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF));
command.parameters.push_back((uint8_t) (m_iPhysicalAddress & 0xFF));
- command.parameters.push_back((uint8_t) (CEC_DEVICE_TYPE_PLAYBACK_DEVICE));
+ command.parameters.push_back((uint8_t) (m_type));
return m_processor->Transmit(command);
}