Merge branch 'master' into release
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 3 Nov 2011 23:15:11 +0000 (00:15 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 3 Nov 2011 23:15:11 +0000 (00:15 +0100)
32 files changed:
README
configure.ac
debian/changelog
debian/control
include/cec.h
include/cecc.h
include/cectypes.h
project/bin/7za.exe [deleted file]
project/bin/libeay32.dll [deleted file]
project/bin/libiconv2.dll [deleted file]
project/bin/libintl3.dll [deleted file]
project/bin/libssl32.dll [deleted file]
project/bin/wget.exe [deleted file]
project/download-deps.cmd [deleted file]
project/libcec.rc [new file with mode: 0644]
project/libcec.vcxproj
project/libcec.vcxproj.filters
project/testclient.rc [new file with mode: 0644]
project/testclient.vcxproj
project/testclient.vcxproj.filters
src/lib/AdapterCommunication.cpp
src/lib/AdapterCommunication.h
src/lib/CECProcessor.cpp
src/lib/CECProcessor.h
src/lib/LibCEC.cpp
src/lib/LibCEC.h
src/lib/LibCECC.cpp
src/lib/implementations/ANCommandHandler.cpp
src/lib/platform/linux/serialport.cpp
src/lib/platform/serialport.h
src/lib/platform/windows/serialport.cpp
src/testclient/main.cpp

diff --git a/README b/README
index c5f108074afd835b7b4e7de570c1554458246490..6c23712ff3c8a82c0c22f15d54e653ab231a3f41 100644 (file)
--- a/README
+++ b/README
@@ -7,7 +7,6 @@ To install libCEC on Linux:
 # sudo make install
 
 To install libCEC on Windows:
-* go to /project and execute download-deps.cmd to download Boost.
 * open /project/libcec.sln with Visual C++ 2010 or Visual Studio 2010.
 * build the project.
 * copy libcec.dll and pthreadVC2.dll to your desired destination.
@@ -15,7 +14,6 @@ To install libCEC on Windows:
 To build an installer on Windows:
 * download and install the Windows DDK.
 * download and install NSIS.
-* go to /project and execute download-deps.cmd to download Boost.
 * go to /project and execute create-installer.cmd to create the installer.
 * the installer is stored as /project/libCEC-installer.exe
 
index 3285c89a3856a6580683509657070d065cf89595..e1468648632302caee8433777ca8e76c7c69710f 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT([libcec], 0:8:0)
+AC_INIT([libcec], 1:0:0)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 
 AC_PROG_CXX
@@ -23,13 +23,6 @@ libs_pre_dl=$LIBS
   AC_SUBST([LIBS_DL])
 LIBS=$libs_pre_dl
 
-AC_LANG_PUSH([C++])
-AC_CHECK_HEADERS([boost/shared_ptr.hpp], [],
-    [AC_MSG_ERROR(You need the Boost libraries.)])
-AC_CHECK_HEADERS([boost/enable_shared_from_this.hpp], [],
-    [AC_MSG_ERROR(You need the Boost libraries.)])
-AC_LANG_POP([C++])
-
 CXXFLAGS="-fPIC -Wall -Wextra $CXXFLAGS"
 
 AC_SUBST(REQUIRES)
index 570c071e13b89de2c220ed806628114d8f052e56..dcf8ddf10c4c88b48089af1a6c9bc41d4ca01761 100644 (file)
@@ -1,3 +1,20 @@
+libcec (1.0-2) unstable; urgency=low
+
+  * interface changes:
+    * set lib interface version back to 1.0 and rename GetLibVersion() to
+      GetLibVersionMajor() and GetMinVersion() to GetMinLibVersion()
+    * added GetLibVersionMinor()/cec_get_lib_version_minor() and set the minor
+      version number to 1
+  * fixed:
+    * samsung's vendor specific remote keypresses don't send key releases. added
+      call to AddKey() directly after the keypress
+    * always reset the button press time in CLibCEC::AddKey()
+    * always wait for a signal in CCECProcessor::Transmit()
+  * changed:
+    * drop shared_ptr and use a normal pointer. removed boost dependency
+
+ -- Pulse-Eight Packaging <packaging@pulse-eight.com>  Fri, 04 Nov 2011 00:14:00 +0100
+
 libcec (0.8-2) unstable; urgency=low
 
   * added 'libboost-dev' to build deps
index ad3d09ce473cd8674ef711a3756a53fd1baea412..570934984b4f57f395a546f2f01a66138760a0d2 100644 (file)
@@ -2,7 +2,7 @@ Source: libcec
 Section: video
 Priority: extra
 Maintainer: Lars Op den Kamp <lars.opdenkamp@pulse-eight.com>
-Build-Depends: debhelper (>= 7), libudev-dev, mime-support, locales, gawk, autotools-dev, autoconf, automake, pkg-config, libboost-dev 
+Build-Depends: debhelper (>= 7), libudev-dev, mime-support, locales, gawk, autotools-dev, autoconf, automake, pkg-config
 Standards-Version: 3.8.3
 Homepage: http://www.pulse-eight.net/
 
index 1701df786c16fe7489e356cf76e3ed157ded3f32..19bc4d35e74fbe130ddc73aa5650f9b7f52e8261 100644 (file)
@@ -71,14 +71,19 @@ namespace CEC
     //@}
 
     /*!
-     * @see cec_get_min_version
+     * @see cec_get_min_lib_version
      */
-    virtual int8_t GetMinVersion(void) = 0;
+    virtual int8_t GetMinLibVersion(void) const = 0;
 
     /*!
-     * @see cec_get_lib_version
+     * @see cec_get_lib_version_major
      */
-    virtual int8_t GetLibVersion(void) = 0;
+    virtual int8_t GetLibVersionMajor(void) const = 0;
+
+    /*!
+     * @see cec_get_lib_version_minor
+     */
+    virtual int8_t GetLibVersionMinor(void) const = 0;
 
     /*!
      * @see cec_get_next_log_message
index bec392030e6cd67bce5443ed4f7aa3540efdcac7..e1c2942d877ef9b2d678270ebd2066daf4dc8295 100644 (file)
@@ -98,12 +98,17 @@ extern DECLSPEC int cec_start_bootloader(void);
 /*!
  * @return Get the minimal version of libcec that this version of libcec can interface with.
  */
-extern DECLSPEC int8_t cec_get_min_version(void);
+extern DECLSPEC int8_t cec_get_min_lib_version(void);
 
 /*!
- * @return Get the version of libcec.
+ * @return Get the major version of libcec.
  */
-extern DECLSPEC int8_t cec_get_lib_version(void);
+extern DECLSPEC int8_t cec_get_lib_version_major(void);
+
+/*!
+ * @return Get the minor version of libcec.
+ */
+extern DECLSPEC int8_t cec_get_lib_version_minor(void);
 
 /*!
  * @brief Power on the connected CEC capable devices.
index 5f2edc2f59a604eb01bf9065945bb1be350be150..a347f1bcf71758615005a3c3ae861d17b2e83ffe 100644 (file)
@@ -738,10 +738,12 @@ typedef struct cec_vendor
 #define MSGEND                       0xFE
 #define MSGESC                       0xFD
 #define ESCOFFSET                    3
-#define CEC_MIN_VERSION              8
-#define CEC_LIB_VERSION              8
 #define CEC_BUTTON_TIMEOUT           500
 
+#define CEC_MIN_LIB_VERSION          1
+#define CEC_LIB_VERSION_MAJOR        1
+#define CEC_LIB_VERSION_MINOR        0
+
 #ifdef __cplusplus
 };
 };
diff --git a/project/bin/7za.exe b/project/bin/7za.exe
deleted file mode 100644 (file)
index 8836e99..0000000
Binary files a/project/bin/7za.exe and /dev/null differ
diff --git a/project/bin/libeay32.dll b/project/bin/libeay32.dll
deleted file mode 100644 (file)
index 8d31f86..0000000
Binary files a/project/bin/libeay32.dll and /dev/null differ
diff --git a/project/bin/libiconv2.dll b/project/bin/libiconv2.dll
deleted file mode 100644 (file)
index 544dd92..0000000
Binary files a/project/bin/libiconv2.dll and /dev/null differ
diff --git a/project/bin/libintl3.dll b/project/bin/libintl3.dll
deleted file mode 100644 (file)
index ec11e6b..0000000
Binary files a/project/bin/libintl3.dll and /dev/null differ
diff --git a/project/bin/libssl32.dll b/project/bin/libssl32.dll
deleted file mode 100644 (file)
index a30ff0e..0000000
Binary files a/project/bin/libssl32.dll and /dev/null differ
diff --git a/project/bin/wget.exe b/project/bin/wget.exe
deleted file mode 100644 (file)
index 54b372e..0000000
Binary files a/project/bin/wget.exe and /dev/null differ
diff --git a/project/download-deps.cmd b/project/download-deps.cmd
deleted file mode 100644 (file)
index a5ad0c6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-@echo off
-
-echo Downloading boost
-bin\wget.exe "http://mirrors.xbmc.org/build-deps/win32/boost-1_46_1-xbmc-win32.7z"
-
-echo Extracting boost
-bin\7za.exe x -y "boost-1_46_1-xbmc-win32.7z"
-
-echo Copying boost
-xcopy boost-1_46_1-xbmc-win32\include\* "..\include\" /E /Q /I /Y
-
-echo Cleaning up
-del boost-1_46_1-xbmc-win32.7z
diff --git a/project/libcec.rc b/project/libcec.rc
new file mode 100644 (file)
index 0000000..e3ede6e
Binary files /dev/null and b/project/libcec.rc differ
index 78763cef8d308d903a56765d9294c2ab4e5e7509..38fc144813ef2c2e768894af3f1802bfb0ec449a 100644 (file)
@@ -35,6 +35,7 @@
     <ClInclude Include="..\src\lib\platform\windows\os_windows.h" />
     <ClInclude Include="..\src\lib\util\buffer.h" />
     <ClInclude Include="..\src\lib\util\StdString.h" />
+    <ClInclude Include="resource.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\src\lib\AdapterCommunication.cpp" />
@@ -52,6 +53,9 @@
     <ClCompile Include="..\src\lib\platform\windows\os_windows.cpp" />
     <ClCompile Include="..\src\lib\platform\windows\serialport.cpp" />
   </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="libcec.rc" />
+  </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{C04B0FB1-667D-4F1C-BDAE-A07CDFFAAAA0}</ProjectGuid>
     <RootNamespace>libcec</RootNamespace>
     <TargetExt>.dll</TargetExt>
     <ExtensionsToDeleteOnClean>*.cdf;*.cache;*.obj;*.ilk;*.resources;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;*.tlog;*.manifest;*.res;*.pch;*.exp;*.idb;*.rep;*.xdc;*.pdb;*_manifest.rc;*.bsc;*.sbr;*.xml;*.dll</ExtensionsToDeleteOnClean>
     <IncludePath>$(SolutionDir)..\include;$(IncludePath)</IncludePath>
+    <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <OutputFile>$(SolutionDir)..\libcec.dll</OutputFile>
       <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib;$(SolutionDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib</AdditionalDependencies>
       <IgnoreSpecificDefaultLibraries>libcmtd</IgnoreSpecificDefaultLibraries>
-      <Version>8</Version>
+      <Version>
+      </Version>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
       <OutputFile>$(SolutionDir)..\libcec.dll</OutputFile>
       <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib;$(SolutionDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib</AdditionalDependencies>
       <IgnoreSpecificDefaultLibraries>libcmt</IgnoreSpecificDefaultLibraries>
-      <Version>8</Version>
+      <Version>
+      </Version>
     </Link>
   </ItemDefinitionGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
index 1468823729b49dfb086503d2862c1a56ea57dc5b..699f22938ccc46b7dee540775c826a62dcfa40c9 100644 (file)
@@ -82,6 +82,7 @@
     <ClInclude Include="..\src\lib\devices\CECBusDevice.h">
       <Filter>devices</Filter>
     </ClInclude>
+    <ClInclude Include="resource.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\src\lib\AdapterCommunication.cpp" />
       <Filter>devices</Filter>
     </ClCompile>
   </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="libcec.rc" />
+  </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/project/testclient.rc b/project/testclient.rc
new file mode 100644 (file)
index 0000000..74ce3e6
Binary files /dev/null and b/project/testclient.rc differ
index 68434c8dbbc4a4b756d68c5cbd81e0a1d70ec0db..bbdb7749d28cedcd226b6d133afc5a3f18dd5ddf 100644 (file)
@@ -43,7 +43,7 @@
     <TargetName>cec-client</TargetName>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <LinkIncremental>false</LinkIncremental>
+    <LinkIncremental>true</LinkIncremental>
     <OutDir>$(SolutionDir)..\</OutDir>
     <TargetName>cec-client</TargetName>
   </PropertyGroup>
@@ -63,7 +63,8 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <AdditionalDependencies>$(ProjectDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)..\cec-client.exe</OutputFile>
-      <Version>8</Version>
+      <Version>
+      </Version>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -85,7 +86,8 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalDependencies>$(ProjectDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <Version>8</Version>
+      <Version>
+      </Version>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClInclude Include="..\src\lib\platform\threads.h" />
     <ClInclude Include="..\src\lib\platform\windows\os_windows.h" />
     <ClInclude Include="..\src\lib\util\StdString.h" />
+    <ClInclude Include="resource1.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\src\lib\platform\threads.cpp" />
     <ClCompile Include="..\src\lib\platform\windows\os_windows.cpp" />
     <ClCompile Include="..\src\testclient\main.cpp" />
   </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="testclient.rc" />
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
index 88bab57d33b96d527d9302d92fa3c12a1ddaff2c..51b96b907b911354b35909478160139346f4bf43 100644 (file)
@@ -33,6 +33,9 @@
     <ClInclude Include="..\include\cecloader.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="resource1.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\src\testclient\main.cpp">
@@ -45,4 +48,9 @@
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="testclient.rc">
+      <Filter>Resource Files</Filter>
+    </ResourceCompile>
+  </ItemGroup>
 </Project>
\ No newline at end of file
index 2286a01e57080e8c12663e7b6c5a48d0d628f1c0..661478396a58a8ce09f7d5ac992a45ffd27f7e0f 100644 (file)
@@ -315,7 +315,6 @@ void *CAdapterCommunication::Process(void)
     ReadFromDevice(500);
     Sleep(5);
     WriteNextCommand();
-    Sleep(5);
   }
 
   return NULL;
@@ -353,7 +352,7 @@ void CAdapterCommunication::AddData(uint8_t *data, uint8_t iLen)
 
 void CAdapterCommunication::WriteNextCommand(void)
 {
-  CCECAdapterMessagePtr msg;
+  CCECAdapterMessage *msg;
   if (m_outBuffer.Pop(msg))
   {
     CLockObject lock(&msg->mutex);
@@ -374,7 +373,7 @@ void CAdapterCommunication::WriteNextCommand(void)
   }
 }
 
-bool CAdapterCommunication::Write(CCECAdapterMessagePtr data)
+bool CAdapterCommunication::Write(CCECAdapterMessage *data)
 {
   data->state = ADAPTER_MESSAGE_STATE_WAITING;
   m_outBuffer.Push(data);
@@ -442,47 +441,45 @@ std::string CAdapterCommunication::GetError(void) const
 
 bool CAdapterCommunication::StartBootloader(void)
 {
+  bool bReturn(false);
   if (!IsRunning())
-    return false;
+    return bReturn;
 
   m_controller->AddLog(CEC_LOG_DEBUG, "starting the bootloader");
-  CCECAdapterMessagePtr output(new CCECAdapterMessage);
+  CCECAdapterMessage *output = new CCECAdapterMessage;
 
   output->push_back(MSGSTART);
   output->push_escaped(MSGCODE_START_BOOTLOADER);
   output->push_back(MSGEND);
 
-  if (!Write(output))
-  {
+  if ((bReturn = Write(output)) == false)
     m_controller->AddLog(CEC_LOG_ERROR, "could not start the bootloader");
-    return false;
-  }
-  m_controller->AddLog(CEC_LOG_DEBUG, "bootloader start command transmitted");
-  return true;
+
+  delete output;
+
+  return bReturn;
 }
 
 bool CAdapterCommunication::PingAdapter(void)
 {
+  bool bReturn(false);
   if (!IsRunning())
-    return false;
+    return bReturn;
 
   m_controller->AddLog(CEC_LOG_DEBUG, "sending ping");
-  CCECAdapterMessagePtr output(new CCECAdapterMessage);
+  CCECAdapterMessage *output = new CCECAdapterMessage;
 
   output->push_back(MSGSTART);
   output->push_escaped(MSGCODE_PING);
   output->push_back(MSGEND);
 
-  if (!Write(output))
-  {
+  if ((bReturn = Write(output)) == false)
     m_controller->AddLog(CEC_LOG_ERROR, "could not send ping command");
-    return false;
-  }
-
-  m_controller->AddLog(CEC_LOG_DEBUG, "ping tranmitted");
 
   // TODO check for pong
-  return true;
+  delete output;
+
+  return bReturn;
 }
 
 bool CAdapterCommunication::IsOpen(void) const
index ef5e0aa7c2934c55649dcef5915b65130da3a52f..31de379e1350ac131529590e095ae2dd7bac2ee6 100644 (file)
@@ -36,8 +36,6 @@
 #include "util/buffer.h"
 #include "util/StdString.h"
 #include <string>
-#include <boost/enable_shared_from_this.hpp>
-#include <boost/shared_ptr.hpp>
 
 namespace CEC
 {
@@ -51,7 +49,7 @@ namespace CEC
   } cec_adapter_message_state;
 
 
-  class CCECAdapterMessage : public boost::enable_shared_from_this<CCECAdapterMessage>
+  class CCECAdapterMessage
   {
   public:
     CCECAdapterMessage(void) { clear(); }
@@ -81,7 +79,6 @@ namespace CEC
     CMutex                    mutex;
     CCondition                condition;
   };
-  typedef boost::shared_ptr<CCECAdapterMessage> CCECAdapterMessagePtr;
 
   class CSerialPort;
   class CLibCEC;
@@ -94,7 +91,7 @@ namespace CEC
 
     bool Open(const char *strPort, uint16_t iBaudRate = 38400, uint32_t iTimeoutMs = 10000);
     bool Read(CCECAdapterMessage &msg, uint32_t iTimeout = 1000);
-    bool Write(CCECAdapterMessagePtr data);
+    bool Write(CCECAdapterMessage *data);
     bool PingAdapter(void);
     void Close(void);
     bool IsOpen(void) const;
@@ -112,7 +109,7 @@ namespace CEC
     CSerialPort *                    m_port;
     CLibCEC *                        m_controller;
     CecBuffer<uint8_t>               m_inBuffer;
-    CecBuffer<CCECAdapterMessagePtr> m_outBuffer;
+    CecBuffer<CCECAdapterMessage *>  m_outBuffer;
     CMutex                           m_mutex;
     CCondition                       m_rcvCondition;
     CCondition                       m_startCondition;
index 0749e5375f00c0362d1dc9a93127f49b8cfe4976..f781b6fb58b94f99f970a8eb2248937f958aa1cc 100644 (file)
@@ -231,13 +231,17 @@ cec_power_status CCECProcessor::GetDevicePowerStatus(cec_logical_address iAddres
 
 bool CCECProcessor::Transmit(const cec_command &data)
 {
+  bool bReturn(false);
   LogOutput(data);
 
-  CCECAdapterMessagePtr output(new CCECAdapterMessage(data));
-  return Transmit(output);
+  CCECAdapterMessage *output = new CCECAdapterMessage(data);
+  bReturn = Transmit(output);
+  delete output;
+
+  return bReturn;
 }
 
-bool CCECProcessor::Transmit(CCECAdapterMessagePtr output)
+bool CCECProcessor::Transmit(CCECAdapterMessage *output)
 {
   bool bReturn(false);
   CLockObject lock(&m_mutex);
@@ -247,7 +251,7 @@ bool CCECProcessor::Transmit(CCECAdapterMessagePtr output)
       return bReturn;
     else
     {
-      output->condition.Wait(&output->mutex, 1000);
+      output->condition.Wait(&output->mutex);
       if (output->state != ADAPTER_MESSAGE_STATE_SENT)
       {
         m_controller->AddLog(CEC_LOG_ERROR, "command was not sent");
@@ -390,6 +394,11 @@ void CCECProcessor::AddCommand(const cec_command &command)
   m_controller->AddCommand(command);
 }
 
+void CCECProcessor::AddKey(cec_keypress &key)
+{
+  m_controller->AddKey(key);
+}
+
 void CCECProcessor::AddKey(void)
 {
   m_controller->AddKey();
@@ -402,11 +411,12 @@ void CCECProcessor::AddLog(cec_log_level level, const CStdString &strMessage)
 
 bool CCECProcessor::SetAckMask(uint16_t iMask)
 {
+  bool bReturn(false);
   CStdString strLog;
   strLog.Format("setting ackmask to %2x", iMask);
   m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
 
-  CCECAdapterMessagePtr output(new CCECAdapterMessage);
+  CCECAdapterMessage *output = new CCECAdapterMessage;
 
   output->push_back(MSGSTART);
   output->push_escaped(MSGCODE_SET_ACK_MASK);
@@ -414,11 +424,10 @@ bool CCECProcessor::SetAckMask(uint16_t iMask)
   output->push_escaped((uint8_t)iMask);
   output->push_back(MSGEND);
 
-  if (!Transmit(output))
-  {
+  if ((bReturn = Transmit(output)) == false)
     m_controller->AddLog(CEC_LOG_ERROR, "could not set the ackmask");
-    return false;
-  }
 
-  return true;
+  delete output;
+
+  return bReturn;
 }
index e2793a3bbcb75621d9b5af0516e61b28038f257f..d865167e114ff6e9332682a665c8873e31e30c9d 100644 (file)
@@ -70,11 +70,12 @@ namespace CEC
       virtual bool SwitchMonitoring(bool bEnable);
 
       virtual bool Transmit(const cec_command &data);
-      virtual bool Transmit(CCECAdapterMessagePtr output);
+      virtual bool Transmit(CCECAdapterMessage *output);
       virtual void TransmitAbort(cec_logical_address address, cec_opcode opcode, ECecAbortReason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE);
 
       virtual void SetCurrentButton(cec_user_control_code iButtonCode);
       virtual void AddCommand(const cec_command &command);
+      virtual void AddKey(cec_keypress &key);
       virtual void AddKey(void);
       virtual void AddLog(cec_log_level level, const CStdString &strMessage);
 
index ed60f43ff2f25f623e814f86b282c781c5f0e915..95e2a2e42e72d1a5cadb37f2be924c207a19a322 100644 (file)
@@ -55,14 +55,7 @@ CLibCEC::~CLibCEC(void)
 {
   Close();
   delete m_cec;
-  m_cec = NULL;
-
   delete m_comm;
-  m_comm = NULL;
-
-  m_logBuffer.Clear();
-  m_keyBuffer.Clear();
-  m_commandBuffer.Clear();
 }
 
 bool CLibCEC::Open(const char *strPort, uint32_t iTimeoutMs /* = 10000 */)
