bool CTDA995xCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses) { unsigned char log_addr = addresses.primary; if (m_dev->Ioctl(CEC_IOCTL_RX_ADDR, &log_addr) != 0) { LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: CEC_IOCTL_RX_ADDR failed !", __func__); return false; } cec_rx_mask all_addresses; all_addresses.SwitchOn = addresses.AckMask() & 0x7fff; all_addresses.SwitchOff = ~all_addresses.SwitchOn; if (all_addresses.SwitchOn != (1 << addresses.primary) && m_dev->Ioctl(CEC_IOCTL_SET_RX_ADDR_MASK, &all_addresses) != 0) { LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: CEC_IOCTL_SET_RX_ADDR_MASK failed !", __func__); return false; } m_bLogicalAddressChanged = true; return true; }
void CCECDeviceMap::GetByLogicalAddresses(CECDEVICEVEC &devices, const cec_logical_addresses &addresses) { for (CECDEVICEMAP::const_iterator it = m_busDevices.begin(); it != m_busDevices.end(); it++) { if (addresses.IsSet(it->first)) devices.push_back(it->second); } }
void CPeripheralCecAdapter::ReadLogicalAddresses(const CStdString &strString, cec_logical_addresses &addresses) { for (size_t iPtr = 0; iPtr < strString.size(); iPtr++) { CStdString strDevice = CStdString(strString.substr(iPtr, 1)).Trim(); if (!strDevice.IsEmpty()) { int iDevice(0); if (sscanf(strDevice.c_str(), "%x", &iDevice) == 1 && iDevice >= 0 && iDevice <= 0xF) addresses.Set((cec_logical_address)iDevice); } } }
bool CUSBCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses) { { CLockObject lock(m_mutex); if (m_logicalAddresses == addresses) return true; } if (IsOpen() && m_commands->SetAckMask(addresses.AckMask())) { CLockObject lock(m_mutex); m_logicalAddresses = addresses; return true; } LIB_CEC->AddLog(CEC_LOG_DEBUG, "couldn't change the ackmask: the connection is closed"); return false; }