| 228 | } |
| 229 | |
| 230 | void CANScriptHelper::sendFrame(QJSValue bus, QJSValue id, QJSValue length, QJSValue data) |
| 231 | { |
| 232 | CANFrame frame; |
| 233 | frame.extended = false; |
| 234 | frame.remote = false; |
| 235 | frame.ID = static_cast<uint32_t>(id.toInt()); |
| 236 | frame.len = length.toUInt(); |
| 237 | if (frame.len > 8) frame.len = 8; |
| 238 | |
| 239 | if (!data.isArray()) qDebug() << "data isn't an array"; |
| 240 | |
| 241 | for (unsigned int i = 0; i < frame.len; i++) |
| 242 | { |
| 243 | frame.data[i] = (uint8_t)data.property(i).toInt(); |
| 244 | } |
| 245 | |
| 246 | frame.bus = (uint32_t)bus.toInt(); |
| 247 | //if (frame.bus > 1) frame.bus = 1; |
| 248 | |
| 249 | if (frame.ID > 0x7FF) frame.extended = true; |
| 250 | |
| 251 | qDebug() << "sending frame from script"; |
| 252 | CANConManager::getInstance()->sendFrame(frame); |
| 253 | } |
| 254 | |
| 255 | void CANScriptHelper::gotTargettedFrame(const CANFrame &frame) |
| 256 | { |
no outgoing calls
no test coverage detected