| 303 | } |
| 304 | |
| 305 | void 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 | |
| 345 | void ManufacturerSpecificDB::configDownloaded |
| 346 | ( |
no test coverage detected