summaryrefslogtreecommitdiffstats
path: root/r503.c
diff options
context:
space:
mode:
Diffstat (limited to 'r503.c')
-rw-r--r--r503.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/r503.c b/r503.c
index f78b0ac..4a7b90f 100644
--- a/r503.c
+++ b/r503.c
@@ -228,13 +228,18 @@ uint8_t fpm_get_cfg(struct fpm_cfg *cfg)
return 0;
}
-uint8_t fpm_clear_db(void)
+uint8_t fpm_set_pwd(uint32_t pwd)
{
uint16_t n;
uint8_t buf[MAXPDLEN];
- buf[0] = 0x0D;
- send(0x01, buf, 1);
+ buf[0] = 0x12;
+ buf[1] = (uint8_t)(pwd >> 24);
+ buf[2] = (uint8_t)(pwd >> 16);
+ buf[3] = (uint8_t)(pwd >> 8);
+ buf[4] = (uint8_t)(pwd & 0xFF);
+
+ send(0x01, buf, 5);
recv(buf, &n);
return buf[0] == OK;
}
@@ -291,3 +296,41 @@ uint8_t fpm_enroll(uint16_t id)
return buf[0] == OK;
}
+
+uint8_t fpm_match(void)
+{
+ struct fpm_cfg cfg;
+ uint16_t n;
+ uint8_t buf[MAXPDLEN];
+
+ if (!fpm_get_cfg(&cfg))
+ return 0;
+
+ if (!scan())
+ return 0;
+
+ if (!img2tz(1))
+ return 0;
+
+ buf[0] = 0x04;
+ buf[1] = 1;
+ buf[2] = 0x00;
+ buf[3] = 0x00;
+ buf[4] = (uint8_t)(cfg.cap >> 8);
+ buf[5] = (uint8_t)(cfg.cap & 0xFF);
+
+ send(0x01, buf, 6);
+ recv(buf, &n);
+ return buf[0] == OK;
+}
+
+uint8_t fpm_clear_db(void)
+{
+ uint16_t n;
+ uint8_t buf[MAXPDLEN];
+
+ buf[0] = 0x0D;
+ send(0x01, buf, 1);
+ recv(buf, &n);
+ return buf[0] == OK;
+}