A/C Keysets, Donations button
[pierogi] / pirkeysetmanager.cpp
index 4b94ada..dae628b 100644 (file)
@@ -1,38 +1,63 @@
 #include "pirkeysetmanager.h"
+
 #include "pirkeysetmetadata.h"
+#include "pirselectkeysetform.h"
+#include "pirkeysetwidgetitem.h"
+
+#include "keysets/acer.h"
+#include "keysets/admiral.h"
+#include "keysets/aiwa.h"
 #include "keysets/apple.h"
+#include "keysets/beko.h"
+#include "keysets/bose.h"
+#include "keysets/cambridge.h"
+#include "keysets/daewoo.h"
 #include "keysets/denon.h"
+#include "keysets/digitalstream.h"
+#include "keysets/dish.h"
 #include "keysets/ei.h"
 #include "keysets/elgato.h"
+#include "keysets/emerson.h"
+#include "keysets/fortec.h"
 #include "keysets/goldstar.h"
+#include "keysets/grundig.h"
+#include "keysets/haier.h"
 #include "keysets/hauppauge.h"
 #include "keysets/hitachi.h"
+#include "keysets/homecast.h"
 #include "keysets/jvc.h"
+#include "keysets/kenwood.h"
 #include "keysets/lg.h"
+#include "keysets/logitech.h"
 #include "keysets/magnavox.h"
+#include "keysets/mce.h"
 #include "keysets/mitsubishi.h"
 #include "keysets/nokia.h"
 #include "keysets/panasonic.h"
+#include "keysets/philco.h"
 #include "keysets/philips.h"
 #include "keysets/pinnacle.h"
+#include "keysets/pioneer.h"
 #include "keysets/raite.h"
 #include "keysets/rca.h"
+#include "keysets/roku.h"
+#include "keysets/saba.h"
 #include "keysets/sagem.h"
 #include "keysets/samsung.h"
 #include "keysets/sanyo.h"
 #include "keysets/sharp.h"
+#include "keysets/sky.h"
 #include "keysets/sony.h"
 #include "keysets/tivo.h"
+#include "keysets/topfield.h"
 #include "keysets/toshiba.h"
+#include "keysets/wd.h"
 #include "keysets/westinghouse.h"
 #include "keysets/yamaha.h"
 #include "keysets/zenith.h"
-#include "pirmakenames.h"
 
 #include "pirexception.h"
 
-#include <QObject>
-
 // I'll be handling the threading of the keyset commands in this object:
 #include <QMutex>
 
@@ -51,8 +76,51 @@ PIRKeysetManager::PIRKeysetManager(
   : counter(0)
 {
   // Create the keysets.  Ugly!  This needs to be worked on!
+  populateKeyset(new AcerTV1(guiObject, counter++));
+  populateKeyset(new AcerPC1(guiObject, counter++));
+
+  populateKeyset(new AdmiralTV1(guiObject, counter++));
+  populateKeyset(new AdmiralTV2(guiObject, counter++));
+  populateKeyset(new AdmiralVCR1(guiObject, counter++));
+
+  populateKeyset(new AiwaVCR1(guiObject, counter++));
+  populateKeyset(new AiwaVCR2(guiObject, counter++));
+  populateKeyset(new AiwaVCR3(guiObject, counter++));
+  populateKeyset(new AiwaAudio1(guiObject, counter++));
+  populateKeyset(new AiwaAudio1a(guiObject, counter++));
+  populateKeyset(new AiwaAudio2(guiObject, counter++));
+  populateKeyset(new AiwaAudio2a(guiObject, counter++));
+  populateKeyset(new AiwaAudio2b(guiObject, counter++));
+  populateKeyset(new AiwaAudio2c(guiObject, counter++));
+  populateKeyset(new AiwaAudio3(guiObject, counter++));
+  populateKeyset(new AiwaAudio4(guiObject, counter++));
+  populateKeyset(new AiwaAudio5(guiObject, counter++));
+  populateKeyset(new AiwaAudio6(guiObject, counter++));
+  populateKeyset(new AiwaCarStereo1(guiObject, counter++));
+  populateKeyset(new AiwaDVD1(guiObject, counter++));
+
   populateKeyset(new AppleWhiteRemote(guiObject, counter++));
 
+  populateKeyset(new BekoTV1(guiObject, counter++));
+
+  populateKeyset(new BoseRadio1(guiObject, counter++));
+  populateKeyset(new BoseRadio2(guiObject, counter++));
+  populateKeyset(new BoseRadio3(guiObject, counter++));
+
+  populateKeyset(new CambridgeCD1(guiObject, counter++));
+  populateKeyset(new CambridgeAudio1(guiObject, counter++));
+  populateKeyset(new CambridgeAudio2(guiObject, counter++));
+  populateKeyset(new CambridgeAudio3(guiObject, counter++));
+  populateKeyset(new CambridgeDVD1(guiObject, counter++));
+
+  populateKeyset(new DaewooTV1(guiObject, counter++));
+  populateKeyset(new DaewooTV2(guiObject, counter++));
+  populateKeyset(new DaewooTV3(guiObject, counter++));
+  populateKeyset(new DaewooTV4(guiObject, counter++));
+  populateKeyset(new DaewooDVD1(guiObject, counter++));
+  populateKeyset(new DaewooVCR1(guiObject, counter++));
+  populateKeyset(new DaewooVCR2(guiObject, counter++));
+
   populateKeyset(new DenonDVD1(guiObject, counter++));
   populateKeyset(new DenonDVD2(guiObject, counter++));
   populateKeyset(new DenonDVD3(guiObject, counter++));
@@ -60,12 +128,12 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new DenonReceiver1a(guiObject, counter++));
   populateKeyset(new DenonReceiver1b(guiObject, counter++));
   populateKeyset(new DenonReceiver1c(guiObject, counter++));
+  populateKeyset(new DenonReceiver1d(guiObject, counter++));
+  populateKeyset(new DenonReceiver1e(guiObject, counter++));
+  populateKeyset(new DenonReceiver1f(guiObject, counter++));
   populateKeyset(new DenonReceiver2(guiObject, counter++));
   populateKeyset(new DenonReceiver2a(guiObject, counter++));
   populateKeyset(new DenonReceiver3(guiObject, counter++));
-  populateKeyset(new DenonReceiver3a(guiObject, counter++));
-  populateKeyset(new DenonReceiver4(guiObject, counter++));
-  populateKeyset(new DenonReceiver5(guiObject, counter++));
   populateKeyset(new DenonAudio1(guiObject, counter++));
   populateKeyset(new DenonAudio1a(guiObject, counter++));
   populateKeyset(new DenonAudio1b(guiObject, counter++));
@@ -74,12 +142,36 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new DenonAudio2(guiObject, counter++));
   populateKeyset(new DenonAudio3(guiObject, counter++));
   populateKeyset(new DenonAudio4(guiObject, counter++));
-  populateKeyset(new DenonAudio5(guiObject, counter++));
+
+  populateKeyset(new DigitalStreamReceiver(guiObject, counter++));
+
+  populateKeyset(new DishReceiver1(guiObject, counter++));
+  populateKeyset(new DishReceiver1a(guiObject, counter++));
+  populateKeyset(new DishReceiver1b(guiObject, counter++));
+  populateKeyset(new DishReceiver1c(guiObject, counter++));
+  populateKeyset(new DishReceiver1d(guiObject, counter++));
+  populateKeyset(new DishReceiver1e(guiObject, counter++));
+  populateKeyset(new DishReceiver1f(guiObject, counter++));
+  populateKeyset(new DishReceiver1g(guiObject, counter++));
+  populateKeyset(new DishReceiver1h(guiObject, counter++));
+  populateKeyset(new DishReceiver1i(guiObject, counter++));
+  populateKeyset(new DishReceiver1j(guiObject, counter++));
+  populateKeyset(new DishReceiver1k(guiObject, counter++));
+  populateKeyset(new DishReceiver1l(guiObject, counter++));
+  populateKeyset(new DishReceiver1m(guiObject, counter++));
+  populateKeyset(new DishReceiver1n(guiObject, counter++));
+  populateKeyset(new DishReceiver1o(guiObject, counter++));
 
   populateKeyset(new EiTV1(guiObject, counter++));
 
   populateKeyset(new ElgatoEyeTV1(guiObject, counter++));
 
