bool AnalogServer::attachAll(const PolyDriverList &analog2attach) { yTrace(); if (analog2attach.size() != 1) { std::cerr<<"AnalogServer: cannot attach more than one device\n"; return false; } yarp::dev::PolyDriver * Idevice2attach=analog2attach[0]->poly; if (Idevice2attach->isValid()) { Idevice2attach->view(analogSensor_p); } if(NULL == analogSensor_p) { yError() << "AnalogServer: subdevice passed to attach method is invalid!!!"; return false; } attach(analogSensor_p); start(); return true; }
bool AnalogWrapper::attachAll(const PolyDriverList &analog2attach) { //check if we already instantiated a subdevice previously if (ownDevices) return false; if (analog2attach.size() != 1) { yError("AnalogWrapper: cannot attach more than one device"); return false; } yarp::dev::PolyDriver * Idevice2attach=analog2attach[0]->poly; if (Idevice2attach->isValid()) { Idevice2attach->view(analogSensor_p); } if(YARP_NULLPTR == analogSensor_p) { yError("AnalogWrapper: subdevice passed to attach method is invalid"); return false; } attach(analogSensor_p); RateThread::setRate(_rate); RateThread::start(); return true; }
bool BatteryWrapper::attachAll(const PolyDriverList &battery2attach) { if (battery2attach.size() != 1) { yError("BatteryWrapper: cannot attach more than one device"); return false; } yarp::dev::PolyDriver * Idevice2attach = battery2attach[0]->poly; if (Idevice2attach->isValid()) { Idevice2attach->view(battery_p); } if(NULL == battery_p) { yError("BatteryWrapper: subdevice passed to attach method is invalid"); return false; } attach(battery_p); RateThread::setRate(_rate); RateThread::start(); return true; }
bool JoypadControlServer::attachAll(const PolyDriverList& p) { if (p.size() != 1) { yError("JoypadControlServer: cannot attach more than one device"); return false; } yarp::dev::PolyDriver* Idevice2attach = p[0]->poly; if(p[0]->key == "IJoypadController") { yInfo() << "JoypadControlServer: Good name Dude!"; } else { yInfo() << "JoypadControlServer: Bad name Dude!!"; } if (!Idevice2attach->isValid()) { yError() << "JoypadControlServer: Device " << p[0]->key << " to attach to is not valid ... cannot proceed"; return false; } Idevice2attach->view(m_device); if(!attach(m_device)) return false; PeriodicThread::setPeriod(m_period); if (!PeriodicThread::start()) return false; openPorts(); return true; }
bool yarp::dev::ServerInertial::attachAll(const PolyDriverList &imuToAttachTo) { if (imuToAttachTo.size() != 1) { yError("ServerInertial: cannot attach more than one device"); return false; } return attach(imuToAttachTo[0]->poly); }
bool Rangefinder2DWrapper::attachAll(const PolyDriverList &device2attach) { if (device2attach.size() != 1) { yError("Rangefinder2DWrapper: cannot attach more than one device"); return false; } yarp::dev::PolyDriver * Idevice2attach = device2attach[0]->poly; if (Idevice2attach->isValid()) { Idevice2attach->view(sens_p); Idevice2attach->view(iTimed); } if (NULL == sens_p) { yError("Rangefinder2DWrapper: subdevice passed to attach method is invalid"); return false; } attach(sens_p); if(!sens_p->getDistanceRange(minDistance, maxDistance)) { yError() << "Laser device does not provide min & max distance range."; return false; } if(!sens_p->getScanLimits(minAngle, maxAngle)) { yError() << "Laser device does not provide min & max angle scan range."; return false; } if (!sens_p->getHorizontalResolution(resolution)) { yError() << "Laser device does not provide horizontal resolution "; return false; } RateThread::setRate(_rate); RateThread::start(); return true; }
bool VirtualAnalogWrapper::attachAll(const PolyDriverList &polylist) { mMutex.wait(); for (int p=0; p<polylist.size(); ++p) { std::string key=polylist[p]->key.c_str(); // find appropriate entry in list of subdevices and attach for (unsigned int k=0; k<mSubdevices.size(); ++k) { if (mSubdevices[k].getKey()==key) { if (!mSubdevices[k].attach(polylist[p]->poly,key)) { mMutex.post(); return false; } } } } //check if all devices are attached to the driver for (unsigned int k=0; k<mSubdevices.size(); ++k) { if (!mSubdevices[k].isAttached()) { mMutex.post(); return false; } } mMutex.post(); Thread::start(); return true; }
bool floatingBaseEstimator::attachAllControlBoard(const PolyDriverList& p) { PolyDriverList controlBoardList; for(size_t devIdx = 0; devIdx < (size_t) p.size(); devIdx++) { IEncoders * pEncs = 0; if( p[devIdx]->poly->view(pEncs) ) { controlBoardList.push(const_cast<PolyDriverDescriptor&>(*p[devIdx])); } } // Attach the controlBoardList to the controlBoardRemapper bool ok = remappedControlBoardInterfaces.multwrap->attachAll(controlBoardList); if( !ok ) { yError() << " floatingBaseEstimator::attachAll in attachAll of the remappedControlBoard"; return false; } return true; }
/** * IWrapper and IMultipleWrapper interfaces */ bool RGBDSensorWrapper::attachAll(const PolyDriverList &device2attach) { // First implementation only accepts devices with both the interfaces Framegrabber and IDepthSensor, // on a second version maybe two different devices could be accepted, one for each interface. // Yet to be defined which and how parameters shall be used in this case ... using the name of the // interface to view could be a good initial guess. if (device2attach.size() != 1) { yError("RGBDSensorWrapper: cannot attach more than one device"); return false; } yarp::dev::PolyDriver * Idevice2attach = device2attach[0]->poly; if(device2attach[0]->key == "IRGBDSensor") { yInfo() << "RGBDSensorWrapper: Good name Dude!"; } else { yInfo() << "RGBDSensorWrapper: Bad name Dude!!"; } if (!Idevice2attach->isValid()) { yError() << "RGBDSensorWrapper: Device " << device2attach[0]->key << " to attach to is not valid ... cannot proceed"; return false; } Idevice2attach->view(sensor_p); if(!attach(sensor_p)) return false; RateThread::setRate(rate); RateThread::start(); return true; }
bool HapticDeviceWrapper::attachAll(const PolyDriverList &p) { if (p.size()!=1) { yError("*** Haptic Device Wrapper: cannot attach more than one device"); return false; } PolyDriver *dev=p[0]->poly; if (dev->isValid()) dev->view(device); if (device==NULL) { yError("*** Haptic Device Wrapper: invalid device"); return false; } start(); if (verbosity>0) yInfo("*** Haptic Device Wrapper: started"); return true; }