void MindTarget::addSensor( String p_id , MindSensor *sensor ) { Xml configSensors = config.getChildNode( "sensors" ); Xml xconfig = configSensors.findChildByPathAttr( "sensor" , "id" , p_id ); bool offline = true; if( xconfig.exists() && xconfig.getBooleanAttribute( "run" , true ) ) { sensor -> configureSensor( xconfig ); offline = false; } sensor -> setSensorId( p_id ); sensorArea -> addSensor( sensor , offline ); }
void MindTarget::addEffector( String p_id , MindEffector *effector ) { Xml configEffectors = config.getChildNode( "effectors" ); Xml xconfig = configEffectors.findChildByPathAttr( "effector" , "id" , p_id ); ASSERTMSG( xconfig.exists() , "addEffector: unknown target id=" + p_id ); bool offline = true; if( xconfig.getBooleanAttribute( "run" , true ) ) { effector -> configureEffector( xconfig ); offline = false; } effector -> setEffectorId( p_id ); effectorArea -> addEffector( effector , offline ); }