added bQuickScan param to DetectDevices(), so we don't try to open a connection each...
[deb_libcec.git] / src / lib / LibCEC.cpp
index a27ad9dbc45530e02a38ed3a3b408b64db6f9955..c24b4ed96e7d2ffcd8cb93fdbc7051d3325a0d30 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the libCEC(R) library.
  *
- * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited.  All rights reserved.
  * libCEC(R) is an original work, containing original code.
  *
  * libCEC(R) is a trademark of Pulse-Eight Limited.
@@ -559,3 +559,21 @@ uint8_t CLibCEC::AudioStatus(void)
 {
   return m_client ? m_client->AudioStatus() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
 }
+
+int8_t CLibCEC::DetectAdapters(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */, bool bQuickScan /* = false */)
+{
+  int8_t iAdaptersFound = CAdapterFactory(this).DetectAdapters(deviceList, iBufSize, strDevicePath);
+  if (!bQuickScan)
+  {
+    for (int8_t iPtr = 0; iPtr < iAdaptersFound; iPtr++)
+    {
+      libcec_configuration config;
+      GetDeviceInformation(deviceList[iPtr].strComName, &config);
+      deviceList[iPtr].iFirmwareVersion   = config.iFirmwareVersion;
+      deviceList[iPtr].iPhysicalAddress   = config.iPhysicalAddress;
+      deviceList[iPtr].iFirmwareBuildDate = config.iFirmwareBuildDate;
+      deviceList[iPtr].adapterType        = config.adapterType;
+    }
+  }
+  return iAdaptersFound;
+}