当前位置:网站首页>BM setup process
BM setup process
2022-06-25 14:51:00 【-Ximen blowing snow】
The whole idea is ,
Turn on the device first ,
devic.getDeviceId()This is the initialized device idCreate cache
start-up bm, The filter is set at the beginning 31RT Address
Start the thread to constantly crawl
Set different filter rules during
Closed post clean cache ,
Here's the initialization bm Of . initialization bm Then a thread is opened BusMonitorDataReadThread, Keep reading data
// status = boardCom.bmFilter(devic.getDeviceId(), 1, 0XFFFFFFFF, 0XFFFFFFFF);
// This is the beginning of setting up a filter
status = boardCom.bmFilter(devic.getDeviceId(), 31, 0XFFFFFFFF, 0XFFFFFFFF);
LogSingleTon::getInstance()->bmMsgLog(" Filter setting parameters " + QString::fromStdString(ADT_L1_Error_to_String(status)));
if(status == ADT_SUCCESS) {///> Set filter successfully
// Set up BM Capture memory ,READ_MSGS_NUM Bus message caching for development
status = boardCom.bmBufferSet(devic.getDeviceId(), READ_MSGS_NUM);
if(status == ADT_SUCCESS) {///> Memory development succeeded
// start-up BM function
status = boardCom.bmStart(devic.getDeviceId(), true);
if(status == ADT_SUCCESS) {
// Create a thread , And start grabbing , This is a direct grab bm in cdp The thread of ,READ_MSGS_NUM1000 individual
BusMonitorDataReadThread *readDataThread = new BusMonitorDataReadThread(devic.getDeviceId(), READ_MSGS_NUM);
connect(this, SIGNAL(stopReadData()), readDataThread, SLOT(recControlStopSignal()));
connect(readDataThread, SIGNAL(bmDataReadThreadGenInfor(QString)), this, SLOT(recBmInfor(QString)));
readDataThread->begin();///> Thread start
// Interface enable
ui->stopBM->setEnabled(true);
ui->start->setEnabled(false);
} else {
msgs = "BM Boot failure ";
msgs += ADT_L1_Error_to_String(status);
LogSingleTon::getInstance()->errorOutPut(msgs);
}
} else {
msgs = "BM memory allocation failed ";
msgs += ADT_L1_Error_to_String(status);
LogSingleTon::getInstance()->errorOutPut(msgs);
}
} else {
msgs = "BM Failed to set filter ";
msgs += ADT_L1_Error_to_String(status);
LogSingleTon::getInstance()->errorOutPut(msgs);
}The thread code is as follows : The main function is to read messages and process them
ADT_L0_UINT32 status;
ADT_L0_UINT32 numMsgs;///> The actual number of messages read
BaordCommon boardCom;
// ADT_L1_1553_CDP bmMessages[20];
ADT_L1_1553_CDP bmMessages[1000];
// Loop data
while (!stopped) {
if(!paused) {///> threading
// Read message
status = boardCom.bmReadNewMsgs(deviceId, msgNums, &numMsgs, bmMessages);
if(status == ADT_SUCCESS) {
QFuture<void>w = QtConcurrent::run([ = ]() {
QString msgInfo;
// qDebug() << "BM data fetch " << numMsgs;
/* BM The captured data is displayed */
for (uint i = 0; i < numMsgs; i++) {
/* Show basic messages */
if(bmMessages[i].STS1info != 0xffffffff) {
msgInfo.clear();
msgInfo += " Message count :" + convert.intToBigEndianByteArray(QString::number(bmMessages[i].BMCount).toInt()).toHex();
msgInfo += " Time high :" + convert.intToBigEndianByteArray(QString::number(bmMessages[i].TimeHigh).toInt()).toHex().toUpper();
// msgInfo += " Time low :" + convert.intToBigEndianByteArray(QString::number(bmMessages[i].TimeLow).toInt()).toHex().toUpper();
msgInfo += " Time low :" + QString::number((bmMessages[i].TimeLow * 20) / 1000000);
msgInfo += " Message interval :" + QString::number(bmMessages[i].IMGap / 100) + QString("\n"); ///>100ns The interval of
msgInfo += " CMD1: " + convert.intToBigEndianByteArray(QString::number(bmMessages[i].CMD1info & 0xFFFF).toInt()).toHex().toUpper();
msgInfo += wordPasre.getCommandInfo( bmMessages[i].CMD1info & 0xFFFF);
msgInfo += " STS1: " + convert.intToBigEndianTwoBytes(QString::number(bmMessages[i].STS1info & 0xFFFF).toInt()).toHex().toUpper() + QString(" ");
msgInfo += " CDP Status word : " + convert.intToBigEndianTwoBytes(QString::number(bmMessages[i].CDPStatusWord & 0xFFFFFFFF).toInt()).toHex().toUpper() + QString("\n");
for (int j = 0; j < 32; j++) {
msgInfo += convert.formatDislpay( convert.intToBigEndianTwoBytes(bmMessages[i].DATAinfo[j]));
if (!((j + 1) % 8)) msgInfo += "\n";
}
LogSingleTon::getInstance()->bmMsgLog(msgInfo);
emit bmDataReadThreadGenInfor(msgInfo);
}
}
} );
w.waitForFinished();
} else {
emit bmDataReadThreadGenInfor(" Message fetching failed ");
}
msleep(10);
} else {///> Thread pause
sleep(1);///> Sleep 1 second
}
}The thread has a function that can receive the set filter information
The code is as follows :
void BusMonitorDataReadThread::recFilter(ADT_L0_UINT32 rt, ADT_L0_UINT32 rxFilter, ADT_L0_UINT32 txFilter) {
BaordCommon boardCom;
filterStatus = boardCom.bmFilter(deviceId, rt, rxFilter, txFilter);
}
边栏推荐
- [deep learning] multi task learning of multiple datasets data sets missing labels
- QQ love talk candy love talk content acquisition and storage
- New title of PTA
- 分饼干问题
- Add the resources directory under test in idea
- [untitled] PTA check password
- 从0到1完全掌握 XSS
- Use Matplotlib to draw a line chart
- [untitled] the CMD command window displays' NPM 'which is not an internal or external command
- 【深度学习】多任务学习 多个数据集 数据集漏标
猜你喜欢

