| 253 | } |
| 254 | |
| 255 | void CANScriptHelper::gotTargettedFrame(const CANFrame &frame) |
| 256 | { |
| 257 | if (!gotFrameFunction.isCallable()) return; //nothing to do if we can't even call the function |
| 258 | //qDebug() << "Got frame in script interface"; |
| 259 | for (int i = 0; i < filters.length(); i++) |
| 260 | { |
| 261 | if (filters[i].checkFilter(frame.ID, frame.bus)) |
| 262 | { |
| 263 | QJSValueList args; |
| 264 | args << frame.bus << frame.ID << frame.len; |
| 265 | QJSValue dataBytes = scriptEngine->newArray(frame.len); |
| 266 | |
| 267 | for (unsigned int j = 0; j < frame.len; j++) dataBytes.setProperty(j, QJSValue(frame.data[j])); |
| 268 | args.append(dataBytes); |
| 269 | gotFrameFunction.call(args); |
| 270 | return; //as soon as one filter matches we jump out |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | |
| 276 |
nothing calls this directly
no test coverage detected