+  populateKeyset(new EmersonTV1(guiObject, counter++));
+  populateKeyset(new EmersonDVD1(guiObject, counter++));
+
+  populateKeyset(new FortecReceiver1(guiObject, counter++));
+  populateKeyset(new FortecReceiver2(guiObject, counter++));
+
   populateKeyset(new GoldStarTV1(guiObject, counter++));
   populateKeyset(new GoldStarTV2(guiObject, counter++));
   populateKeyset(new GoldStarVCR1(guiObject, counter++));
@@ -88,12 +180,40 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new GoldStarVCR1c(guiObject, counter++));
   populateKeyset(new GoldStarCD1(guiObject, counter++));
 
+  populateKeyset(new GrundigSat1(guiObject, counter++));
+  populateKeyset(new GrundigSat2(guiObject, counter++));
+  populateKeyset(new GrundigAmp1(guiObject, counter++));
+  populateKeyset(new GrundigAudio1(guiObject, counter++));
+  populateKeyset(new GrundigAudio2(guiObject, counter++));
+  populateKeyset(new GrundigVCR1(guiObject, counter++));
+  populateKeyset(new GrundigVCR1a(guiObject, counter++));
+  populateKeyset(new GrundigTV1(guiObject, counter++));
+  populateKeyset(new GrundigTV2(guiObject, counter++));
+  populateKeyset(new GrundigTV3(guiObject, counter++));
+  populateKeyset(new GrundigDVD1(guiObject, counter++));
+
+  populateKeyset(new HaierTV1(guiObject, counter++));
+
   populateKeyset(new HauppaugePCTV1(guiObject, counter++));
   populateKeyset(new HauppaugePCTV1a(guiObject, counter++));
   populateKeyset(new HauppaugePCTV1b(guiObject, counter++));
   populateKeyset(new HauppaugePCTV1c(guiObject, counter++));
   populateKeyset(new HauppaugePCTV2(guiObject, counter++));
 
+  populateKeyset(new HitachiTV1(guiObject, counter++));
+  populateKeyset(new HitachiTV1a(guiObject, counter++));
+  populateKeyset(new HitachiTV1b(guiObject, counter++));
+  populateKeyset(new HitachiTV1c(guiObject, counter++));
+  populateKeyset(new HitachiTV2(guiObject, counter++));
+  populateKeyset(new HitachiTV3(guiObject, counter++));
+  populateKeyset(new HitachiProjector(guiObject, counter++));
+  populateKeyset(new HitachiDVD1(guiObject, counter++));
+  populateKeyset(new HitachiAudio1(guiObject, counter++));
+  populateKeyset(new HitachiVCR1(guiObject, counter++));
+
+  populateKeyset(new HomecastReceiver1(guiObject, counter++));
+  populateKeyset(new HomecastReceiver2(guiObject, counter++));
+
   populateKeyset(new JVCSat1(guiObject, counter++));
   populateKeyset(new JVCSat2(guiObject, counter++));
   populateKeyset(new JVCVCR1(guiObject, counter++));
@@ -113,6 +233,14 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new JVCAudio2(guiObject, counter++));
   populateKeyset(new JVCDVD1(guiObject, counter++));
 
+  populateKeyset(new KenwoodAudio1(guiObject, counter++));
+  populateKeyset(new KenwoodComponent1(guiObject, counter++));
+  populateKeyset(new KenwoodComponent2(guiObject, counter++));
+  populateKeyset(new KenwoodComponent3(guiObject, counter++));
+  populateKeyset(new KenwoodCD1(guiObject, counter++));
+  populateKeyset(new KenwoodDVD1(guiObject, counter++));
+  populateKeyset(new KenwoodTV1(guiObject, counter++));
+
   populateKeyset(new LGTV1(guiObject, counter++));
   populateKeyset(new LGTV1a(guiObject, counter++));
   populateKeyset(new LGTV1b(guiObject, counter++));
@@ -126,12 +254,24 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new LGVCR1(guiObject, counter++));
   populateKeyset(new LGVCR1a(guiObject, counter++));
   populateKeyset(new LGVCR1b(guiObject, counter++));
+  populateKeyset(new LGAC1(guiObject, counter++));
+
+  populateKeyset(new LogitechSpeakers(guiObject, counter++));
 
   populateKeyset(new MagnavoxDVD1(guiObject, counter++));
   populateKeyset(new MagnavoxVCR1(guiObject, counter++));
   populateKeyset(new MagnavoxConverterBox1(guiObject, counter++));
   populateKeyset(new MagnavoxTV1(guiObject, counter++));
 
+  populateKeyset(new MCERemote1(guiObject, counter++));
+  populateKeyset(new MCERemote1a(guiObject, counter++));
+  populateKeyset(new MCERemote1b(guiObject, counter++));
+  populateKeyset(new MCERemote1c(guiObject, counter++));
+  populateKeyset(new MCERemote1d(guiObject, counter++));
+  populateKeyset(new MCERemote1e(guiObject, counter++));
+  populateKeyset(new MCERemote1f(guiObject, counter++));
+  populateKeyset(new MCERemote1g(guiObject, counter++));
+
   populateKeyset(new MitsubishiTV1(guiObject, counter++));
   populateKeyset(new MitsubishiTV1a(guiObject, counter++));
   populateKeyset(new MitsubishiVCR1(guiObject, counter++));
@@ -139,7 +279,6 @@ PIRKeysetManager::PIRKeysetManager(
 
   populateKeyset(new NokiaGenericVCR(guiObject, counter++));
 
-  populateKeyset(new PanasonicAmp(guiObject, counter++));
   populateKeyset(new PanasonicCarAudio(guiObject, counter++));
   populateKeyset(new PanasonicSat1(guiObject, counter++));
   populateKeyset(new PanasonicSat1a(guiObject, counter++));
@@ -153,7 +292,9 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new PanasonicDVD1(guiObject, counter++));
   populateKeyset(new PanasonicDVD1a(guiObject, counter++));
   populateKeyset(new PanasonicAudio1(guiObject, counter++));
-  populateKeyset(new PanasonicAudio1a(guiObject, counter++));
+  populateKeyset(new PanasonicAC1(guiObject, counter++));
+
+  populateKeyset(new PhilcoTV(guiObject, counter++));
 
   populateKeyset(new PhilipsTV1(guiObject, counter++));
   populateKeyset(new PhilipsTV1a(guiObject, counter++));
@@ -173,6 +314,7 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new PhilipsDVD1d(guiObject, counter++));
   populateKeyset(new PhilipsDVD2(guiObject, counter++));
   populateKeyset(new PhilipsDVD3(guiObject, counter++));
+  populateKeyset(new PhilipsDVD3a(guiObject, counter++));
   populateKeyset(new PhilipsDVD4(guiObject, counter++));
   populateKeyset(new PhilipsVCR1(guiObject, counter++));
   populateKeyset(new PhilipsVCR1a(guiObject, counter++));
@@ -193,21 +335,42 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new PinnaclePCTV2(guiObject, counter++));
   populateKeyset(new PinnaclePCTV3(guiObject, counter++));
 
+  populateKeyset(new PioneerTV1(guiObject, counter++));
+  populateKeyset(new PioneerTV2(guiObject, counter++));
+  populateKeyset(new PioneerTV3(guiObject, counter++));
+  populateKeyset(new PioneerAudio1(guiObject, counter++));
+  populateKeyset(new PioneerAudio1a(guiObject, counter++));
+  populateKeyset(new PioneerAudio2(guiObject, counter++));
+  populateKeyset(new PioneerAudio3(guiObject, counter++));
+  populateKeyset(new PioneerAudio4(guiObject, counter++));
+  populateKeyset(new PioneerAudio5(guiObject, counter++));
+  populateKeyset(new PioneerCD1(guiObject, counter++));
+  populateKeyset(new PioneerLaserDisc1(guiObject, counter++));
+  populateKeyset(new PioneerDVD1(guiObject, counter++));
+
   populateKeyset(new RaiteDVD1(guiObject, counter++));
 
   populateKeyset(new RCATV1(guiObject, counter++));
   populateKeyset(new RCATV1a(guiObject, counter++));
