1.实现图片上报及下发注册的对接实现。
This commit is contained in:
@ -74,11 +74,13 @@ bool CdcUpdater::write(Command command, const uint8_t *data, uint32_t size) {
|
||||
if (data != nullptr) {
|
||||
memcpy(&packet[3], data, size);
|
||||
}
|
||||
std::ostringstream oss;
|
||||
for (int i = 0; i < packet.size(); i++) {
|
||||
oss << "0x" << std::hex << (static_cast<int>(packet[i]) & 0xff) << " ";
|
||||
if (command != TransferBin) {
|
||||
std::ostringstream oss;
|
||||
for (int i = 0; i < packet.size(); i++) {
|
||||
oss << "0x" << std::hex << (static_cast<int>(packet[i]) & 0xff) << " ";
|
||||
}
|
||||
LOG(info) << "write " << oss.str();
|
||||
}
|
||||
LOG(info) << "write " << oss.str();
|
||||
return m_serialPort->write(reinterpret_cast<const char *>(packet.data()), packet.size());
|
||||
}
|
||||
|
||||
@ -121,14 +123,14 @@ void CdcUpdater::transferBin() {
|
||||
|
||||
void CdcUpdater::onReadyRead() {
|
||||
auto data = m_serialPort->readAll();
|
||||
|
||||
std::ostringstream oss;
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
oss << "0x" << std::hex << (static_cast<int>(data[i]) & 0xff) << " ";
|
||||
}
|
||||
LOG(info) << "onReadyRead, size: " << data.size() << ", " << oss.str();
|
||||
|
||||
uint8_t command = static_cast<uint8_t>(data[2]);
|
||||
if (command != TransferBinReply) {
|
||||
std::ostringstream oss;
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
oss << "0x" << std::hex << (static_cast<int>(data[i]) & 0xff) << " ";
|
||||
}
|
||||
LOG(info) << "onReadyRead, size: " << data.size() << ", " << oss.str();
|
||||
}
|
||||
if (command == EnterUpgradeReply) {
|
||||
write(GetVersion);
|
||||
emit progressChanged(++m_progress);
|
||||
|
Reference in New Issue
Block a user