实现获取版本号显示。
This commit is contained in:
parent
a2a79ac084
commit
bdc7711bbb
@ -125,6 +125,9 @@ bool Application::open(const QString &portName, int baudRate) {
|
|||||||
|
|
||||||
auto status = m_communication->open(portName, baudRate);
|
auto status = m_communication->open(portName, baudRate);
|
||||||
emit newStatusTip(status ? Tip : Error, status ? "串口打开成功" : "串口打开失败");
|
emit newStatusTip(status ? Tip : Error, status ? "串口打开成功" : "串口打开失败");
|
||||||
|
if (status) {
|
||||||
|
QTimer::singleShot(0, this, [this]() { m_communication->requestVersion(); });
|
||||||
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +171,13 @@ void ModuleCommunication::requestUniqueId() {
|
|||||||
LOG_CAT(info, GUI) << Separator;
|
LOG_CAT(info, GUI) << Separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModuleCommunication::requestVersion() {
|
||||||
|
auto [frameData, frameSize] = generateFrame(GetVersion);
|
||||||
|
m_serialPort->write(reinterpret_cast<const char *>(frameData), frameSize);
|
||||||
|
LOG_CAT(info, GUI) << "发送获取版本指令: " << protocolDataFormatString(frameData, frameSize);
|
||||||
|
LOG_CAT(info, GUI) << Separator;
|
||||||
|
}
|
||||||
|
|
||||||
ModuleCommunication::MessageId ModuleCommunication::currentMessageId() const {
|
ModuleCommunication::MessageId ModuleCommunication::currentMessageId() const {
|
||||||
return m_currentMessageId;
|
return m_currentMessageId;
|
||||||
}
|
}
|
||||||
@ -312,6 +319,22 @@ void ModuleCommunication::processPackage(const uint8_t *data, uint16_t size) {
|
|||||||
LOG_CAT(info, GUI) << Separator;
|
LOG_CAT(info, GUI) << Separator;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GetVersion: {
|
||||||
|
LOG_CAT(info, GUI) << "模组: " << protocolDataFormatString(data, size);
|
||||||
|
auto version = reinterpret_cast<const ModuleVersion *>(data + 7);
|
||||||
|
int length = std::strlen(version->version);
|
||||||
|
if (length > sizeof(version->version)) {
|
||||||
|
length = sizeof(version->version);
|
||||||
|
}
|
||||||
|
int ota = ntohl(version->otaVersion);
|
||||||
|
LOG_CAT(info, GUI) << "模组烧录版本: " << std::string_view(version->version, length)
|
||||||
|
<< ", OTA版本: " << ntohl(version->otaVersion);
|
||||||
|
LOG_CAT(info, GUI) << Separator;
|
||||||
|
m_verison = QString::fromLocal8Bit(version->version, length);
|
||||||
|
m_otaVerison = ota;
|
||||||
|
emit verisonChanged();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case EnableDebug: {
|
case EnableDebug: {
|
||||||
LOG(info) << "set moudle debug mode: " << (result == Success);
|
LOG(info) << "set moudle debug mode: " << (result == Success);
|
||||||
break;
|
break;
|
||||||
|
@ -11,8 +11,11 @@ class ModuleCommunication : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
static constexpr uint32_t UsernameSize = 32;
|
static constexpr uint32_t UsernameSize = 32;
|
||||||
|
static constexpr uint32_t VersionSize = 32;
|
||||||
static constexpr const char *Separator = "----------";
|
static constexpr const char *Separator = "----------";
|
||||||
Q_PROPERTY(MessageId currentMessageId READ currentMessageId NOTIFY currentMessageIdChanged)
|
Q_PROPERTY(MessageId currentMessageId READ currentMessageId NOTIFY currentMessageIdChanged)
|
||||||
|
Q_PROPERTY(QString verison MEMBER m_verison NOTIFY verisonChanged)
|
||||||
|
Q_PROPERTY(int otaVerison MEMBER m_otaVerison NOTIFY verisonChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr static uint16_t InvalidUserId = std::numeric_limits<uint16_t>::max();
|
constexpr static uint16_t InvalidUserId = std::numeric_limits<uint16_t>::max();
|
||||||
@ -28,6 +31,7 @@ public:
|
|||||||
GetImage = 0x1F, // 获取图片数据,通过VerifyExtended或EnrollExtended保存的
|
GetImage = 0x1F, // 获取图片数据,通过VerifyExtended或EnrollExtended保存的
|
||||||
DeleteUser = 0x20,
|
DeleteUser = 0x20,
|
||||||
DeleteAll = 0x21,
|
DeleteAll = 0x21,
|
||||||
|
GetVersion = 0x30,
|
||||||
StartOta = 0x40, // 模组进入boot模式进行ota升级
|
StartOta = 0x40, // 模组进入boot模式进行ota升级
|
||||||
EnableDebug = 0x82,
|
EnableDebug = 0x82,
|
||||||
GetUniqueID = 0xAC,
|
GetUniqueID = 0xAC,
|
||||||
@ -142,6 +146,11 @@ public:
|
|||||||
uint8_t data[0];
|
uint8_t data[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ModuleVersion {
|
||||||
|
char version[VersionSize];
|
||||||
|
uint32_t otaVersion;
|
||||||
|
};
|
||||||
|
|
||||||
struct ModuleId {
|
struct ModuleId {
|
||||||
char id[32];
|
char id[32];
|
||||||
};
|
};
|
||||||
@ -158,6 +167,7 @@ public:
|
|||||||
Q_INVOKABLE void deleteUser(uint16_t userid);
|
Q_INVOKABLE void deleteUser(uint16_t userid);
|
||||||
Q_INVOKABLE void deleteAll();
|
Q_INVOKABLE void deleteAll();
|
||||||
Q_INVOKABLE void requestUniqueId();
|
Q_INVOKABLE void requestUniqueId();
|
||||||
|
Q_INVOKABLE void requestVersion();
|
||||||
void requestEnrolledImage(uint32_t offset, uint32_t size);
|
void requestEnrolledImage(uint32_t offset, uint32_t size);
|
||||||
|
|
||||||
void uploadImageInfo(const UploadImageInformation &info);
|
void uploadImageInfo(const UploadImageInformation &info);
|
||||||
@ -184,6 +194,7 @@ signals:
|
|||||||
void commandStarted(ModuleCommunication::MessageId messageId);
|
void commandStarted(ModuleCommunication::MessageId messageId);
|
||||||
void commandFinished(MessageId messageId, MessageStatus status);
|
void commandFinished(MessageId messageId, MessageStatus status);
|
||||||
void currentMessageIdChanged();
|
void currentMessageIdChanged();
|
||||||
|
void verisonChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void processPackage(const uint8_t *data, uint16_t size);
|
void processPackage(const uint8_t *data, uint16_t size);
|
||||||
@ -195,8 +206,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
std::shared_ptr<QSerialPort> m_serialPort;
|
std::shared_ptr<QSerialPort> m_serialPort;
|
||||||
QByteArray m_receivedBuffer;
|
QByteArray m_receivedBuffer;
|
||||||
|
|
||||||
MessageId m_currentMessageId = ModuleCommunication::Idle;
|
MessageId m_currentMessageId = ModuleCommunication::Idle;
|
||||||
|
QString m_verison;
|
||||||
|
int m_otaVerison;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODULECOMMUNICATION_H
|
#endif // MODULECOMMUNICATION_H
|
||||||
|
@ -10,6 +10,16 @@ Item {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
ConnectionItem {}
|
ConnectionItem {}
|
||||||
|
Column {
|
||||||
|
Text{
|
||||||
|
width: 50
|
||||||
|
text: "烧录版本: "+ (App.module!==null? App.module.verison:"")
|
||||||
|
}
|
||||||
|
Text{
|
||||||
|
width: 50
|
||||||
|
text: "OTA版本: "+(App.module!==null?App.module.otaVerison:"")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GroupBox {
|
GroupBox {
|
||||||
id: commandBox
|
id: commandBox
|
||||||
|
@ -5,7 +5,7 @@ import Analyser
|
|||||||
|
|
||||||
Window {
|
Window {
|
||||||
width: 1120
|
width: 1120
|
||||||
height: 700
|
height: 770
|
||||||
visible: true
|
visible: true
|
||||||
title: qsTr(Qt.application.name + " " + Qt.application.version)
|
title: qsTr(Qt.application.name + " " + Qt.application.version)
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
set(Projects_ROOT E:/Projects)
|
set(Projects_ROOT E:/Projects)
|
||||||
set(Libraries_ROOT ${Projects_ROOT}/Libraries)
|
set(Libraries_ROOT ${Projects_ROOT}/Libraries)
|
||||||
|
|
||||||
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_85_0_msvc2022_64bit)
|
set(BOOST_ROOT ${Libraries_ROOT}/boost_1_86_0_msvc2022_64bit)
|
||||||
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_85)
|
set(Boost_INCLUDE_DIR ${BOOST_ROOT}/include/boost-1_86)
|
||||||
option(Boost_USE_STATIC_LIBS OFF)
|
option(Boost_USE_STATIC_LIBS OFF)
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10
|
BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10
|
||||||
|
@ -58,7 +58,10 @@ HOST_TOOLS := /opt/Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/bin
|
|||||||
```shell
|
```shell
|
||||||
./boot-rebuild.sh # 编译boot
|
./boot-rebuild.sh # 编译boot
|
||||||
./rebuild-app.sh y L015 V200 R002 # 编译烧录固件
|
./rebuild-app.sh y L015 V200 R002 # 编译烧录固件
|
||||||
./rebuild-app-ota.sh y L015 V200 R002 14 # 编译OTA固件,11为OTA版本号
|
|
||||||
|
# 编译OTA固件,11为OTA版本号,这个版本号只做固件文件名显示。
|
||||||
|
# 实际的版本设置在 cv181x_alios/solutions/smart_doorbell/package.yaml.L015_V200R002
|
||||||
|
./rebuild-app-ota.sh y L015 V200 R002 01
|
||||||
600X800
|
600X800
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user