-  populateKeyset(new RCATV2(guiObject, counter++));
+  populateKeyset(new RCATV1b(guiObject, counter++));
+/*
   populateKeyset(new RCAAux1(guiObject, counter++));
   populateKeyset(new RCAAux2(guiObject, counter++));
   populateKeyset(new RCAAux2a(guiObject, counter++));
+*/
   populateKeyset(new RCAVCR1(guiObject, counter++));
-  populateKeyset(new RCAVCR2(guiObject, counter++));
+  populateKeyset(new RCAVCR1a(guiObject, counter++));
   populateKeyset(new RCADVD1(guiObject, counter++));
   populateKeyset(new RCADVD1a(guiObject, counter++));
   populateKeyset(new RCASat1(guiObject, counter++));
   populateKeyset(new RCASat2(guiObject, counter++));
 
+  populateKeyset(new RokuBox1(guiObject, counter++));
+  populateKeyset(new RokuBox2(guiObject, counter++));
+
+  populateKeyset(new SabaTV1(guiObject, counter++));
+  populateKeyset(new SabaTV2(guiObject, counter++));
+
   populateKeyset(new SagemTVBox1(guiObject, counter++));
   populateKeyset(new SagemTVBox1a(guiObject, counter++));
 
@@ -239,7 +402,6 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new SanyoTV1b(guiObject, counter++));
   populateKeyset(new SanyoTV1c(guiObject, counter++));
   populateKeyset(new SanyoTV1d(guiObject, counter++));
-  populateKeyset(new SanyoTV1e(guiObject, counter++));
   populateKeyset(new SanyoProjector(guiObject, counter++));
 
   populateKeyset(new SharpTV1(guiObject, counter++));
@@ -251,6 +413,9 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new SharpVCR1(guiObject, counter++));
   populateKeyset(new SharpReceiver1(guiObject, counter++));
 
+  populateKeyset(new SkyReceiver1(guiObject, counter++));
+  populateKeyset(new SkyReceiver1a(guiObject, counter++));
+
   populateKeyset(new SonyTV1(guiObject, counter++));
   populateKeyset(new SonyTV1a(guiObject, counter++));
   populateKeyset(new SonyTV1b(guiObject, counter++));
@@ -275,6 +440,9 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new Tivo1c(guiObject, counter++));
   populateKeyset(new Tivo1d(guiObject, counter++));
 
+  populateKeyset(new TopfieldPVR1(guiObject, counter++));
+  populateKeyset(new TopfieldSat1(guiObject, counter++));
+
   populateKeyset(new ToshibaTV1(guiObject, counter++));
   populateKeyset(new ToshibaTV1a(guiObject, counter++));
   populateKeyset(new ToshibaTV1b(guiObject, counter++));
@@ -283,6 +451,7 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new ToshibaTV1e(guiObject, counter++));
   populateKeyset(new ToshibaTV1f(guiObject, counter++));
   populateKeyset(new ToshibaTV1g(guiObject, counter++));
+  populateKeyset(new ToshibaTV1h(guiObject, counter++));
   populateKeyset(new ToshibaVCR1(guiObject, counter++));
   populateKeyset(new ToshibaVCR1a(guiObject, counter++));
   populateKeyset(new ToshibaDisc1(guiObject, counter++));
@@ -291,6 +460,9 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new ToshibaDisc1c(guiObject, counter++));
   populateKeyset(new ToshibaDisc1d(guiObject, counter++));
 
+  populateKeyset(new WDMediaPlayer1(guiObject, counter++));
+  populateKeyset(new WDMediaPlayer1a(guiObject, counter++));
+
   populateKeyset(new WestinghouseTV1(guiObject, counter++));
   populateKeyset(new WestinghouseTV2(guiObject, counter++));
 
