コード例 #1
0
ファイル: main.cpp プロジェクト: Tobias-Fischer/ikart
    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;
    }
コード例 #2
0
template <class T> void fbe_broadcastData(T& _values, yarp::os::BufferedPort<T>& _port)
{
    if (_port.getOutputCount()>0 )
    {
        _port.prepare()  = _values ;
        _port.write();
    }
}