virtual bool on_timeout() { char cmd[] = "lynx -auth=admin:password -dump \" http://10.0.0.250/cgi-bin/cgi?req=frm&frm=info.html&rand=1616217005\" | grep -i status"; FILE* pipe =popen(cmd,"r"); if (!pipe) return "ERROR"; char buffer[128]; string result = ""; while(!feof(pipe)) { if(fgets(buffer, 128, pipe) != NULL) result += buffer; } pclose(pipe); static int signal=0; char tmp[20]; static double strenght=0.0; sscanf(result.c_str(),"%*s %*s %d %*s %s",&signal,tmp ); strenght = atof (tmp+1); Bottle& outBot = monitorOutput.prepare(); outBot.clear(); outBot.addInt(signal); outBot.addDouble(strenght); monitorOutput.write(); graphics->update_graphics(signal,strenght); return true; }
template <class T> void fbe_broadcastData(T& _values, yarp::os::BufferedPort<T>& _port) { if (_port.getOutputCount()>0 ) { _port.prepare() = _values ; _port.write(); } }
yarp::os::Bottle BlobMatch::getYarpBottle(yarp::os::BufferedPort<yarp::os::Bottle>& outport) { yarp::os::Bottle& result = outport.prepare(); result.clear(); result.addString("colour"); result.addString(color.c_str()); result.addDouble(pt.x); result.addDouble(pt.y); result.addInt(size); outport.writeStrict(); return result; }