47 RPCHelper::RPCHelper()
51 RPCHelper::~RPCHelper()
57 QString command = _plugin+
"."+_functionName+
"()";
59 QScriptValue returnValue = _engine->evaluate(command);
60 if ( returnValue.isError() ) {
61 QString error = returnValue.toString();
62 std::cerr <<
"Error : " << error.toStdString() << std::endl;
68 QScriptValue
RPCHelper::callFunction(QScriptEngine* _engine,
const QString& _plugin,
const QString& _functionName ,
const std::vector< QScriptValue >& _parameters)
70 QString command = _plugin+
"."+_functionName+
"(";
72 for ( uint i = 0 ; i < _parameters.size(); ++i ) {
73 _engine->globalObject().setProperty(
"ParameterData" + QString::number(i) , _parameters[i] );
74 command +=
"ParameterData" + QString::number(i);
75 if ( (i + 1) < _parameters.size() )
80 QScriptValue returnValue = _engine->evaluate(command);
81 if ( returnValue.isError() ) {
82 QString error = returnValue.toString();
83 std::cerr <<
"Error : " << error.toStdString() << std::endl;
QScriptValue callFunction(QScriptEngine *_engine, const QString &_plugin, const QString &_functionName)
call a function provided by a plugin