display an alert message when another device uses the same physical address as libCEC...
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 15 Nov 2012 14:02:52 +0000 (15:02 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 15 Nov 2012 14:03:53 +0000 (15:03 +0100)
include/cectypes.h
src/lib/CECClient.cpp
src/lib/implementations/CECCommandHandler.cpp

index cb51c7fe58e8cdb2e92b0b58ad0593a3a4fc5f07..dfcebfe282e10701b2a526db0fcec576cab15ea4 100644 (file)
@@ -1256,7 +1256,8 @@ typedef enum libcec_alert
   CEC_ALERT_SERVICE_DEVICE,
   CEC_ALERT_CONNECTION_LOST,
   CEC_ALERT_PERMISSION_ERROR,
-  CEC_ALERT_PORT_BUSY
+  CEC_ALERT_PORT_BUSY,
+  CEC_ALERT_PHYSICAL_ADDRESS_ERROR
 } libcec_alert;
 
 typedef enum libcec_parameter_type
index dc4bbd88676f06ff6b9cf6bf9aebc87d521abae8..9d814cd35868409222f1f0457b0441a941388434 100644 (file)
@@ -208,7 +208,7 @@ bool CCECClient::SetHDMIPort(const cec_logical_address iBaseDevice, const uint8_
 
 void CCECClient::ResetPhysicalAddress(void)
 {
-  SetPhysicalAddress(m_configuration);
+  SetPhysicalAddress(CEC_DEFAULT_PHYSICAL_ADDRESS);
 }
 
 void CCECClient::SetPhysicalAddress(const libcec_configuration &configuration)
index 0e00e4c2ef0107e654538aa4d2555321b1a6ed20..27e692e997ff70b70581f9698ea8b4eabdedb47e 100644 (file)
@@ -816,13 +816,17 @@ void CCECCommandHandler::SetPhysicalAddress(cec_logical_address iAddress, uint16
     if (device)
       device->SetPhysicalAddress(iNewAddress);
     else
-    {
       LIB_CEC->AddLog(CEC_LOG_DEBUG, "device with logical address %X not found", iAddress);
-    }
 
     /* another device reported the same physical address as ours */
     if (client)
+    {
+      libcec_parameter param;
+      param.paramType = CEC_PARAMETER_TYPE_STRING;
+      param.paramData = (void*)"Physical address in use by another device. Please verify your settings";
+      client->Alert(CEC_ALERT_PHYSICAL_ADDRESS_ERROR, param);
       client->ResetPhysicalAddress();
+    }
   }
   else
   {