@@ -134,16 +127,6 @@ bool CLibCEC::StartBootloader(void)
   return m_comm ? m_comm->StartBootloader() : false;
 }
 
-int8_t CLibCEC::GetMinVersion(void)
-{
-  return CEC_MIN_VERSION;
-}
-
-int8_t CLibCEC::GetLibVersion(void)
-{
-  return CEC_LIB_VERSION;
-}
-
 bool CLibCEC::GetNextLogMessage(cec_log_message *message)
 {
   return (m_logBuffer.Pop(*message));
@@ -244,6 +227,13 @@ void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
   }
 }
 
+void CLibCEC::AddKey(cec_keypress &key)
+{
+  m_keyBuffer.Push(key);
+  m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN;
+  m_buttontime = 0;
+}
+
 void CLibCEC::AddKey(void)
 {
   if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN)
@@ -254,8 +244,8 @@ void CLibCEC::AddKey(void)
     key.keycode = m_iCurrentButton;
     m_keyBuffer.Push(key);
     m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN;
-    m_buttontime = 0;
   }
+  m_buttontime = 0;
 }
 
 void CLibCEC::AddCommand(const cec_command &command)
index 391148dadbf110bfb93c993ff6e9b187bf3062f1..0b43aa46c4e1125a95639677e75bd8b87151a3bc 100644 (file)
@@ -56,8 +56,9 @@ namespace CEC
       virtual bool PingAdapter(void);
       virtual bool StartBootloader(void);
 