Kubernetes 理解kubectl/调试

Jaspersoft studio installation

Gif动图如何裁剪?收下这个图片在线裁剪工具
![[untitled] the CMD command window displays' NPM 'which is not an internal or external command](/img/db/b1ae4b0d1110af1e24887ba3b4fe16.jpg)
[untitled] the CMD command window displays' NPM 'which is not an internal or external command

Sequential programming 1

How to cut the size of a moving picture? Try this online photo cropping tool

2022年广东高考分数线出炉,一个几家欢喜几家愁

SPARQL learning notes of query, an rrdf query language

To make pytorch faster, you need to master these 17 methods

【中国海洋大学】考研初试复试资料分享
随机推荐
[deep learning] multi label learning
Does stream even have application advanced learning? As a programmer, you know what
Ideal L9 in the eyes of the post-90s: the simplest product philosophy, creating the most popular products
Explanation of dev/mapper
使用sphinx根据py源文件自动生成API文档
Judging the number of leap years from 1 to N years
Differences between member variables and local variables
Kubernetes 理解kubectl/调试
Usage of qlist
挖财是正规的吗?股票开户安全吗?
NBD Network Block Device
JS functions
Biscuit distribution
Where is it safe to open an account for buying funds? Ask for guidance
Garbage collection mechanism
QQ love talk candy love talk content acquisition and storage
New good friend Pinia, leading the new era of state management
What is the difference between escape, encodeuri and encodeuricomponent?
Common formatting methods for amount numbers
Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat