|
|
@@ -45,12 +45,13 @@ public class CRCCHECK {
|
|
|
}
|
|
|
|
|
|
public static void main(String args[]){
|
|
|
- Integer bit=1;
|
|
|
+ Integer bit=2;
|
|
|
System.out.println(getOpenLockOrder(bit));
|
|
|
System.out.println(getCloseLockOrder(bit));
|
|
|
System.out.println(getReadLockOrder(bit));
|
|
|
System.out.println(getLockStatus("02 01 01 00 51 CC"));
|
|
|
System.out.println(getLockStatus("02 01 01 01 90 0C"));
|
|
|
+ System.out.println(getBitByCommand("FE 01 01 01 90 0C"));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -119,10 +120,22 @@ public class CRCCHECK {
|
|
|
* @param command
|
|
|
* @return 1开锁状态 0关锁状态
|
|
|
*/
|
|
|
- private static int getLockStatus(String command){
|
|
|
+ public static int getLockStatus(String command){
|
|
|
String commandStr=command.replace(" ","");
|
|
|
String statusStr=commandStr.substring(6,8);
|
|
|
int status=Integer.valueOf(statusStr);
|
|
|
return status;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据指令解析出地址位bit
|
|
|
+ * @param command
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static long getBitByCommand(String command){
|
|
|
+ String commandStr=command.replace(" ","");
|
|
|
+ String statusStr=commandStr.substring(0,2);
|
|
|
+ long status=Long.parseLong(statusStr,16);
|
|
|
+ return status;
|
|
|
+ }
|
|
|
}
|