From: Lars Op den Kamp Date: Sun, 6 Nov 2011 03:09:22 +0000 (+0100) Subject: cec: set a device type and name for each CCECBusDevice X-Git-Tag: upstream/2.2.0~1^2~111 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1fcf5a3f2cab008b87b648a3f4a71391a54e70f9;p=deb_libcec.git cec: set a device type and name for each CCECBusDevice --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index d985537..2a0dc89 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -54,6 +54,35 @@ CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogi m_menuLanguage.language[3] = 0; m_menuLanguage.device = iLogicalAddress; m_vendor.vendor = CEC_VENDOR_UNKNOWN; + + switch(iLogicalAddress) + { + case CECDEVICE_AUDIOSYSTEM: + m_type = CEC_DEVICE_TYPE_AUDIO_SYSTEM; + m_strDeviceName = "Audio"; + case CECDEVICE_PLAYBACKDEVICE1: + case CECDEVICE_PLAYBACKDEVICE2: + case CECDEVICE_PLAYBACKDEVICE3: + m_type = CEC_DEVICE_TYPE_PLAYBACK_DEVICE; + m_strDeviceName = "Player"; + case CECDEVICE_RECORDINGDEVICE1: + case CECDEVICE_RECORDINGDEVICE2: + case CECDEVICE_RECORDINGDEVICE3: + m_type = CEC_DEVICE_TYPE_RECORDING_DEVICE; + m_strDeviceName = "Recorder"; + case CECDEVICE_TUNER1: + case CECDEVICE_TUNER2: + case CECDEVICE_TUNER3: + case CECDEVICE_TUNER4: + m_type = CEC_DEVICE_TYPE_TUNER; + m_strDeviceName = "Tuner"; + case CECDEVICE_TV: + m_type = CEC_DEVICE_TYPE_TV; + m_strDeviceName = "TV"; + default: + m_type = CEC_DEVICE_TYPE_RESERVED; + m_strDeviceName = "Unknown"; + } } CCECBusDevice::~CCECBusDevice(void) diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 362e86e..8d5eafb 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -92,6 +92,8 @@ namespace CEC virtual bool BroadcastActiveSource(void); protected: + cec_device_type m_type; + CStdString m_strDeviceName; uint16_t m_iPhysicalAddress; cec_logical_address m_iLogicalAddress; cec_power_status m_powerStatus;