Skip to content

2324059/ble_2541_lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

2E指令   (29个字节)
{"0":239,"1":1,"2":19,"3":196,"4":74,"5":25,"6":104,"7":2,"8":1,"9":19,"10":46,"11":0,"12":10,"13":19,"14":4,"15":3,"16":22,"17":14,"18":52,"19":0}
{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":158,"8":27}

收到响应   (31个字节)
239,1,187,160,80,217,153,144,7,21,46,0,10,1,0,7,0,236,226,70,25,16,38,11,0,0,0,0,0,40,118

2C指令   (29个字节)
{"0":239,"1":1,"2":19,"3":196,"4":74,"5":25,"6":104,"7":2,"8":1,"9":19,"10":44,"11":50,"12":14,"13":115,"14":26,"15":30,"16":187,"17":229,"18":248,"19":114}
{"0":236,"1":142,"2":109,"3":67,"4":63,"5":0,"6":1,"7":127,"8":27}

收到响应  (29个字节)
239,1,187,160,80,217,153,144,7,19,44,255,3,0,0,51,0,0,102,163,22,4,14,85,170,67,63,32,4

2D指令    (29个字节)
{"0":239,"1":1,"2":19,"3":196,"4":74,"5":25,"6":104,"7":2,"8":1,"9":19,"10":45,"11":53,"12":3,"13":69,"14":96,"15":171,"16":7,"17":42,"18":182,"19":169}
{"0":19,"1":84,"2":177,"3":243,"4":170,"5":86,"6":95,"7":86,"8":2}

收到响应 (29个字节)
239,1,187,160,80,217,153,144,7,19,45,0,0,227,4,3,22,14,58,227,0,0,2,108,14,210,187,95,132




手机端发送数据:2E指令
  帧头          手机MAC          帧类型   数据帧字节数  功能命令字     数据区              年月日时分秒                      补0                       CRC16
 0----1     2--------------7       8          9            10          11    12      13------------------18    19--------------------------26        27     28   
0xef 0x01   13 c4 4a 19 68 02     0x01       0x13         0x2e        0x00  0x0a     13  04  03  16  0e  34    00  00  00  00  00  00  00  00       0x9e   0x1b


蓝牙回手机的信息
  帧头           蓝牙mac          帧类型    数据字节数   功能命令字                          mac
 0----1      2--------------7       8            9           10          11  12      13  14   15  16  17  18  19  
0xef 0x01   bb a0 50 d9 99 90      0x07         0x15        0x2e       0x00 0x0a    
239  1    187,160,80,217,153,144    7            21          46,          0, 10,      1,0,7,0,236,226,70,25,16,38,11,0,0,0,0,0,                        40,118



手机端发送数据:2C指令
 帧头          手机MAC             帧类型    数据帧字节数     功能命令字               数据区(app动态码 16个字节)                       CRC16
  0    1      2-------------7         8          9             10           11------------------------------------------------26        27   28      
0xef 0x01    13 c4 4a 19 68 02       0x01       0x13          0x2c          
239,   1,   19,196,74,25,104,2       1          19             44         50,14,115,26,30,187,229,248,114 236,142,109,67,63,0,1,        127,27


蓝牙回手机的信息
    帧头         蓝牙MAC                帧类型          数据帧字节数      功能命令字           门锁生成动态码(16字节)                   CRC16
   0    1    2--------------7              8                 9                10           11--------------------------------------26
0xef 0x01                                 0x07              0x13             0x2c
 239,1,     187,160,80,217,153,144,     7(应答)           19                44,        255,3,0,0,51,0,0,102,163,22,4,14,85,170  67,63,     32,4
  

锁生成14字节动态码+接收到的最后两个字节一共16个字节  生成  KEYB。




只有2D数据进行解密。
2D指令

 帧头            手机MAC               帧类型         数据帧字节数     功能命令字            16个字节
  0     1    2--------------7            8                   9              10          11---------------------------------------------26        27   28
0xef  0x01                              0x01                0x13           0x2d         0x34  0x56
239,1       19,196,74,25,104,2           1                   19             45         53,3,69,96,171,7,42,182,169 19,84,177,243,170,86,95,     86,2

收到响应
    帧头           蓝牙MAC             帧类型          数据帧字节数      功能命令字 
 0      1      2--------------7          8                   9               10
0xef 0x01                               0x7                 0x13            0x2d
239,1       187,160,80,217,153,144          7                19              45         0,0,227,4,3,22,14,58,227,0,0,2,108,14,210,187,           95,132



手机发送数据:

从第11字节开始为
  11   12    13    14      15 ------------19       20-----------------------24    25   26         27   28
0x34 0x56    数据包帧号   开锁时间(年月日时分)    开锁结束时间(年月日时分)     补0             CRC16

锁回复数据:

从第11个字节开始
密码状态   等待时间      
11           12        13------------26      27   28
0x00        0x05                补0           CRC16
0x01
0x03

从2d指令开始记录密码的次数  ,连续5次错误,返回0x03

返回数据补加密   

加密是从第11字节开始到26字节进行加密,解密
校验是从第8个字节 (帧类型开始到第26字节)
对2d指令进行  第8个字节到26字节 进行crc16校验。
正确后再进行解密(解密密钥使用KEYB)
进行解密后,对比第11个字节时候为0x34  第12个字节是否是0x56.






About

蓝牙智能锁

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages