cec: moved TransmitDeckStatus() to CCECPlaybackDevice
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 10 Nov 2011 17:30:00 +0000 (18:30 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 10 Nov 2011 18:00:33 +0000 (19:00 +0100)
src/lib/devices/CECBusDevice.cpp
src/lib/devices/CECBusDevice.h
src/lib/devices/CECPlaybackDevice.cpp
src/lib/devices/CECPlaybackDevice.h
src/lib/implementations/CECCommandHandler.cpp

index e061619e36a15b9ebe77b65eb3596778b7bdc35c..640534d457c2062365ddd4881ce5834cdaef7b91 100644 (file)
@@ -436,17 +436,6 @@ bool CCECBusDevice::TransmitCECVersion(cec_logical_address dest)
   return m_processor->Transmit(command);
 }
 
-bool CCECBusDevice::TransmitDeckStatus(cec_logical_address dest)
-{
-  // need to support opcodes play and deck control before doing anything with this
-  CStdString strLog;
-  strLog.Format("<< %s (%X) -> %s (%X): deck status feature abort", GetLogicalAddressName(), m_iLogicalAddress, CCECCommandHandler::ToString(dest), dest);
-  AddLog(CEC_LOG_NOTICE, strLog);
-
-  m_processor->TransmitAbort(dest, CEC_OPCODE_GIVE_DECK_STATUS);
-  return false;
-}
-
 bool CCECBusDevice::TransmitInactiveView(void)
 {
   CStdString strLog;
index 04026489023c0c1a1cf299a80f01a325d09ff36d..6e599673881e08b92e3d43ded82f30f9c8c9f67a 100644 (file)
@@ -83,7 +83,6 @@ namespace CEC
     virtual bool TransmitActiveSource(void);
     virtual bool TransmitActiveView(void);
     virtual bool TransmitCECVersion(cec_logical_address dest);
-    virtual bool TransmitDeckStatus(cec_logical_address dest);
     virtual bool TransmitInactiveView(void);
     virtual bool TransmitMenuState(cec_logical_address dest);
     virtual bool TransmitOSDName(cec_logical_address dest);
index 17ef319ac232b47097ed57d6bbbf8de433731403..d96d5c9f374b3f34499238af4861f7f32e8fc987 100644 (file)
  */
 
 #include "CECPlaybackDevice.h"
+#include "../implementations/CECCommandHandler.h"
+#include "../CECProcessor.h"
 
 using namespace CEC;
 
 CCECPlaybackDevice::CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
     CCECBusDevice(processor, address, iPhysicalAddress)
 {
-  m_type          = CEC_DEVICE_TYPE_PLAYBACK_DEVICE;
+  m_type = CEC_DEVICE_TYPE_PLAYBACK_DEVICE;
+}
+
+bool CCECPlaybackDevice::TransmitDeckStatus(cec_logical_address dest)
+{
+  // need to support opcodes play and deck control before doing anything with this
+  CStdString strLog;
+  strLog.Format("<< %s (%X) -> %s (%X): deck status feature abort", GetLogicalAddressName(), m_iLogicalAddress, CCECCommandHandler::ToString(dest), dest);
+  AddLog(CEC_LOG_NOTICE, strLog);
+
+  m_processor->TransmitAbort(dest, CEC_OPCODE_GIVE_DECK_STATUS);
+  return false;
 }
index 2b13508375f3b9649a634c3f2f3a1e16dc7cb3cb..1af94855843406fc9bda28de9ba63fb980490d95 100644 (file)
@@ -40,5 +40,7 @@ namespace CEC
   public:
     CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
     virtual ~CCECPlaybackDevice(void) {};
+
+    virtual bool TransmitDeckStatus(cec_logical_address dest);
   };
 }
index bc345a410bb9615079c43ff80e6f9e68480d0c97..2f6dd699dcff1c493d82fc964f007f6e38b8eaca 100644 (file)
@@ -33,6 +33,7 @@
 #include "CECCommandHandler.h"
 #include "../devices/CECBusDevice.h"
 #include "../devices/CECAudioSystem.h"
+#include "../devices/CECPlaybackDevice.h"
 #include "../CECProcessor.h"
 
 using namespace CEC;
@@ -210,8 +211,8 @@ bool CCECCommandHandler::HandleGiveAudioStatus(const cec_command &command)
 bool CCECCommandHandler::HandleGiveDeckStatus(const cec_command &command)
 {
   CCECBusDevice *device = GetDevice(command.destination);
-  if (device)
-    return device->TransmitDeckStatus(command.initiator);
+  if (device && device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE)
+    return ((CCECPlaybackDevice *) device)->TransmitDeckStatus(command.initiator);
 
   return false;
 }