cec: set a device type and name for each CCECBusDevice
authorLars Op den Kamp <lars@opdenkamp.eu>
Sun, 6 Nov 2011 03:09:22 +0000 (04:09 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 6 Nov 2011 03:11:49 +0000 (04:11 +0100)
src/lib/devices/CECBusDevice.cpp
src/lib/devices/CECBusDevice.h

index d9855379610600f7ded92bef0d85b5a1461d68cf..2a0dc89b552476061e8ff47e2f9d89e0766c96a1 100644 (file)
@@ -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)
index 362e86ed4c0d146e12455d75e79453b10093e003..8d5eafb92a2c2b86423c797a349efcb6a365be2a 100644 (file)
@@ -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;