-      virtual int8_t GetMinVersion(void);
-      virtual int8_t GetLibVersion(void);
+      virtual int8_t GetMinLibVersion(void) const{ return CEC_MIN_LIB_VERSION; };
+      virtual int8_t GetLibVersionMajor(void) const { return CEC_LIB_VERSION_MAJOR; };
+      virtual int8_t GetLibVersionMinor(void) const { return CEC_LIB_VERSION_MINOR; };
 
       virtual bool GetNextLogMessage(cec_log_message *message);
       virtual bool GetNextKeypress(cec_keypress *key);
@@ -81,6 +82,7 @@ namespace CEC
 
       virtual void AddLog(cec_log_level level, const std::string &strMessage);
       virtual void AddKey(void);
+      virtual void AddKey(cec_keypress &key);
       virtual void AddCommand(const cec_command &command);
       virtual void CheckKeypressTimeout(void);
       virtual void SetCurrentButton(cec_user_control_code iButtonCode);
index 28a268b3879532f263c55095da3f3efae6553b18..a3be5f3bea89df0498af40851132a293f4ce6040 100644 (file)
@@ -92,14 +92,21 @@ int cec_start_bootloader(void)
 int8_t cec_get_min_version(void)
 {
   if (cec_parser)
-    return cec_parser->GetMinVersion();
+    return cec_parser->GetMinLibVersion();
   return -1;
 }
 
