----------------------------------------------------------------------------- Add a new Z-Wave PC Interface -----------------------------------------------------------------------------
| 316 | // Add a new Z-Wave PC Interface |
| 317 | //----------------------------------------------------------------------------- |
| 318 | bool Manager::AddDriver |
| 319 | ( |
| 320 | string const& _controllerPath, |
| 321 | Driver::ControllerInterface const& _interface |
| 322 | ) |
| 323 | { |
| 324 | // Make sure we don't already have a driver for this controller |
| 325 | |
| 326 | // Search the pending list |
| 327 | for( list<Driver*>::iterator pit = m_pendingDrivers.begin(); pit != m_pendingDrivers.end(); ++pit ) |
| 328 | { |
| 329 | if( _controllerPath == (*pit)->GetControllerPath() ) |
| 330 | { |
| 331 | Log::Write( LogLevel_Info, "mgr, Cannot add driver for controller %s - driver already exists", _controllerPath.c_str() ); |
| 332 | return false; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | // Search the ready map |
| 337 | for( map<uint32,Driver*>::iterator rit = m_readyDrivers.begin(); rit != m_readyDrivers.end(); ++rit ) |
| 338 | { |
| 339 | if( _controllerPath == rit->second->GetControllerPath() ) |
| 340 | { |
| 341 | Log::Write( LogLevel_Info, "mgr, Cannot add driver for controller %s - driver already exists", _controllerPath.c_str() ); |
| 342 | return false; |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | Driver* driver = new Driver( _controllerPath, _interface ); |
| 347 | m_pendingDrivers.push_back( driver ); |
| 348 | driver->Start(); |
| 349 | |
| 350 | Log::Write( LogLevel_Info, "mgr, Added driver for controller %s", _controllerPath.c_str() ); |
| 351 | return true; |
| 352 | } |
| 353 | |
| 354 | //----------------------------------------------------------------------------- |
| 355 | // <Manager::RemoveDriver> |