LibCecSharp: pass correctly formatted logical address lists
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 16 Feb 2012 00:59:06 +0000 (01:59 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 16 Feb 2012 00:59:06 +0000 (01:59 +0100)
src/LibCecSharp/CecSharpTypes.h
src/LibCecSharp/LibCecSharp.cpp

index 49955743d48f2f4a4475353f34188837c1c01081..f385cdaa15264402487328daf2f608bfaffc7c2d 100644 (file)
@@ -367,12 +367,12 @@ namespace CecSharp
                void Clear(void)
                {
                        for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
-                               Addresses[iPtr] = CecLogicalAddress::Unregistered;
+                               Addresses[iPtr] = CecLogicalAddress::Unknown;
                }
 
                bool IsSet(CecLogicalAddress iAddress)
                {
-                       return Addresses[(unsigned int)iAddress] != CecLogicalAddress::Unregistered;
+                       return Addresses[(unsigned int)iAddress] != CecLogicalAddress::Unknown;
                }
 
          void Set(CecLogicalAddress iAddress)
@@ -750,16 +750,14 @@ namespace CecSharp
                                netConfig->ActivateSource = config.bActivateSource == 1;
 
                                netConfig->WakeDevices->Clear();
-                               int iDevices(0);
                                for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
                                        if (config.wakeDevices[iPtr])
-                                               netConfig->WakeDevices->Addresses[iDevices++] = (CecLogicalAddress)iPtr;
+                                               netConfig->WakeDevices->Set((CecLogicalAddress)iPtr);
 
                                netConfig->PowerOffDevices->Clear();
-                               iDevices = 0;
                                for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
                                        if (config.powerOffDevices[iPtr])
-                                               netConfig->PowerOffDevices->Addresses[iDevices++] = (CecLogicalAddress)iPtr;
+                                               netConfig->PowerOffDevices->Set((CecLogicalAddress)iPtr);
 
                                netConfig->PowerOffScreensaver = config.bPowerOffScreensaver == 1;
                                netConfig->PowerOffOnStandby = config.bPowerOffOnStandby == 1;
index 971dc4d6f7daea3d3370b127ade3a2ec6d8d0f47..c02c4ea8a66c65546f9d5fbf4609276939dc325b 100644 (file)
@@ -440,16 +440,14 @@ namespace CecSharp
                                configuration->TvVendor = (CecVendorId)config.tvVendor;
 
                                configuration->WakeDevices->Clear();
-                               int iDevices(0);
                                for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
                                        if (config.wakeDevices[iPtr])
-                                               configuration->WakeDevices->Addresses[iDevices++] = (CecLogicalAddress)iPtr;
+                                               configuration->WakeDevices->Set((CecLogicalAddress)iPtr);
 
                                configuration->PowerOffDevices->Clear();
-                               iDevices = 0;
                                for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
                                        if (config.powerOffDevices[iPtr])
-                                               configuration->PowerOffDevices->Addresses[iDevices++] = (CecLogicalAddress)iPtr;
+                                               configuration->PowerOffDevices->Set((CecLogicalAddress)iPtr);
 
                                configuration->UseTVMenuLanguage = config.bUseTVMenuLanguage == 1;
                                for (unsigned int iPtr = 0; iPtr < 5; iPtr++)