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

Method AddDriver

cpp/src/Manager.cpp:318–352  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Add a new Z-Wave PC Interface -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

316// Add a new Z-Wave PC Interface
317//-----------------------------------------------------------------------------
318bool 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>

Callers 2

mainFunction · 0.80
mainFunction · 0.80

Calls 6

WriteFunction · 0.85
GetControllerPathMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected