1.添加识别耗时统计显示。
This commit is contained in:
parent
ec34bd50f6
commit
e588d4abdf
@ -41,11 +41,11 @@ Application::Application(int &argc, char **argv) : m_app(std::make_shared<QAppli
|
||||
qmlRegisterSingletonInstance("Analyser", 1, 0, "App", this);
|
||||
}
|
||||
|
||||
void Application::onNewVerifyResult(uint16_t userid, const QString &username) {
|
||||
QTimer::singleShot(0, this, [this, userid, username]() {
|
||||
void Application::onNewVerifyResult(uint16_t userid, const QString &username, uint16_t elapsed) {
|
||||
QTimer::singleShot(0, this, [this, userid, username, elapsed]() {
|
||||
emit newStatusTip(Info, QString("%1,识别耗时: %2ms")
|
||||
.arg(userid == ModuleCommunication::InvalidUserId ? "未录入用户" : username)
|
||||
.arg(m_verifyElapsed.count()));
|
||||
.arg(elapsed));
|
||||
});
|
||||
}
|
||||
|
||||
@ -296,9 +296,6 @@ void Application::onNewImageSliceData(const std::vector<uint8_t> &data) {
|
||||
|
||||
void Application::onCommandStarted(ModuleCommunication::MessageId messageId) {
|
||||
using namespace std::chrono;
|
||||
if (messageId == ModuleCommunication::Verify) {
|
||||
m_verifyStartTime = system_clock::now();
|
||||
}
|
||||
emit isVerifyingChanged();
|
||||
}
|
||||
|
||||
@ -306,14 +303,6 @@ void Application::onCommandFinished(ModuleCommunication::MessageId messageId,
|
||||
ModuleCommunication::MessageStatus status) {
|
||||
// LOG(info) << m_persistenceMode << " " << m_persistenceModeStarted << " " << m_persistenceVerifyInterval;
|
||||
using namespace std::chrono;
|
||||
if (messageId == ModuleCommunication::Verify) {
|
||||
m_verifyElapsed = duration_cast<milliseconds>(system_clock::now() - m_verifyStartTime);
|
||||
LOG(info) << "verify elapsed " << m_verifyElapsed;
|
||||
if (m_verifyElapsed > hours(10 * 1000)) {
|
||||
m_verifyElapsed = milliseconds(100);
|
||||
}
|
||||
}
|
||||
|
||||
if (messageId == ModuleCommunication::UploadImageInfo) {
|
||||
m_communication->uploadImageData(
|
||||
m_uploadImageSendedSize, (const uint8_t *)m_uploadBuffer.data() + m_uploadImageSendedSize, ImageSliceSize);
|
||||
|
@ -70,7 +70,7 @@ signals:
|
||||
|
||||
protected:
|
||||
Application(int &argc, char **argv);
|
||||
void onNewVerifyResult(uint16_t userid, const QString &username);
|
||||
void onNewVerifyResult(uint16_t userid, const QString &username, uint16_t elapsed);
|
||||
void onNewPalmFeature(const PalmFeature &feature);
|
||||
void onErrorOccurred(const QString &error);
|
||||
void onNewEnrolledImageInfo(uint32_t size, const uint8_t *md5);
|
||||
@ -88,8 +88,6 @@ private:
|
||||
bool m_persistenceModeStarted = false;
|
||||
int m_persistenceVerifyInterval = 1;
|
||||
QTimer *m_verifyTimer = nullptr;
|
||||
std::chrono::system_clock::time_point m_verifyStartTime;
|
||||
std::chrono::milliseconds m_verifyElapsed;
|
||||
|
||||
uint32_t m_enrolledImageSize = 0;
|
||||
QByteArray m_enrollYImageBuffer;
|
||||
|
@ -200,19 +200,25 @@ void ModuleCommunication::processPackage(const uint8_t *data, uint16_t size) {
|
||||
if (result == Success) {
|
||||
auto info = reinterpret_cast<const VerifyDataReply *>(data + 7);
|
||||
uint16_t userid = ntohs(info->userid);
|
||||
uint16_t elapsed = ntohs(info->elapsed);
|
||||
LOG_CAT(info, GUI) << "用户ID: " << userid
|
||||
<< ", 用户名: " << std::string_view(reinterpret_cast<const char *>(info->username));
|
||||
emit newVerifyResult(userid, reinterpret_cast<const char *>(info->username));
|
||||
<< ", 用户名: " << std::string_view(reinterpret_cast<const char *>(info->username))
|
||||
<< ", 耗时: " << elapsed << "ms";
|
||||
emit newVerifyResult(userid, reinterpret_cast<const char *>(info->username), elapsed);
|
||||
} else if (result == Failed4Timeout) {
|
||||
LOG_CAT(info, GUI) << "识别超时。";
|
||||
} else if (result == Rejected) {
|
||||
LOG_CAT(info, GUI) << "模组拒绝该命令。";
|
||||
} else if (result == Failed4UnknownUser) {
|
||||
LOG_CAT(info, GUI) << "未录入用户。";
|
||||
emit newVerifyResult(InvalidUserId, "");
|
||||
auto info = reinterpret_cast<const VerifyDataReply *>(data + 7);
|
||||
uint16_t elapsed = ntohs(info->elapsed);
|
||||
emit newVerifyResult(InvalidUserId, "", elapsed);
|
||||
LOG_CAT(info, GUI) << "未录入用户, 耗时: " << elapsed << "ms";
|
||||
} else if (result == Failed4UnknownReason) {
|
||||
LOG_CAT(info, GUI) << "未知错误。";
|
||||
emit newVerifyResult(InvalidUserId, "");
|
||||
auto info = reinterpret_cast<const VerifyDataReply *>(data + 7);
|
||||
uint16_t elapsed = ntohs(info->elapsed);
|
||||
emit newVerifyResult(InvalidUserId, "", elapsed);
|
||||
LOG_CAT(info, GUI) << "未知错误, 耗时: " << elapsed << "ms";
|
||||
} else {
|
||||
LOG_CAT(info, GUI) << "未知错误(" << static_cast<int>(result) << ")。";
|
||||
}
|
||||
@ -299,6 +305,11 @@ void ModuleCommunication::processPackage(const uint8_t *data, uint16_t size) {
|
||||
break;
|
||||
}
|
||||
case UploadImageData: {
|
||||
if (result == Success) {
|
||||
auto info = reinterpret_cast<const EnrollDataReply *>(data + 7);
|
||||
LOG_CAT(info, GUI) << "图片下发注册成功,用户ID: " << ntohs(info->userid);
|
||||
LOG_CAT(info, GUI) << Separator;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GetCurrentStatus: {
|
||||
|
@ -108,8 +108,9 @@ public:
|
||||
|
||||
struct VerifyDataReply {
|
||||
uint16_t userid;
|
||||
uint8_t username[UsernameSize]; // 32Bytes uint8_t admin;
|
||||
uint8_t unlockStatus;
|
||||
uint8_t username[UsernameSize]; // 32Bytes
|
||||
uint8_t admin;
|
||||
uint16_t elapsed; // 此时识别耗时时间
|
||||
};
|
||||
|
||||
struct PalmFeatureHeader {
|
||||
@ -160,7 +161,13 @@ public:
|
||||
MessageId currentMessageId() const;
|
||||
static std::string protocolDataFormatString(const uint8_t *data, int size);
|
||||
signals:
|
||||
void newVerifyResult(uint16_t userid, const QString &username);
|
||||
/**
|
||||
* @brief newVerifyResult
|
||||
* @param userid
|
||||
* @param username
|
||||
* @param elapsed ms毫秒
|
||||
*/
|
||||
void newVerifyResult(uint16_t userid, const QString &username, uint16_t elapsed);
|
||||
void newPalmFeature(const PalmFeature &feature);
|
||||
void newEnrolledImageInfo(uint32_t size, const uint8_t *md5);
|
||||
void newImageSliceData(const std::vector<uint8_t> &data);
|
||||
|
@ -57,9 +57,7 @@ HOST_TOOLS := /opt/Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/bin
|
||||
|
||||
```shell
|
||||
./rebuild-app.sh y L015 V200 R002 # 编译烧录固件
|
||||
./rebuild-app-ota.sh y L015 V200 R002 11 # 编译OTA固件,11为OTA版本号
|
||||
./rebuild-app-ota.sh y L015 V200 R002 12 # 编译OTA固件,11为OTA版本号
|
||||
600X800
|
||||
|
||||
./rebuild-app.sh n L021 V901 R001 # 测试新分支的CDC
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user