| 406 | } |
| 407 | |
| 408 | void UDSScriptHelper::newUDSMessage(UDS_MESSAGE msg) |
| 409 | { |
| 410 | //qDebug() << "udsScriptHelper got a UDS message"; |
| 411 | qDebug() << "UDS script helper. Meg data len: " << msg.len; |
| 412 | if (!gotFrameFunction.isCallable()) return; //nothing to do if we can't even call the function |
| 413 | //qDebug() << "Got frame in script interface"; |
| 414 | |
| 415 | QJSValueList args; |
| 416 | args << msg.bus << msg.ID << msg.service << msg.subFunc << msg.len; |
| 417 | QJSValue dataBytes = scriptEngine->newArray(static_cast<unsigned int>(msg.len)); |
| 418 | |
| 419 | for (int j = 0; j < msg.data.length(); j++) dataBytes.setProperty(static_cast<quint32>(j), QJSValue(msg.data[j])); |
| 420 | args.append(dataBytes); |
| 421 | gotFrameFunction.call(args); |
| 422 | } |
| 423 | |