MCPcopy Create free account
hub / github.com/OpenZWave/open-zwave / checkConfigFiles

Method checkConfigFiles

cpp/src/ManufacturerSpecificDB.cpp:305–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void ManufacturerSpecificDB::checkConfigFiles
306(
307 Driver *driver
308)
309{
310 LockGuard LG(m_MfsMutex);
311 if (!s_bXmlLoaded)
312 LoadProductXML();
313
314 string configPath;
315 Options::Get()->GetOptionAsString( "ConfigPath", &configPath );
316
317 map<int64,ProductDescriptor*>::iterator pit;
318 for (pit = s_productMap.begin(); pit != s_productMap.end(); pit++) {
319 ProductDescriptor *c = pit->second;
320 if (c->GetConfigPath().size() > 0) {
321 string path = configPath + c->GetConfigPath();
322
323 /* check if we are downloading already */
324 std::list<string>::iterator iter = std::find (m_downloading.begin(), m_downloading.end(), path);
325 /* check if the file exists */
326 if (iter == m_downloading.end() && !FileOps::Create()->FileExists(path)) {
327 Log::Write( LogLevel_Warning, "Config File for %s does not exist - %s", c->GetProductName().c_str(), path.c_str());
328 /* try to download it */
329 if (driver->startConfigDownload(c->GetManufacturerId(), c->GetProductType(), c->GetProductId(), path)) {
330 m_downloading.push_back(path);
331 } else {
332 Log::Write(LogLevel_Warning, "Can't download file %s", path.c_str());
333 Notification* notification = new Notification( Notification::Type_UserAlerts );
334 notification->SetUserAlertNofification(Notification::Alert_ConfigFileDownloadFailed);
335 driver->QueueNotification( notification );
336 }
337 } else if (iter != m_downloading.end()) {
338 Log::Write(LogLevel_Debug, "Config file for %s already queued", c->GetProductName().c_str());
339 }
340 }
341 }
342 checkInitialized();
343}
344
345void ManufacturerSpecificDB::configDownloaded
346(

Callers 1

processConfigRevisionMethod · 0.80

Calls 15

WriteFunction · 0.85
GetOptionAsStringMethod · 0.80
GetConfigPathMethod · 0.80
startConfigDownloadMethod · 0.80
QueueNotificationMethod · 0.80
GetFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
FileExistsMethod · 0.45
c_strMethod · 0.45
GetProductNameMethod · 0.45

Tested by

no test coverage detected