From cfd058531ac72f728028f141102ddb9743a8568f Mon Sep 17 00:00:00 2001
From: lizhanwei <Dana_Lee1016@126.com>
Date: 星期六, 14 三月 2020 21:31:03 +0800
Subject: [PATCH] 如果设备未登录则不发送心跳消息和位置消息等其他一切消息(不包括注册和鉴权消息);鉴权时间戳修改为秒,然后des加密进行发送;0206位置消息,再收到rtk_info的时候进行控制发送,如果移到MessageProcesser app崩溃,MessageManager.get()抛异常动态长度字段和依赖字段只能有一个,暂时先不改,后边有时间再改

---
 app/src/main/java/safeluck/drive/evaluation/util/Utils.java |   63 ++++++++++++++++++++++++++-----
 1 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/app/src/main/java/safeluck/drive/evaluation/util/Utils.java b/app/src/main/java/safeluck/drive/evaluation/util/Utils.java
index 5a06340..689ee59 100644
--- a/app/src/main/java/safeluck/drive/evaluation/util/Utils.java
+++ b/app/src/main/java/safeluck/drive/evaluation/util/Utils.java
@@ -1,6 +1,7 @@
 package safeluck.drive.evaluation.util;
 
 import android.content.res.Resources;
+import android.os.SystemClock;
 import android.util.Log;
 import android.util.TypedValue;
 
@@ -115,16 +116,16 @@
         return str.matches(regx);
     }
 
-    public static void main(String []args){
-        String str   = "EB00020000031420010000000400A5";
-//        String str   = "7EEB00020000031420010000000400A5007E";
-        String str1  = "EB000200000314200100000004030D00";
-//        String str1  = "7EEB000200000314200100000004030D00D57E";
-        String str2  = "EB000200000314200100000004035000";
-        byte [] dtas=BytesUtils.hexStringToBytes(str);
-        byte checkcode = calCheckCode(dtas);
-        System.out.println(BytesUtils.toHexString(checkcode));
-    }
+//    public static void main(String []args){
+//        String str   = "EB00020000031420010000000400A5";
+////        String str   = "7EEB00020000031420010000000400A5007E";
+//        String str1  = "EB000200000314200100000004030D00";
+////        String str1  = "7EEB000200000314200100000004030D00D57E";
+//        String str2  = "EB000200000314200100000004035000";
+//        byte [] dtas=BytesUtils.hexStringToBytes(str);
+//        byte checkcode = calCheckCode(dtas);
+//        System.out.println(BytesUtils.toHexString(checkcode));
+//    }
 
 
 
@@ -271,4 +272,46 @@
         return cipher.doFinal(src);
     }
 
+    public static int parseUnsignedInt(String s, int radix)
+            throws NumberFormatException {
+        if (s == null)  {
+            throw new NumberFormatException("null");
+        }
+
+        int len = s.length();
+        if (len > 0) {
+            char firstChar = s.charAt(0);
+            if (firstChar == '-') {
+                throw new
+                        NumberFormatException(String.format("Illegal leading minus sign " +
+                        "on unsigned string %s.", s));
+            } else {
+                if (len <= 5 || // Integer.MAX_VALUE in Character.MAX_RADIX is 6 digits
+                        (radix == 10 && len <= 9) ) { // Integer.MAX_VALUE in base 10 is 10 digits
+                    return Integer.parseInt(s, radix);
+                } else {
+                    long ell = Long.parseLong(s, radix);
+                    if ((ell & 0xffff_ffff_0000_0000L) == 0) {
+                        return (int) ell;
+                    } else {
+                        throw new
+                                NumberFormatException(String.format("String value %s exceeds " +
+                                "range of unsigned int.", s));
+                    }
+                }
+            }
+        } else {
+            throw new NumberFormatException("For input string: \"" + s + "\"");
+        }
+    }
+
+    public static void main(String[] args){
+        long longCurrTIme = System.currentTimeMillis()/1000;
+        long CurrTIme =  System.currentTimeMillis();
+        System.out.println("longCurrTIme="+longCurrTIme);
+        System.out.println("intCurrTIme="+CurrTIme);
+        int unsignedTime=  parseUnsignedInt(String.valueOf(longCurrTIme),10);
+        System.out.println("unsigned int time = "+unsignedTime);
+    }
+
 }

--
Gitblit v1.8.0