cec: bump version to 1.6.3. check the client version, not the server version in libce...
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 14 May 2012 13:05:34 +0000 (15:05 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 14 May 2012 13:19:15 +0000 (15:19 +0200)
include/cec.h
include/cectypes.h
src/lib/CECClient.cpp
src/lib/CECProcessor.cpp
src/lib/LibCEC.cpp

index fada217ef52007f514013d9b05c4a6e18f7180a2..abfde74b7e6a9807de2eb59c4eeb51eb7a7c4ded 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "cectypes.h"
 
-#define LIBCEC_VERSION_CURRENT CEC_SERVER_VERSION_1_6_2
+#define LIBCEC_VERSION_CURRENT CEC_SERVER_VERSION_1_6_3
 
 namespace CEC
 {
index d70fc81f7f50aa726eed8a916206564c47c067e2..a8ff6f604872f77bf96a5458fb3ff005eb8ed839 100644 (file)
@@ -1188,7 +1188,8 @@ typedef enum cec_client_version
   CEC_CLIENT_VERSION_1_5_3   = 0x1503,
   CEC_CLIENT_VERSION_1_6_0   = 0x1600,
   CEC_CLIENT_VERSION_1_6_1   = 0x1601,
-  CEC_CLIENT_VERSION_1_6_2   = 0x1602
+  CEC_CLIENT_VERSION_1_6_2   = 0x1602,
+  CEC_CLIENT_VERSION_1_6_3   = 0x1603
 } cec_client_version;
 
 typedef enum cec_server_version
@@ -1200,7 +1201,8 @@ typedef enum cec_server_version
   CEC_SERVER_VERSION_1_5_3   = 0x1503,
   CEC_SERVER_VERSION_1_6_0   = 0x1600,
   CEC_SERVER_VERSION_1_6_1   = 0x1601,
-  CEC_SERVER_VERSION_1_6_2   = 0x1602
+  CEC_SERVER_VERSION_1_6_2   = 0x1602,
+  CEC_SERVER_VERSION_1_6_3   = 0x1603
 } cec_server_version;
 
 typedef struct libcec_configuration
@@ -1235,6 +1237,7 @@ typedef struct libcec_configuration
   uint8_t               bShutdownOnStandby;   /*!< shutdown this PC when the TV is switched off. only used when bPowerOffOnStandby = 0. added in 1.6.0 */
   char                  strDeviceLanguage[3]; /*!< the menu language used by the client. 3 character ISO 639-2 country code. see http://http://www.loc.gov/standards/iso639-2/ added in 1.6.2 */
   uint32_t              iFirmwareBuildDate;   /*!< the build date of the firmware, in seconds since epoch. if not available, this value will be set to 0. added in 1.6.2 */
+  uint8_t               bMonitorOnly;         /*!< won't allocate a CCECClient when starting the connection when set (same as monitor mode). added in 1.6.3 */
 
 #ifdef __cplusplus
    libcec_configuration(void) { Clear(); }
@@ -1260,14 +1263,16 @@ typedef struct libcec_configuration
                  bPowerOffOnStandby   == other.bPowerOffOnStandby &&
                  bSendInactiveSource  == other.bSendInactiveSource &&
         /* libcec 1.5.3+ */
-        (other.serverVersion < CEC_SERVER_VERSION_1_5_3 || logicalAddresses == other.logicalAddresses) &&
+        (other.clientVersion < CEC_CLIENT_VERSION_1_5_3 || logicalAddresses == other.logicalAddresses) &&
         /* libcec 1.6.0+ */
-        (other.serverVersion < CEC_SERVER_VERSION_1_6_0 || iFirmwareVersion          == other.iFirmwareVersion) &&
-        (other.serverVersion < CEC_SERVER_VERSION_1_6_0 || bPowerOffDevicesOnStandby == other.bPowerOffDevicesOnStandby) &&
-        (other.serverVersion < CEC_SERVER_VERSION_1_6_0 || bShutdownOnStandby        == other.bShutdownOnStandby) &&
+        (other.clientVersion < CEC_CLIENT_VERSION_1_6_0 || iFirmwareVersion          == other.iFirmwareVersion) &&
+        (other.clientVersion < CEC_CLIENT_VERSION_1_6_0 || bPowerOffDevicesOnStandby == other.bPowerOffDevicesOnStandby) &&
+        (other.clientVersion < CEC_CLIENT_VERSION_1_6_0 || bShutdownOnStandby        == other.bShutdownOnStandby) &&
         /* libcec 1.6.2+ */
