MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / gotTargettedFrame

Method gotTargettedFrame

scriptcontainer.cpp:255–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255void 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

Callers

nothing calls this directly

Calls 2

checkFilterMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected