支持获取掌静脉以注册id.
Some checks failed
Windows CI / build (push) Failing after 10s
Build Applications / PullDocker (push) Failing after 16s
Build Applications / Build (push) Failing after 3s

This commit is contained in:
luocai 2024-10-12 17:06:50 +08:00
parent 9ec600a0c3
commit 34294c5c85
5 changed files with 51 additions and 4 deletions

View File

@ -283,6 +283,8 @@ void ModuleCommunication::processPackage(const uint8_t *data, uint16_t size) {
} else if (result == Failed4PalmEnrolled) {
emit errorOccurred(NoteId::InteractWarning, "手掌已被录入");
LOG_CAT(info, GUI) << "手掌已被录入。";
} else if (result == Failed4MaxUser) {
emit errorOccurred(NoteId::InteractWarning, "录入", "注册已达上限");
} else {
LOG_CAT(info, GUI) << "未知错误(" << static_cast<int>(result) << ")。";
}
@ -350,9 +352,24 @@ void ModuleCommunication::processPackage(const uint8_t *data, uint16_t size) {
break;
}
case GetUniqueID: {
LOG_CAT(info, GUI) << "模组: " << protocolDataFormatString(data, size);
auto id = reinterpret_cast<const ModuleId *>(data + 7);
LOG_CAT(info, GUI) << "模组ID: " << std::string_view(id->id, sizeof(id->id));
int idCount = 0;
std::ostringstream oss;
oss << "[";
for (int byteIndex = 0; byteIndex < sizeof(id->userids); byteIndex++) {
for (uint8_t bitPosition = 0; bitPosition < 8; bitPosition++) {
if (id->userids[byteIndex] & (1 << bitPosition)) {
uint16_t uid = byteIndex * 8 + bitPosition;
if (uid >= 1) {
oss << uid << ", ";
idCount++;
}
}
}
}
oss << "]";
LOG_CAT(info, GUI) << "模组ID: " << std::string_view(id->id, sizeof(id->id)) << ", user ids[" << idCount
<< "]: " << oss.str();
LOG_CAT(info, GUI) << Separator;
break;
}

View File

@ -21,6 +21,7 @@ class ModuleCommunication : public QObject {
public:
constexpr static uint16_t VendorIdentifier = 0x3346;
constexpr static uint16_t ProductIdentifier = 0x0001;
constexpr static uint16_t MaxUserCount = 4000;
constexpr static uint16_t InvalidUserId = std::numeric_limits<uint16_t>::max();
enum MessageId : uint8_t {
Reply = 0,
@ -187,6 +188,7 @@ public:
struct ModuleId {
char id[32];
uint8_t userids[512]; // bit位
};
#pragma pack()

View File

@ -93,7 +93,6 @@ Window {
info_bar.showError(tip,2000,detailMessage)
} else if (level === 2) {
info_bar.showInfo(tip,2000,detailMessage)
resultBrowser.append(tip+":"+detailMessage)
}
}
function onNewVideoFrame() {

View File

@ -64,7 +64,9 @@ HOST_TOOLS := /opt/Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1/bin
./rebuild-app-ota.sh y L015 V200 R002 05
600X800
docker run -it --rm --user 1000:1000 -v /opt:/opt -v $(pwd):$(pwd) -w $(pwd) registry.cn-shenzhen.aliyuncs.com/amass_toolset/yoctools:22.04 ./rebuild-app.sh y L015 V200 R002
docker run -it --rm --user 1000:1000 -v /opt:/opt -v $(pwd)/..:$(pwd)/.. -w $(pwd) registry.cn-shenzhen.aliyuncs.com/amass_toolset/yoctools:22.04 ./rebuild-app.sh y L015 V200 R002
docker run -it --rm --user 1000:1000 -v /opt:/opt -v $(pwd)/..:$(pwd)/.. -w $(pwd) registry.cn-shenzhen.aliyuncs.com/amass_toolset/yoctools:22.04 ./rebuild-app-ota.sh y L015 V200 R002 06
```

View File

@ -1,11 +1,23 @@
## 1 串口配置
目前模组支持两种通信接口UARTUSBCDC。其中
UART
- 波特率115200
- 数据位8
- 停止位1
- 奇偶检验:无
- 流控制:无
USBCDC
- 波特率2000000
- 数据位8
- 停止位1
- 奇偶检验:无
- 流控制:无
## 2 消息格式
主控和模块通讯的基本格式如下表所示,字节序为 **大端字节序Big Endian**
@ -35,6 +47,7 @@
| MID_ENROLL_SINGLE | 0x1D | 掌静脉录入(单帧) |
| MID_DELUSER | 0x20 | 删除一个已录入的掌静脉 |
| MID_DELALL | 0x21 | 删除所有已录入的掌静脉 |
| MID_MODULE_ID | 0xAC | 获取模组ID唯一标识 |
| MID_ENROLL_PALM_FEATUTE | 0xF9 | 主控下发掌静脉特征值给模组进行录入 |
| MID_GET_PALM_FEATUTE | 0xFA | 主控请求获取指定用户掌静脉特征值 |
@ -230,6 +243,20 @@ struct msg_deluser_data {
- 0x00MR_SUCCESS删除成功
- 0x05MR_FAILED4_UNKNOWNREASON未知错误
### 3.7 获取模组ID
该命令用于获取模组ID类型为长度为32的字符串。
该指令无需携带参数。
模组通过消息 MID_REPLY 返回的数据 msg_reply_module_id 定义如下:
```c++
struct msg_reply_module_id {
char id[32];
};
```
### 3.7 掌静脉特征值录入MID_ENROLL_PALM_FEATUTE
该命令用于直接将掌静脉特征值下发给模组进行录入。