-        (other.serverVersion < CEC_SERVER_VERSION_1_6_2 || !strncmp(strDeviceLanguage, other.strDeviceLanguage, 3)) &&
-        (other.serverVersion < CEC_SERVER_VERSION_1_6_2 || iFirmwareBuildDate       == other.iFirmwareBuildDate));
+        (other.clientVersion < CEC_CLIENT_VERSION_1_6_2 || !strncmp(strDeviceLanguage, other.strDeviceLanguage, 3)) &&
+        (other.clientVersion < CEC_CLIENT_VERSION_1_6_2 || iFirmwareBuildDate        == other.iFirmwareBuildDate) &&
+        /* libcec 1.6.3+ */
+        (other.clientVersion < CEC_CLIENT_VERSION_1_6_3 || bMonitorOnly              == other.bMonitorOnly));
   }
 
   bool operator!=(const libcec_configuration &other) const
@@ -1298,6 +1303,7 @@ typedef struct libcec_configuration
     bPowerOffDevicesOnStandby =       CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY;
     memcpy(strDeviceLanguage,         CEC_DEFAULT_DEVICE_LANGUAGE, 3);
     iFirmwareBuildDate =              CEC_FW_BUILD_UNKNOWN;
+    bMonitorOnly =                    0;
 
     memset(strDeviceName, 0, 13);
     deviceTypes.clear();
index 013a7656209dc7ca9b76004291ba6a3f0f85c015..24f196f49287008800a01c1b88f76ff4d0463259 100644 (file)
@@ -741,6 +741,13 @@ bool CCECClient::GetCurrentConfiguration(libcec_configuration &configuration)
     memcpy(configuration.strDeviceLanguage, m_configuration.strDeviceLanguage, 3);
     configuration.iFirmwareBuildDate      = m_configuration.iFirmwareBuildDate;
   }
+
+  // client version 1.6.3
+  if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_3)
+  {
+    configuration.bMonitorOnly            = m_configuration.bMonitorOnly;
+  }
+
   return true;
 }
 
@@ -792,6 +799,12 @@ bool CCECClient::SetConfiguration(const libcec_configuration &configuration)
       memcpy(m_configuration.strDeviceLanguage, configuration.strDeviceLanguage, 3);
     }
 
+    // client version 1.6.3
+    if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_3)
+    {
+      m_configuration.bMonitorOnly = configuration.bMonitorOnly;
+    }
+
     // ensure that there is at least 1 device type set
     if (m_configuration.deviceTypes.IsEmpty())
       m_configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
@@ -1175,7 +1188,10 @@ bool CCECClient::SwitchMonitoring(bool bEnable)
     if (bEnable)
       return m_processor->UnregisterClient(this);
     else
+    {
+      m_configuration.bMonitorOnly = false;
       return m_processor->RegisterClient(this);
+    }
   }
 
   return false;
index e90d5cb59038a62f8917bbb8cab61f52e24bc43e..df04a237edba78ba755928757ed72c6f0590a1bb 100644 (file)
@@ -615,7 +615,15 @@ CCECTuner *CCECProcessor::GetTuner(cec_logical_address address) const
 
 bool CCECProcessor::RegisterClient(CCECClient *client)
 {
-  if (!client || !CECInitialised())
+  if (!client)
+    return false;
+
+  libcec_configuration &configuration = *client->GetConfiguration();
+
+  if (configuration.clientVersion >= CEC_CLIENT_VERSION_1_6_3 && configuration.bMonitorOnly == 1)
+    return true;
+
+  if (!CECInitialised())
   {
     m_libcec->AddLog(CEC_LOG_ERROR, "failed to register a new CEC client: CEC processor is not initialised");
     return false;
@@ -626,7 +634,6 @@ bool CCECProcessor::RegisterClient(CCECClient *client)
     UnregisterClient(client);
 
   // get the configuration from the client
-  libcec_configuration &configuration = *client->GetConfiguration();
   m_libcec->AddLog(CEC_LOG_NOTICE, "registering new CEC client - v%s", ToString((cec_client_version)configuration.clientVersion));
 
   // mark as uninitialised and unregistered
index 9eaf9cecf898af75c3a1e4c34edbc92122fc0da3..b64cdc709ad6ab22f7a7eb17dac3c2d264e24896 100644 (file)
@@ -823,6 +823,8 @@ const char *CLibCEC::ToString(const cec_client_version version)
     return "1.6.1";
   case CEC_CLIENT_VERSION_1_6_2:
     return "1.6.2";
+  case CEC_CLIENT_VERSION_1_6_3:
+    return "1.6.3";
   default:
     return "Unknown";
   }
@@ -848,6 +850,8 @@ const char *CLibCEC::ToString(const cec_server_version version)
     return "1.6.1";
   case CEC_SERVER_VERSION_1_6_2:
     return "1.6.2";
+  case CEC_SERVER_VERSION_1_6_3:
+    return "1.6.3";
   default:
     return "Unknown";
   }