cec: added the firmware version to libcec_configuration (read-only). bumped server...
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 23 Mar 2012 09:57:37 +0000 (10:57 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 23 Mar 2012 10:06:00 +0000 (11:06 +0100)
include/cectypes.h
src/lib/CECProcessor.cpp
src/lib/adapter/AdapterCommunication.h

index e0b586fd88630cfc6135f70e83f85d5e31b15138..451b2ab83c0efff0fcb1f3276f6d744708814e5f 100644 (file)
@@ -966,6 +966,7 @@ typedef enum cec_client_version
   CEC_CLIENT_VERSION_1_5_1   = 0x1501,
   CEC_CLIENT_VERSION_1_5_2   = 0x1502,
   CEC_CLIENT_VERSION_1_5_3   = 0x1503,
+  CEC_CLIENT_VERSION_1_6_0   = 0x1600
 } cec_client_version;
 
 typedef enum cec_server_version
@@ -974,7 +975,8 @@ typedef enum cec_server_version
   CEC_SERVER_VERSION_1_5_0   = 0x1500,
   CEC_SERVER_VERSION_1_5_1   = 0x1501,
   CEC_SERVER_VERSION_1_5_2   = 0x1502,
-  CEC_SERVER_VERSION_1_5_3   = 0x1503
+  CEC_SERVER_VERSION_1_5_3   = 0x1503,
+  CEC_SERVER_VERSION_1_6_0   = 0x1600
 } cec_server_version;
 
 typedef struct libcec_configuration
@@ -1004,6 +1006,7 @@ typedef struct libcec_configuration
   ICECCallbacks *       callbacks;            /*!< the callback methods to use. set this to NULL when not using callbacks */
 
   cec_logical_addresses logicalAddresses;     /*!< the current logical addresses. read-only. added in 1.5.3 */
+  uint16_t              iFirmwareVersion;     /*!< the firmware version of the adapter. in 1.6.0 */
 
 #ifdef __cplusplus
   void Clear(void)
@@ -1033,6 +1036,7 @@ typedef struct libcec_configuration
     bPowerOffOnStandby   = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY;
     bSendInactiveSource  = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE;
     logicalAddresses.Clear();
+    iFirmwareVersion = 0;
 
     callbackParam    = NULL;
     callbacks        = NULL;
index 83e9ee8c40451211dc0a79f75cdfb403142a6284..5000e047b81d824f2ad39302fbbf529ee85dd3f1 100644 (file)
@@ -59,7 +59,7 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, libcec_configuration *configur
 {
   CreateBusDevices();
   m_configuration.Clear();
-  m_configuration.serverVersion = configuration->serverVersion;
+  m_configuration.serverVersion = CEC_SERVER_VERSION_1_6_0;
   SetConfiguration(configuration);
 
   if (m_configuration.tvVendor != CEC_VENDOR_UNKNOWN)
@@ -77,7 +77,7 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, con
     m_iLastTransmission(0)
 {
   m_configuration.Clear();
-  m_configuration.serverVersion    = CEC_SERVER_VERSION_1_5_2;
+  m_configuration.serverVersion    = CEC_SERVER_VERSION_1_6_0;
 
   // client version < 1.5.0
   m_configuration.clientVersion    = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5;
@@ -192,7 +192,10 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint
   }
 
   if (bReturn)
-    CLibCEC::AddLog(CEC_LOG_NOTICE, "connected to the CEC adapter. firmware version = %d, client version = %s", m_communication->GetFirmwareVersion(), ToString((cec_client_version)m_configuration.clientVersion));
+  {
+    m_configuration.iFirmwareVersion = m_communication->GetFirmwareVersion();
+    CLibCEC::AddLog(CEC_LOG_NOTICE, "connected to the CEC adapter. firmware version = %d, client version = %s", m_configuration.iFirmwareVersion, ToString((cec_client_version)m_configuration.clientVersion));
+  }
 
   if (m_configuration.bGetSettingsFromROM == 1)
     m_communication->GetConfiguration(&m_configuration);
@@ -1380,6 +1383,10 @@ const char *CCECProcessor::ToString(const cec_client_version version)
     return "1.5.1";
   case CEC_CLIENT_VERSION_1_5_2:
     return "1.5.2";
+  case CEC_CLIENT_VERSION_1_5_3:
+    return "1.5.3";
+  case CEC_CLIENT_VERSION_1_6_0:
+    return "1.6.0";
   default:
     return "Unknown";
   }
@@ -1397,6 +1404,10 @@ const char *CCECProcessor::ToString(const cec_server_version version)
     return "1.5.1";
   case CEC_SERVER_VERSION_1_5_2:
     return "1.5.2";
+  case CEC_SERVER_VERSION_1_5_3:
+    return "1.5.3";
+  case CEC_SERVER_VERSION_1_6_0:
+    return "1.6.0";
   default:
     return "Unknown";
   }
@@ -1649,6 +1660,10 @@ bool CCECProcessor::GetCurrentConfiguration(libcec_configuration *configuration)
   if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_5_3)
     configuration->logicalAddresses    = m_configuration.logicalAddresses;
 
+  // client version 1.6.0
+  if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_5_3)
+    configuration->logicalAddresses    = m_configuration.logicalAddresses;
+
   return true;
 }
 
index 15f0c9c305e61157cdea80aaca28ebc0bb18aaca..400b32151e10fc8a51d4cb5c305cb3d9d0333b2b 100644 (file)
@@ -135,7 +135,7 @@ namespace CEC
     virtual bool PingAdapter(void) = 0;
 
     /*!
-     * @return The firmware version of this CEC adapter.
+     * @return The firmware version of this CEC adapter, or 0 if it's unknown.
      */
     virtual uint16_t GetFirmwareVersion(void) = 0;