Element writeSoftwareRadio( RadioRepresentation &swrDesc) { Element e("softwareradio"); //Write all the controllers vector<ControllerDescription> controllers = swrDesc.getControllers(); vector<ControllerDescription>::iterator conIt; for(conIt=controllers.begin();conIt!=controllers.end();conIt++) { Element currentController = writeController(*conIt); e.InsertEndChild(currentController); } //Write all the engines vector<EngineDescription> engines = swrDesc.getEngines(); vector<EngineDescription>::iterator engIt; for(engIt=engines.begin();engIt!=engines.end();engIt++) { Element currentEngine = writeEngine(*engIt); e.InsertEndChild(currentEngine); } //Write all the links vector<LinkDescription> links = swrDesc.getLinks(); vector<LinkDescription>::iterator linkIt; for(linkIt=links.begin();linkIt!=links.end();linkIt++) { Element currentLink = writeLink(*linkIt); e.InsertEndChild(currentLink); } return e; }
/** Creates a new C300Controller object. * \param[in] portName The name of the asyn port that will be created for this driver * \param[in] C300PortName The name of the drvAsynIPPPort that was created previously to connect to the C300 controller * \param[in] numAxes The number of axes that this controller supports * \param[in] movingPollPeriod The time between polls when any axis is moving * \param[in] idlePollPeriod The time between polls when no axis is moving */ C300Controller::C300Controller(const char *portName, const char *C300PortName, int numAxes, double movingPollPeriod, double idlePollPeriod) : asynMotorController(portName, numAxes, NUM_C300_PARAMS, asynUInt32DigitalMask, asynUInt32DigitalMask, ASYN_CANBLOCK | ASYN_MULTIDEVICE, 1, // autoconnect 0, 0) // Default priority and stack size { int axis; asynStatus status; C300Axis *pAxis; static const char *functionName = "C300Controller"; /* Connect to C300 controller */ status = pasynOctetSyncIO->connect(C300PortName, 0, &pasynUserC300_, NULL); if (status) { asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: cannot connect to C300 controller\n", driverName, functionName); } // Unlock the controller sprintf(outString_, "SYS:PASS:CEN \"nPoint\""); writeController(); // get controller id, firmware version and range? // Wait a short while so that any responses to the above commands have time to arrive so we can flush // them in the next writeReadController() //epicsThreadSleep(0.5); // Create the axis objects for (axis=0; axis<numAxes; axis++) { pAxis = new C300Axis(this, axis); } startPoller(movingPollPeriod, idlePollPeriod, 2); }
/** Writes a string to the C300 controller. * Calls writeController() with a default location of the string to write and a default timeout. */ asynStatus C300Controller::writeController() { return writeController(outString_, C300_TIMEOUT); }