-int8_t cec_get_lib_version(void)
+int8_t cec_get_lib_version_major(void)
 {
   if (cec_parser)
-    return cec_parser->GetLibVersion();
+    return cec_parser->GetLibVersionMajor();
+  return -1;
+}
+
+int8_t cec_get_lib_version_minor(void)
+{
+  if (cec_parser)
+    return cec_parser->GetLibVersionMinor();
   return -1;
 }
 
index 394cfa93f2a0e40fb784470a5c32763c44f37847..f1e3dd5b1c2da7b7ec7fe50bb96e80ebeaf97cdd 100644 (file)
@@ -46,25 +46,26 @@ bool CANCommandHandler::HandleVendorRemoteButtonDown(const cec_command &command)
 {
   if (command.parameters.size > 0)
   {
-    m_busDevice->GetProcessor()->AddKey();
+    cec_keypress key;
+    key.duration = CEC_BUTTON_TIMEOUT;
+    key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN;
 
-    uint8_t iButton = 0;
     switch (command.parameters[0])
     {
     case CEC_AN_USER_CONTROL_CODE_RETURN:
-      iButton = CEC_USER_CONTROL_CODE_PREVIOUS_CHANNEL;
+      key.keycode = CEC_USER_CONTROL_CODE_EXIT;
       break;
     default:
       break;
     }
 
-    if (iButton > 0 && iButton <= CEC_USER_CONTROL_CODE_MAX)
+    if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN)
     {
       CStdString strLog;
-      strLog.Format("key pressed: %1x", iButton);
+      strLog.Format("key pressed: %1x", key.keycode);
       m_busDevice->AddLog(CEC_LOG_DEBUG, strLog);
 
-      m_busDevice->GetProcessor()->SetCurrentButton((cec_user_control_code) command.parameters[0]);
+      m_busDevice->GetProcessor()->AddKey(key);
     }
   }
 
index e362396e6cd471d41d4d562658fbc8adc5c54ec0..56bdc3070fc8fa6603a0f85317d35ca03c611f19 100644 (file)
@@ -46,7 +46,7 @@ CSerialPort::~CSerialPort()
   Close();
 }
 
-int8_t CSerialPort::Write(CCECAdapterMessagePtr data)
+int8_t CSerialPort::Write(CCECAdapterMessage *data)
 {
   fd_set port;
 
index 4fb29541008441c8255207615dc9b02e0f07e6f0..a88ebecb1738da26d6cb6dc106e366c2ba6f0270 100644 (file)
@@ -47,7 +47,7 @@ namespace CEC
       bool IsOpen();
       void Close();
 
-      int8_t Write(CCECAdapterMessagePtr data);
+      int8_t Write(CCECAdapterMessage *data);
       int32_t Read(uint8_t* data, uint32_t len, uint64_t iTimeoutMs = 0);
 
       std::string GetError() { return m_error; }
index b028ff32e5e8810f5bb01bcb70cf8aa2810722db..df619ef048c31ac03c5f90588a443edf42e5d141 100644 (file)
@@ -166,7 +166,7 @@ void CSerialPort::Close(void)
   }
 }
 
-int8_t CSerialPort::Write(CCECAdapterMessagePtr data)
+int8_t CSerialPort::Write(CCECAdapterMessage *data)
 {
   CLockObject lock(&m_mutex);
   DWORD iBytesWritten = 0;
index d30d982053673bfa341b07688c00973d2f5425a1..8efffedc4165c47fa01c7d57a747a76cdad765ad 100644 (file)
@@ -44,7 +44,7 @@
 using namespace CEC;
 using namespace std;
 
-#define CEC_TEST_CLIENT_VERSION 8
+#define CEC_TEST_CLIENT_VERSION 1
 
 #include <cecloader.h>
 
@@ -245,7 +245,7 @@ void show_console_help(void)
 int main (int argc, char *argv[])
 {
   ICECAdapter *parser = LoadLibCec("CECTester");
-  if (!parser || parser->GetMinVersion() > CEC_TEST_CLIENT_VERSION)
+  if (!parser || parser->GetMinLibVersion() > CEC_TEST_CLIENT_VERSION)
   {
 #ifdef __WINDOWS__
     cout << "Cannot load libcec.dll" << endl;
@@ -255,7 +255,7 @@ int main (int argc, char *argv[])
     return 1;
   }
   CStdString strLog;
-  strLog.Format("CEC Parser created - libcec version %d", parser->GetLibVersion());
+  strLog.Format("CEC Parser created - libcec version %d.%d", parser->GetLibVersionMajor(), parser->GetLibVersionMinor());
   cout << strLog.c_str() << endl;
 
   //make stdin non-blocking