We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I am testing this library out in my QT Creator Project. Everything I tried came to a freeze of the transcoding:
DBC file loaded successfully! Parsed ID: "18FEF100" Parsed Payload: "FF0000000000E9C0" Frame ID: 419361024 Frame ID Hex: "18FEF100" Frame DLC: 8 Frame Data: 0x7ffc833de728 Frame Data Hex: "FF0000000000E9C0" Transcoding frame2...
Here is the most important part of the code:
void CANDecoder::loadDBC(const QString &dbcFilePath) { // Read the DBC file content std::ifstream dbcFile(dbcFilePath.toStdString()); if (!dbcFile.is_open()) { qCritical() << "Failed to open DBC file:" << dbcFilePath; return; } std::string dbcContent((std::istreambuf_iterator<char>(dbcFile)), std::istreambuf_iterator<char>()); // Parse the DBC file and load the transcoder bool parsed = can::parse_dbc(dbcContent, std::ref(m_transcoder)); if (parsed) { qDebug() << "DBC file loaded successfully!"; QString CANID = "00011000111111101111000100000000"; QString CANPayload = "1111111100000000000000000000000000000000000000001110100111000000"; QString CANFrame = CANID + CANPayload; QString idString = CANFrame.mid(0, 32); QString payloadString = CANFrame.mid(32); quint32 id = bitArrayToInt(stringToBits(idString)); QByteArray payload = bitArrayToByteArray(stringToBits(payloadString)); qDebug() << "Parsed ID:" << QString::number(id, 16).toUpper(); qDebug() << "Parsed Payload:" << payload.toHex().toUpper(); processFrame(QString::number(id, 16).toUpper(), payload); } else { qCritical() << "Failed to parse DBC file!"; } } void CANDecoder::processFrame(const QString &frameId, const QByteArray &frameData) { quint32 frameIdInt = frameId.toUInt(nullptr, 16); qDebug() << "awdawdawdawdawdawdawd ID:" << frameIdInt; can_frame frame; frame.can_id = frameIdInt; frame.can_dlc = frameData.size(); std::memcpy(frame.data, frameData.constData(), std::min(static_cast<int>(frameData.size()), static_cast<int>(sizeof(frame.data)))); qDebug() << "Frame ID:" << frame.can_id; qDebug() << "Frame ID Hex:" << QString::number(frame.can_id, 16).toUpper(); qDebug() << "Frame DLC:" << frame.can_dlc; qDebug() << "Frame Data:" << frame.data; qDebug() << "Frame Data Hex:" << QByteArray(reinterpret_cast<char*>(frame.data), frame.can_dlc).toHex().toUpper(); try { auto now = std::chrono::system_clock::now(); qDebug() << "Transcoding frame2..."; m_framePacket = m_transcoder.transcode(now, frame); qDebug() << "Frame transcoded."; } catch (const std::exception& e) { qDebug() << "Error in transcoding: " << e.what(); } qDebug() << "SHITS:" << m_framePacket.data_begin(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I am testing this library out in my QT Creator Project. Everything I tried came to a freeze of the transcoding:
Here is the most important part of the code:
The text was updated successfully, but these errors were encountered: