| | |
| | | public static final int Unlock_Type_DI = 3; //DI
|
| | |
|
| | |
|
| | | public static int Reg_Count_Real = 8; //寄存器数量
|
| | | // public static int Reg_Count_Real = 8; //寄存器数量
|
| | | public static int Reg_Count_Real = 11; //寄存器数量
|
| | |
|
| | | private Date record_time; //'更新时间',
|
| | | private String gprs_sn; //'gprs模块SN码',
|
| | |
| | | private boolean isIDOpen = false; //是否是ID开锁
|
| | | private int last_unlock_type; //'上一次开锁方式[0-485开锁 1-刷卡开锁 2-蓝牙开锁 3-DI开锁]',
|
| | | private int last_unlock_id; //'上一次刷开开锁卡号[仅刷开开锁时有效]',
|
| | | |
| | | private int[] mac_addr = new int[6]; //锁具蓝牙MAC地址
|
| | |
|
| | | private String ctl_uname = ""; //操作用户名
|
| | |
|
| | |
| | | this.unlock_id = (buffer.getInt()&0xFFFFFFFF); //'上一次刷开开锁卡号[仅刷开开锁时有效]',
|
| | | this.lock_addr = ComBase.changeShortToInt(buffer.getShort()); //'设备地址',
|
| | |
|
| | | for(int k =0;k<mac_addr.length;k++) {
|
| | | mac_addr[k] = ComBase.changeByteToInt(buffer.get());
|
| | | }
|
| | | |
| | | // System.out.println("BlutoothMAC:" + getLockMacAddr());
|
| | | |
| | | //System.out.println("this.lock_state:"+tmp_lock_state+"********lock_state:"+lock_state);
|
| | | if(this.lock_state != tmp_lock_state && this.lock_state == 1) {
|
| | | //锁具状态变化;锁从关闭变为打开
|
| | |
| | |
|
| | | buffer.compact();
|
| | | return true;
|
| | | }
|
| | | |
| | | public String getLockMacAddr() {
|
| | | return String.format("%02x:%02x:%02x:%02x:%02x:%02x", mac_addr[0],mac_addr[1],mac_addr[2],mac_addr[3],mac_addr[4],mac_addr[5]).toUpperCase();
|
| | | }
|
| | |
|
| | | public int getLockDevId() {
|
| | |
| | | + ", lock_addr_set=" + lock_addr_set + "]";
|
| | | }
|
| | |
|
| | | |
| | | public static void main(String[] args) {
|
| | | int[] ss = new int[] {1,58,65,21,54,23};
|
| | | System.out.println(String.format("%02x:%02x:%02x:%02x:%02x:%02x", ss[0],ss[1],ss[2],ss[3],ss[4],ss[5]).toUpperCase());
|
| | | }
|
| | | }
|