cec: added Toshiba's vendor id, and set the device ID of the primary device to Toshib...
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 21 Feb 2012 12:10:49 +0000 (13:10 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 21 Feb 2012 12:10:49 +0000 (13:10 +0100)
include/cectypes.h
project/libcec.vcxproj
project/libcec.vcxproj.filters
src/lib/CECProcessor.cpp
src/lib/Makefile.am
src/lib/devices/CECBusDevice.h
src/lib/implementations/RLCommandHandler.cpp [new file with mode: 0644]
src/lib/implementations/RLCommandHandler.h [new file with mode: 0644]

index 5f25b9437e2f58d9b3c087a4d00f7376a8fd9cb4..5b05b13210d90d7436868cec3153260a91c78edb 100644 (file)
@@ -620,6 +620,7 @@ typedef enum cec_vendor_id
   CEC_VENDOR_YAMAHA    = 0x00A0DE,
   CEC_VENDOR_PHILIPS   = 0x00903E,
   CEC_VENDOR_SONY      = 0x080046,
+  CEC_VENDOR_TOSHIBA   = 0x000039,
   CEC_VENDOR_UNKNOWN   = 0
 } cec_vendor_id;
 
index 0ca4ccafb3ab20a0f107c9d12ab500fb0e46d127..3c1e89b837222c5325caf766a1bdb2899582cf4d 100644 (file)
@@ -36,6 +36,7 @@
     <ClInclude Include="..\src\lib\devices\CECTV.h" />
     <ClInclude Include="..\src\lib\implementations\ANCommandHandler.h" />
     <ClInclude Include="..\src\lib\implementations\CECCommandHandler.h" />
+    <ClInclude Include="..\src\lib\implementations\RLCommandHandler.h" />
     <ClInclude Include="..\src\lib\implementations\SLCommandHandler.h" />
     <ClInclude Include="..\src\lib\implementations\VLCommandHandler.h" />
     <ClInclude Include="..\src\lib\LibCEC.h" />
@@ -66,6 +67,7 @@
     <ClCompile Include="..\src\lib\devices\CECTV.cpp" />
     <ClCompile Include="..\src\lib\implementations\ANCommandHandler.cpp" />
     <ClCompile Include="..\src\lib\implementations\CECCommandHandler.cpp" />
+    <ClCompile Include="..\src\lib\implementations\RLCommandHandler.cpp" />
     <ClCompile Include="..\src\lib\implementations\SLCommandHandler.cpp" />
     <ClCompile Include="..\src\lib\implementations\VLCommandHandler.cpp" />
     <ClCompile Include="..\src\lib\LibCEC.cpp" />
index a85f501934f38b3a36245e205f3f472b60a3412b..56f1a464a29d6120280b634ab8b04d097e78c28f 100644 (file)
     <ClInclude Include="..\src\lib\adapter\USBCECAdapterMessage.h">
       <Filter>adapter</Filter>
     </ClInclude>
+    <ClInclude Include="..\src\lib\implementations\RLCommandHandler.h">
+      <Filter>implementations</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\src\lib\CECProcessor.cpp" />
     <ClCompile Include="..\src\lib\adapter\USBCECAdapterDetection.cpp">
       <Filter>adapter</Filter>
     </ClCompile>
+    <ClCompile Include="..\src\lib\implementations\RLCommandHandler.cpp">
+      <Filter>implementations</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="libcec.rc" />
index 63009a87202617066ab8ef96227a83381d6790b2..ae0a013634e98962c9bc46372f63e9b688071122 100644 (file)
@@ -1363,6 +1363,8 @@ const char *CCECProcessor::ToString(const cec_vendor_id vendor)
     return "Philips";
   case CEC_VENDOR_SONY:
     return "Sony";
+  case CEC_VENDOR_TOSHIBA:
+    return "Toshiba";
   default:
     return "Unknown";
   }
index 5df7c60021140b6a677ab0190956f5a8d93d172e..083775f6fbc63578cf9c07d3a140834e332c51f3 100644 (file)
@@ -23,6 +23,7 @@ libcec_la_SOURCES = CECProcessor.cpp \
                     implementations/CECCommandHandler.cpp \
                     implementations/SLCommandHandler.cpp \
                     implementations/VLCommandHandler.cpp \
+                                       implementations/RLCommandHandler.cpp \
                     platform/posix/serialport.cpp
 
 libcec_la_LDFLAGS = @LIBS@ -version-info @VERSION@
index 5428ec1c8ddbf7f35ed415f5fd159bc742f9bb25..30ac2dc788df51c50251eaae0c8a4488799ccc03 100644 (file)
@@ -40,12 +40,10 @@ namespace CEC
 {
   class CCECProcessor;
   class CCECCommandHandler;
-  class CSLCommandHandler;
 
   class CCECBusDevice
   {
     friend class CCECProcessor;
-    friend class CSLCommandHandler;
 
   public:
     CCECBusDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
@@ -108,9 +106,10 @@ namespace CEC
     virtual bool TransmitKeypress(cec_user_control_code key, bool bWait = true);
     virtual bool TransmitKeyRelease(bool bWait = true);
 
+    bool ReplaceHandler(bool bActivateSource = true);
+
   protected:
     void CheckVendorIdRequested(void);
-    bool ReplaceHandler(bool bActivateSource = true);
     void MarkBusy(void);
     void MarkReady(void);
 
diff --git a/src/lib/implementations/RLCommandHandler.cpp b/src/lib/implementations/RLCommandHandler.cpp
new file mode 100644 (file)
index 0000000..c7e4682
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "RLCommandHandler.h"
+#include "../devices/CECBusDevice.h"
+#include "../CECProcessor.h"
+#include "../LibCEC.h"
+
+using namespace CEC;
+using namespace PLATFORM;
+
+CRLCommandHandler::CRLCommandHandler(CCECBusDevice *busDevice) :
+    CCECCommandHandler(busDevice)
+{
+  m_vendorId = CEC_VENDOR_PANASONIC;
+  CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+
+  /* imitate Panasonice devices */
+  if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
+  {
+    primary->SetVendorId(CEC_VENDOR_PANASONIC);
+    primary->ReplaceHandler(false);
+  }
+}
+
+bool CRLCommandHandler::InitHandler(void)
+{
+  if (m_bHandlerInited)
+    return true;
+  m_bHandlerInited = true;
+
+  if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+  {
+    CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+
+    /* send the vendor id */
+    primary->TransmitVendorID(CECDEVICE_BROADCAST);
+  }
+
+  return true;
+}
diff --git a/src/lib/implementations/RLCommandHandler.h b/src/lib/implementations/RLCommandHandler.h
new file mode 100644 (file)
index 0000000..944a649
--- /dev/null
@@ -0,0 +1,47 @@
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "CECCommandHandler.h"
+#include "../platform/util/timeutils.h"
+
+namespace CEC
+{
+  class CRLCommandHandler : public CCECCommandHandler
+  {
+  public:
+    CRLCommandHandler(CCECBusDevice *busDevice);
+    virtual ~CRLCommandHandler(void) {};
+
+    virtual bool InitHandler(void);
+  };
+};