m_cec->m_busDevices[m_cec->GetActiveSource()]->GetStatus(false) == CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC :
false;
}
+
+cec_device_type CLibCEC::GetType(cec_logical_address address)
+{
+ switch (address)
+ {
+ case CECDEVICE_AUDIOSYSTEM:
+ return CEC_DEVICE_TYPE_AUDIO_SYSTEM;
+ case CECDEVICE_PLAYBACKDEVICE1:
+ case CECDEVICE_PLAYBACKDEVICE2:
+ case CECDEVICE_PLAYBACKDEVICE3:
+ return CEC_DEVICE_TYPE_PLAYBACK_DEVICE;
+ case CECDEVICE_RECORDINGDEVICE1:
+ case CECDEVICE_RECORDINGDEVICE2:
+ case CECDEVICE_RECORDINGDEVICE3:
+ return CEC_DEVICE_TYPE_RECORDING_DEVICE;
+ case CECDEVICE_TUNER1:
+ case CECDEVICE_TUNER2:
+ case CECDEVICE_TUNER3:
+ case CECDEVICE_TUNER4:
+ return CEC_DEVICE_TYPE_TUNER;
+ case CECDEVICE_TV:
+ return CEC_DEVICE_TYPE_TV;
+ default:
+ return CEC_DEVICE_TYPE_RESERVED;
+ }
+}
const char *ToString(const cec_vendor_id vendor);
const char *ToString(const cec_client_version version);
const char *ToString(const cec_server_version version);
+
+ static cec_device_type GetType(cec_logical_address address);
//@}
static void AddLog(const cec_log_level level, const char *strFormat, ...);
bool bReturn(true);
bReturn &= SetAutoEnabled(true);
+ bReturn &= SetDeviceType(CLibCEC::GetType(configuration->logicalAddresses.primary));
bReturn &= SetDefaultLogicalAddress(configuration->logicalAddresses.primary);
bReturn &= SetLogicalAddressMask(configuration->logicalAddresses.AckMask());
bReturn &= SetPhysicalAddress(configuration->iPhysicalAddress);
return true;
}
+bool CUSBCECAdapterCommunication::SetDeviceType(cec_device_type type)
+{
+ CLockObject lock(m_mutex);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the device type to %1X", (uint8_t)type);
+
+ CCECAdapterMessage *output = new CCECAdapterMessage;
+
+ output->PushBack(MSGSTART);
+ output->PushEscaped(MSGCODE_SET_DEVICE_TYPE);
+ output->PushEscaped((uint8_t)type);
+ output->PushBack(MSGEND);
+ output->isTransmission = false;
+
+ SendMessageToAdapter(output);
+ bool bWriteOk = output->state == ADAPTER_MESSAGE_STATE_SENT_ACKED;
+ delete output;
+ if (!bWriteOk)
+ {
+ CLibCEC::AddLog(CEC_LOG_ERROR, "could not set the device type");
+ return false;
+ }
+
+ return true;
+}
+
bool CUSBCECAdapterCommunication::SetDefaultLogicalAddress(cec_logical_address address)
{
CLockObject lock(m_mutex);
void *Process(void);
private:
bool SetAutoEnabled(bool enabled);
+ bool SetDeviceType(cec_device_type type);
bool SetDefaultLogicalAddress(cec_logical_address address);
bool SetLogicalAddressMask(uint16_t iMask);
bool SetPhysicalAddress(uint16_t iPhysicalAddress);