@@ -305,9 +477,6 @@ PIRKeysetManager::PIRKeysetManager(
   populateKeyset(new YamahaAudio2d(guiObject, counter++));
   populateKeyset(new YamahaAudio3(guiObject, counter++));
   populateKeyset(new YamahaAudio4(guiObject, counter++));
-  populateKeyset(new YamahaAudio5(guiObject, counter++));
-  populateKeyset(new YamahaAudio6(guiObject, counter++));
-  populateKeyset(new YamahaAudio7(guiObject, counter++));
   populateKeyset(new YamahaTV1(guiObject, counter++));
   populateKeyset(new YamahaKaraoke1(guiObject, counter++));
 
@@ -343,7 +512,7 @@ PIRKeysetManager::~PIRKeysetManager()
 
 
 bool PIRKeysetManager::keysetExists(
-  unsigned int keysetID)
+  unsigned int keysetID) const
 {
   PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
 
@@ -354,7 +523,7 @@ bool PIRKeysetManager::keysetExists(
 bool PIRKeysetManager::findKeysetID(
   QString make,
   QString name,
-  unsigned int &id)
+  unsigned int &id) const
 {
   // Only modify the id if we actually find a match!
 
@@ -378,7 +547,7 @@ bool PIRKeysetManager::findKeysetID(
 
 PIRKeysetWidgetItem *PIRKeysetManager::makeKeysetItem(
   QString make,
-  QString name)
+  QString name) const
 {
   unsigned int id;
 
@@ -397,35 +566,36 @@ PIRKeysetWidgetItem *PIRKeysetManager::makeKeysetItem(
 
 bool PIRKeysetManager::hasKey(
   unsigned int keysetID,
-  PIRKeyName name)
+  PIRKeyName name) const
 {
-  PIRKeysetMetaData *meta = keysetsInfo[keysetID];
+  PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
 
-  if (!meta) return false;
+  if ((i == keysetsInfo.end()) || !i->second) return false;
 
-  return meta->hasKey(name);
+  return i->second->hasKey(name);
 }
 
 
 PIRMakeName PIRKeysetManager::getMake(
-  unsigned int keysetID)
+  unsigned int keysetID) const
 {
-  PIRKeysetMetaData *meta = keysetsInfo[keysetID];
+  PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
 
-  if (!meta) return Any_Make; // Work on this!
+  if ((i == keysetsInfo.end()) || !i->second) return Any_Make;
 
-  return meta->getMake();
+  return i->second->getMake();
 }
 
 
 QString PIRKeysetManager::getDisplayName(
-  unsigned int keysetID)
+  unsigned int keysetID) const
 {
-  PIRKeysetMetaData *meta = keysetsInfo[keysetID];
+  PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
 
-  if (!meta) return QString("Database Error");
+  if ((i == keysetsInfo.end()) || !i->second)
+    return QString("Database Error");
 
-  return QString(meta->getKeysetName());
+  return QString(i->second->getKeysetName());
 }
 
 
@@ -435,7 +605,7 @@ void PIRKeysetManager::populateKeyset(
   // Set up the keyset collection:
   keysetsInfo[keyset->getID()] = keyset;
 
-  keyset->moveProtocolToThread(commandThread);
+  keyset->moveProtocolToThread(&commandThread);
 
   // Also, set up a name-based index into the collection:
   makeIndex
@@ -446,7 +616,7 @@ void PIRKeysetManager::populateKeyset(
 
 
 void PIRKeysetManager::populateGuiWidget(
-  PIRSelectKeysetForm *skf)
+  PIRSelectKeysetForm *skf) const
 {
   PIRMakeName make;
   PIRKeysetWidgetItem *kwi;
@@ -469,8 +639,11 @@ void PIRKeysetManager::populateGuiWidget(
 
 void PIRKeysetManager::populateDeviceTypes(
   PIRKeysetWidgetItem *kwi,
-  unsigned int keysetID)
+  unsigned int keysetID) const
 {
-  // Pass the buck:  (Need to check for bad keysetID here?)
-  keysetsInfo[keysetID]->populateDeviceTypes(kwi);
+  PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
+  if ((i != keysetsInfo.end()) && i->second)
+  {
+    i->second->populateDeviceTypes(kwi);
+  }
 }