Commit 01c48d90 by NitefullWind

1. 修改默认账号读取。

parent c970d0e8
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <QDebug> #include <QDebug>
#include <iostream> #include <iostream>
#define OldSector 2 #define OldSector 4
bool ConnectDevice(int port, int baud, int sector, const QString password, HANDLE &handle, QString &error) bool ConnectDevice(int port, int baud, int sector, const QString password, HANDLE &handle, QString &error)
{ {
...@@ -81,6 +81,7 @@ bool ReadCard(const HANDLE handle, int sector, QString &vipNo, QString& uuid, QS ...@@ -81,6 +81,7 @@ bool ReadCard(const HANDLE handle, int sector, QString &vipNo, QString& uuid, QS
// error = "check key_data error"; // error = "check key_data error";
// return false; // return false;
// } // }
rf_halt(handle);
rf_beep(handle,30); rf_beep(handle,30);
return true; return true;
} }
...@@ -111,16 +112,15 @@ bool ActivateCard(const HANDLE handle, int sector, const QString newPassword, QS ...@@ -111,16 +112,15 @@ bool ActivateCard(const HANDLE handle, int sector, const QString newPassword, QS
return false; return false;
} }
// 读卡 // 读卡
unsigned char rdata[17]; char rdata[32];
ZeroMemory(rdata,17); ZeroMemory(rdata,32);
st = rf_read(handle, OldSector*4, rdata); st = rf_read_hex(handle, OldSector*4, rdata);
if(st!=0) if(st!=0)
{ {
error = "read default card no error"; error = "read default card no error";
return false; return false;
} }
vipNo = QByteArray((char*)rdata); vipNo = QByteArray(rdata).mid(16);
// 将卡号写入传入的扇区 // 将卡号写入传入的扇区
// 鉴权 // 鉴权
st = rf_authentication(handle, 0, sector); st = rf_authentication(handle, 0, sector);
...@@ -176,6 +176,7 @@ bool ActivateCard(const HANDLE handle, int sector, const QString newPassword, QS ...@@ -176,6 +176,7 @@ bool ActivateCard(const HANDLE handle, int sector, const QString newPassword, QS
// } // }
rf_halt(handle);
rf_beep(handle,30); rf_beep(handle,30);
return true; return true;
} }
...@@ -212,6 +213,7 @@ bool WriteCard(const HANDLE handle, int sector, QString data, QString &error) ...@@ -212,6 +213,7 @@ bool WriteCard(const HANDLE handle, int sector, QString data, QString &error)
return false; return false;
} }
rf_halt(handle);
rf_beep(handle,30); rf_beep(handle,30);
return true; return true;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <QDebug> #include <QDebug>
#include <QCryptographicHash> #include <QCryptographicHash>
#define ReadS 2 #define ReadS 4
#if 1 #if 1
#define ReadP "ffffffffffff" #define ReadP "ffffffffffff"
#else #else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment