Appearance
遥控器管理
蓝牙遥控器凭证,通过配对的遥控器按键开锁。
指令列表
| 指令码 | 名称 | 方向 | 说明 |
|---|---|---|---|
0x0A00 | ListRemotes | APP → 设备 | 获取遥控器列表 |
0x0A01 | GetRemote | APP → 设备 | 获取遥控器详情 |
0x0A02 | AddRemote | APP → 设备 | 添加遥控器(进入配对模式) |
0x0A03 | UpdateRemote | APP → 设备 | 更新遥控器信息 |
0x0A04 | DeleteRemote | APP → 设备 | 删除遥控器 |
0x0A05 | ClearRemotes | APP → 设备 | 清空所有遥控器 |
数据结构
protobuf
message Remote {
uint32 credential_id = 1; // 凭证ID(锁内唯一)
uint32 user_id = 2; // 归属用户ID
bytes remote_id = 3; // 遥控器硬件ID
uint32 created_by = 4; // 创建者用户ID
uint64 created_at = 5; // 创建时间(UNIX毫秒时间戳)
ValidityPeriod validity = 6; // 有效期
uint32 use_count_limit = 7; // 使用次数限制(0=不限)
uint32 use_count = 8; // 已使用次数
string label = 9; // 标签
bool is_duress = 10; // 是否胁迫凭证
}| 字段 | 类型 | 说明 |
|---|---|---|
credential_id | uint32 | 凭证ID,锁内唯一标识 |
user_id | uint32 | 归属用户ID |
remote_id | bytes | 遥控器硬件唯一标识 |
created_by | uint32 | 创建者用户ID |
created_at | uint64 | 创建时间(UNIX毫秒时间戳) |
validity | ValidityPeriod | 有效期,详见 凭证期限 |
use_count_limit | uint32 | 使用次数限制,0 表示不限制 |
use_count | uint32 | 已使用次数 |
label | string | 用户自定义标签 |
is_duress | bool | 是否胁迫凭证 |
遥控器按键
遥控器通常有开锁和上锁两个按键。将遥控器设为胁迫凭证后,任意按键操作都会触发胁迫报警。
添加流程
添加遥控器需要在门锁端进行蓝牙配对:
ListRemotes - 获取遥控器列表
指令码: 0x0A00
ListRemotesReq
protobuf
message ListRemotesReq {
optional uint32 user_id = 1; // 按用户ID筛选(不指定则返回所有)
}ListRemotesResp
protobuf
message ListRemotesResp {
uint32 code = 1;
string message = 2;
repeated Remote remotes = 3; // 遥控器列表
}GetRemote - 获取遥控器详情
指令码: 0x0A01
GetRemoteReq
protobuf
message GetRemoteReq {
uint32 credential_id = 1; // 凭证ID
}GetRemoteResp
protobuf
message GetRemoteResp {
uint32 code = 1;
string message = 2;
Remote remote = 3; // 遥控器详情
}AddRemote - 添加遥控器
指令码: 0x0A02
调用此指令后,门锁进入遥控器配对模式。
AddRemoteReq
protobuf
message AddRemoteReq {
optional uint32 user_id = 1; // 归属用户ID(不指定则自动创建用户)
optional ValidityPeriod validity = 2; // 有效期
optional uint32 use_count_limit = 3; // 使用次数限制
optional string label = 4; // 标签
optional bool is_duress = 5; // 是否胁迫凭证
optional uint32 timeout = 6; // 等待超时(秒),默认60
}| 字段 | 必填 | 说明 |
|---|---|---|
user_id | 否 | 不指定时自动创建新用户 |
validity | 否 | 不指定时永久有效 |
use_count_limit | 否 | 默认 0(不限制) |
label | 否 | 默认空字符串 |
is_duress | 否 | 默认 false |
timeout | 否 | 默认 60 秒 |
AddRemoteResp
protobuf
message AddRemoteResp {
uint32 code = 1; // 0=已进入配对模式
string message = 2;
}RemoteAddedNotify
配对完成后,设备主动推送结果:
protobuf
message RemoteAddedNotify {
uint32 code = 1; // 0=成功
string message = 2;
uint32 credential_id = 3; // 新建的凭证ID
uint32 user_id = 4; // 归属用户ID
bytes remote_id = 5; // 遥控器硬件ID
}UpdateRemote - 更新遥控器信息
指令码: 0x0A03
UpdateRemoteReq
protobuf
message UpdateRemoteReq {
uint32 credential_id = 1; // 凭证ID(必填)
optional ValidityPeriod validity = 2; // 有效期
optional uint32 use_count_limit = 3; // 使用次数限制
optional string label = 4; // 标签
optional bool is_duress = 5; // 是否胁迫凭证
}UpdateRemoteResp
protobuf
message UpdateRemoteResp {
uint32 code = 1;
string message = 2;
}DeleteRemote - 删除遥控器
指令码: 0x0A04
DeleteRemoteReq
protobuf
message DeleteRemoteReq {
uint32 credential_id = 1; // 凭证ID
}DeleteRemoteResp
protobuf
message DeleteRemoteResp {
uint32 code = 1;
string message = 2;
}ClearRemotes - 清空所有遥控器
指令码: 0x0A05
危险操作
此操作将删除门锁上所有遥控器凭证,不可恢复。
ClearRemotesReq
protobuf
message ClearRemotesReq {
// 无参数
}ClearRemotesResp
protobuf
message ClearRemotesResp {
uint32 code = 1;
string message = 2;
uint32 count = 3; // 删除的数量
}