From 5c2440c32c755e965653403dd5967de1ff8e1f95 Mon Sep 17 00:00:00 2001 From: luocai Date: Tue, 23 Jul 2024 20:03:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=B0=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Analyser/CMakeLists.txt | 2 +- Analyser/ModuleCommunication.cpp | 59 -------------------------------- Analyser/ModuleCommunication.h | 16 --------- Analyser/Widget.cpp | 2 -- Readme.md | 15 +++++++- 5 files changed, 15 insertions(+), 79 deletions(-) diff --git a/Analyser/CMakeLists.txt b/Analyser/CMakeLists.txt index 2ca7922..c6208c0 100644 --- a/Analyser/CMakeLists.txt +++ b/Analyser/CMakeLists.txt @@ -1,4 +1,4 @@ -project(Analyser VERSION 0.2 LANGUAGES C CXX) +project(Analyser VERSION 0.3 LANGUAGES C CXX) set(APPLICATION_NAME "掌静脉测试工具") set(CMAKE_AUTOMOC ON) diff --git a/Analyser/ModuleCommunication.cpp b/Analyser/ModuleCommunication.cpp index 16af56c..98ad125 100644 --- a/Analyser/ModuleCommunication.cpp +++ b/Analyser/ModuleCommunication.cpp @@ -110,42 +110,6 @@ void ModuleCommunication::requestEnrolledImage(uint32_t offset, uint32_t size) { // LOG_CAT(info, GUI) << Separator; } -void ModuleCommunication::requestPalmFeature(uint16_t userid) { - uint16_t n = htons(userid); - auto [frameData, frameSize] = generateFrame(RequestPalmFeature, reinterpret_cast(&n), sizeof(n)); - m_serialPort->write(reinterpret_cast(frameData), frameSize); - LOG_CAT(info, GUI) << "发送获取掌静脉特征值指令: " << protocolDataFormatString(frameData, frameSize); - LOG_CAT(info, GUI) << "获取特征值用户ID: " << userid; - LOG_CAT(info, GUI) << Separator; -} - -void ModuleCommunication::enrollPalmFeature(uint16_t userid, const PalmFeature &feature) { - auto buffer = new uint8_t[sizeof(PalmFeatureHeader) + feature.feature.size()]; - auto header = reinterpret_cast(buffer); - header->userid = htons(userid); - header->featureTotalSize = htons(static_cast(feature.feature.size())); - strncpy(reinterpret_cast(header->username), feature.username.c_str(), sizeof(header->username)); - - mbedtls_md5_context context; - mbedtls_md5_init(&context); - mbedtls_md5_starts(&context); - uint8_t md5[16]; - mbedtls_md5_update(&context, feature.feature.data(), feature.feature.size()); - mbedtls_md5_finish(&context, md5); - mbedtls_md5_free(&context); - memcpy(header->featureDataMd5, md5, sizeof(header->featureDataMd5)); - - memcpy(buffer + sizeof(PalmFeatureHeader), feature.feature.data(), feature.feature.size()); - - auto [frameData, frameSize] = generateFrame( - RegisterPalmFeature, buffer, static_cast(sizeof(PalmFeatureHeader) + feature.feature.size())); - m_serialPort->write(reinterpret_cast(frameData), frameSize); - LOG_CAT(info, GUI) << "发送注册掌静脉特征指令: " << protocolDataFormatString(frameData, frameSize); - LOG_CAT(info, GUI) << Separator; - - if (buffer != nullptr) delete[] buffer; -} - void ModuleCommunication::uploadImageInfo(const UploadImageInformation &info) { UploadImageInformation request; request.operation = info.operation; @@ -288,29 +252,6 @@ void ModuleCommunication::processPackage(const uint8_t *data, uint16_t size) { } break; } - case RequestPalmFeature: { - LOG_CAT(info, GUI) << "模组: " << protocolDataFormatString(data, size); - if (result == Success) { - auto info = reinterpret_cast(data + 7); - LOG_CAT(info, GUI) << "用户ID: " << ntohs(info->userid) - << ", 用户名: " << std::string_view(reinterpret_cast(info->username)) - << ", 特征值长度: " << ntohs(info->featureTotalSize); - PalmFeature feature; - feature.username = std::string_view(reinterpret_cast(info->username)); - feature.feature = std::vector(info->feature, info->feature + ntohs(info->featureTotalSize)); - emit newPalmFeature(feature); - } - LOG_CAT(info, GUI) << Separator; - break; - } - case RegisterPalmFeature: { - LOG_CAT(info, GUI) << "模组: " << protocolDataFormatString(data, size); - if (result == Success) { - LOG_CAT(info, GUI) << "掌静脉特征值注册成功。"; - } - LOG_CAT(info, GUI) << Separator; - break; - } case UploadImageInfo: { break; } diff --git a/Analyser/ModuleCommunication.h b/Analyser/ModuleCommunication.h index b750105..dc90e08 100644 --- a/Analyser/ModuleCommunication.h +++ b/Analyser/ModuleCommunication.h @@ -30,8 +30,6 @@ public: GetUniqueID = 0xAC, UploadImageInfo = 0xF6, UploadImageData = 0xF7, - RegisterPalmFeature = 0xF9, - RequestPalmFeature = 0xFA, Idle = 0xFF, }; Q_ENUM(MessageId) @@ -80,7 +78,6 @@ public: }; struct EnrollData { - uint8_t admin = 0; uint8_t username[32]; uint8_t skipSave = 0; uint8_t timeout; @@ -112,19 +109,9 @@ public: struct VerifyDataReply { uint16_t userid; uint8_t username[UsernameSize]; // 32Bytes - uint8_t admin; uint16_t elapsed; // 此时识别耗时时间 }; - struct PalmFeatureHeader { - uint16_t userid; // 用户ID - uint8_t username[32]; // 用户姓名 - uint8_t admin; // 是否管理员,YES:1 NO:0 - uint8_t featureDataMd5[16]; // 整体特征数据的MD5值 - uint16_t featureTotalSize; // 特征数据总长度 - uint8_t feature[0]; - }; - struct UploadImageInformation { uint8_t operation; // 0:图片录入掌静脉 uint8_t format; // 0: 灰度图(纯Y分量) @@ -159,9 +146,6 @@ public: Q_INVOKABLE void requestUniqueId(); void requestEnrolledImage(uint32_t offset, uint32_t size); - void requestPalmFeature(uint16_t userid); - void enrollPalmFeature(uint16_t userid, const PalmFeature &feature); - void uploadImageInfo(const UploadImageInformation &info); void uploadImageData(uint32_t offset, const uint8_t *data, uint32_t size); Q_INVOKABLE void requestCurrentStatus(); diff --git a/Analyser/Widget.cpp b/Analyser/Widget.cpp index 66a8c72..93e9c91 100644 --- a/Analyser/Widget.cpp +++ b/Analyser/Widget.cpp @@ -264,7 +264,6 @@ void Widget::onRequestPalmFeatureButtonClicked() { auto module = Amass::Singleton::instance()->module(); if (!module) return; auto id = m_palmFeatureEdit->text().toInt(); - module->requestPalmFeature(id); } void Widget::onRegisterPalmFeatureButtonClicked() { @@ -275,7 +274,6 @@ void Widget::onRegisterPalmFeatureButtonClicked() { // LOG(error) << "feature is empty."; // return; // } - // module->enrollPalmFeature(264, features.at(0)); } void Widget::onResetButtonClicked() { diff --git a/Readme.md b/Readme.md index c51d806..367ed10 100644 --- a/Readme.md +++ b/Readme.md @@ -57,7 +57,20 @@ 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 13 # 编译OTA固件,11为OTA版本号 +./rebuild-app-ota.sh y L015 V200 R002 14 # 编译OTA固件,11为OTA版本号 600X800 ``` + + + + +# Flash设置 + +``` +__FLASH_16MB__ +cv181x_alios/boards/cv181xc_qfn/configs/config.yaml +cv181x_alios/boards/cv181xc_qfn/configs/partition_alios_spinor.xml +cv181x_alios/solutions/smart_doorbell/face_lock_app/flash-part.h +``` +