55 RPCHelper::RPCHelper()
59 RPCHelper::~RPCHelper()
65 QString command = _plugin+
"."+_functionName+
"()";
67 QScriptValue returnValue = _engine->evaluate(command);
68 if ( returnValue.isError() ) {
69 QString error = returnValue.toString();
70 std::cerr <<
"Error : " << error.toStdString() << std::endl;
76 QScriptValue
RPCHelper::callFunction(QScriptEngine* _engine,
const QString& _plugin,
const QString& _functionName ,
const std::vector< QScriptValue >& _parameters)
78 QString command = _plugin+
"."+_functionName+
"(";
80 for ( uint i = 0 ; i < _parameters.size(); ++i ) {
81 _engine->globalObject().setProperty(
"ParameterData" + QString::number(i) , _parameters[i] );
82 command +=
"ParameterData" + QString::number(i);
83 if ( (i + 1) < _parameters.size() )
88 QScriptValue returnValue = _engine->evaluate(command);
89 if ( returnValue.isError() ) {
90 QString error = returnValue.toString();
91 std::cerr <<
"Error : " << error.toStdString() << std::endl;
QScriptValue callFunction(QScriptEngine *_engine, const QString &_plugin, const QString &_functionName)
call a function provided by a plugin