广播方式升级从机成功
This commit is contained in:
@@ -188,6 +188,7 @@ void can_host::recv_data_cb()
|
||||
{
|
||||
irq_fun(myarray(slave.get_data()));
|
||||
}
|
||||
emit recv_data_signal(slave_addr,slave.get_data());
|
||||
}
|
||||
qDebug()<<"can recv from:"<<slave_addr<<slave.get_data().toHex(' ');
|
||||
}
|
||||
@@ -213,6 +214,7 @@ void can_host::recv_data_cb()
|
||||
{
|
||||
irq_fun(myarray(slave.get_data()));
|
||||
}
|
||||
emit recv_data_signal(slave_addr,slave.get_data());
|
||||
}
|
||||
qDebug()<<"can recv from:"<<slave_addr<<slave.get_data().toHex(' ');
|
||||
}
|
||||
@@ -229,23 +231,20 @@ void can_host::recv_data_cb()
|
||||
|
||||
int can_host::write(int dst,myarray data)
|
||||
{
|
||||
qDebug()<<"can send to:"<<dst<<data.toHex(' ');
|
||||
// qDebug()<<"can send to:"<<dst<<data.toHex(' ');
|
||||
append(dst, 1, data);
|
||||
// qDebug("can send end.");
|
||||
return data.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void can_host::send_data_cb(uint8_t dst, int fun_class, QByteArray data)
|
||||
{
|
||||
append(dst, fun_class, data);
|
||||
}
|
||||
|
||||
// 群发消息
|
||||
void can_host::send_data_mul_cb(QList<uint8_t> dst, int fun_class, QByteArray data)
|
||||
void can_host::send_data_mul_slot(QList<int> addrs, QByteArray data)
|
||||
{
|
||||
for (int i = 0; i < dst.size(); i++)
|
||||
append(dst[i], fun_class, data);
|
||||
for (int i = 0; i < addrs.size(); i++)
|
||||
append(addrs[i], 1, data);
|
||||
}
|
||||
|
||||
void can_host::append(uint8_t addr, uint8_t fun_class, QByteArray data)
|
||||
@@ -290,6 +289,7 @@ void can_host::append(uint8_t addr, uint8_t fun_class, QByteArray data)
|
||||
QCanBusFrame frame = QCanBusFrame(frameId.Exide, data.left(8));
|
||||
while (can_->writeFrame(frame) != true)
|
||||
{
|
||||
// qDebug("wait for written.");
|
||||
can_->waitForFramesWritten(1000);
|
||||
}
|
||||
data.remove(0, 8);
|
||||
|
@@ -54,9 +54,9 @@ private:
|
||||
void append(uint8_t addr, uint8_t fun_class, QByteArray data);
|
||||
public slots:
|
||||
// 用户把发送数据信号连接到这个槽
|
||||
void send_data_cb(uint8_t dst, int fun_class, QByteArray data);
|
||||
void send_data_mul_cb(QList<uint8_t> dst, int fun_class, QByteArray data);
|
||||
|
||||
void send_data_mul_slot(QList<int> addrs, QByteArray data);
|
||||
signals:
|
||||
void recv_data_signal(int src,QByteArray data);
|
||||
private slots:
|
||||
void freams_sent_cb(qint64 count);
|
||||
void recv_data_cb();
|
||||
|
Reference in New Issue
Block a user