编译 V380_2003191208_release
authorsnickersun <scy@incartech.cn>
Thu, 19 Mar 2020 04:20:52 +0000 (12:20 +0800)
committersnickersun <scy@incartech.cn>
Thu, 19 Mar 2020 04:20:52 +0000 (12:20 +0800)
配合 FactoryMode_V7_202003191209_release.apk
修复工厂模式下,只要进行过GPS测试,就很可能造成 ICProtocol无法继续GPS定位的问题。

app/debug/ICSer_V379_2003180939_debug.apk [new file with mode: 0644]
app/release/ICSer_V379_2003181740_release.apk [deleted file]
app/release/ICSer_V380_2003191208_release.apk [new file with mode: 0644]
app/src/main/java/com/enqualcomm/support/LocationClient.java
app/src/main/java/com/enqualcomm/support/NMEAListener.java
app/src/main/java/com/enqualcomm/support/bean/Runtime.java
app/version_code.properties

diff --git a/app/debug/ICSer_V379_2003180939_debug.apk b/app/debug/ICSer_V379_2003180939_debug.apk
new file mode 100644 (file)
index 0000000..bb52a32
Binary files /dev/null and b/app/debug/ICSer_V379_2003180939_debug.apk differ
diff --git a/app/release/ICSer_V379_2003181740_release.apk b/app/release/ICSer_V379_2003181740_release.apk
deleted file mode 100644 (file)
index 8c258ce..0000000
Binary files a/app/release/ICSer_V379_2003181740_release.apk and /dev/null differ
diff --git a/app/release/ICSer_V380_2003191208_release.apk b/app/release/ICSer_V380_2003191208_release.apk
new file mode 100644 (file)
index 0000000..3694415
Binary files /dev/null and b/app/release/ICSer_V380_2003191208_release.apk differ
index 0add009..6baeee4 100644 (file)
@@ -12,6 +12,7 @@ import android.os.SystemClock;
 import android.provider.Settings;\r
 \r
 import com.enqualcomm.support.utils.AlarmHelper;\r
+import com.enqualcomm.support.utils.Util;\r
 import com.ic.jni.ICJniUtils;\r
 import com.enqualcomm.support.adapter.LBSHelper;\r
 import com.enqualcomm.support.adapter.protocolAPIHelper;\r
@@ -213,10 +214,22 @@ public class LocationClient {
       });\r
     this.mLbsHelper.getWifiInfo();\r
   }\r
-//  public void EqcAlgorithmInterfaceMethod2() {\r
     public void startGpsLocate() {\r
-       //防止与工厂测试冲突\r
-      if (!DeviceInfoUtil.isFactoryTestTopActivity(runtime.getContextProxy().context)) {\r
+\r
+\r
+      boolean FactryModeOpening=DeviceInfoUtil.isFactoryTestTopActivity(runtime.getContextProxy().context);\r
+      boolean needReOpenGPS=runtime.getFactoryTestingStat();\r
+\r
+      //防止与工厂测试冲突\r
+      if (FactryModeOpening==false || needReOpenGPS==true) {\r
+\r
+        if (needReOpenGPS==true) {\r
+          ICLogger.i("工厂模式关闭了GPS,需要重新关闭GPS以同步状态!");\r
+          //处理过后,要把状态设置为初始状态,防止每次都重启。\r
+          runtime.setFactoryTestingStat(false);\r
+          //如果发现需要重启GPS,为了状态正确,需要先停止GPS\r
+          nmeaListener.stopListen();\r
+         }\r
         ICLogger.i("开启GPS扫描!");\r
         if(Config.LOG_TOFILE) ICLogger.logToFile("GPS","开启GPS扫描!");\r
         if (!nmeaListener.isListening()) {\r
@@ -233,6 +246,7 @@ public class LocationClient {
         }\r
       }else{\r
         ICLogger.i("工厂模式,skip 开启GPS扫描!");\r
+        runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_OPEN); //此处为了检测是否定位时可以正确识别状态,以防一直处于GPS定位成功状态\r
         if(Config.LOG_TOFILE) ICLogger.logToFile("GPS","工厂模式,skip 开启GPS扫描!");\r
       }\r
   }\r
@@ -427,8 +441,10 @@ public class LocationClient {
 //      Deliver.is_active_location = false;\r
 //      getLocationWakeLock();\r
 //    }\r
+\r
+    boolean FactryModeOpening=DeviceInfoUtil.isFactoryTestTopActivity(runtime.getContextProxy().context);\r
     //防止与工厂测试冲突\r
-    if (!DeviceInfoUtil.isFactoryTestTopActivity(runtime.getContextProxy().context)) {\r
+    if (FactryModeOpening==false ) {\r
       ICLogger.i("stopGpsLocate");\r
       if(Config.LOG_TOFILE) ICLogger.logToFile("GPS","stopGpsLocate");\r
       Single.just(null).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<Object>() {\r
@@ -438,6 +454,7 @@ public class LocationClient {
       });\r
     }else{\r
       ICLogger.i("工厂模式 skip stopGpsLocate");\r
+      runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_OPEN); //此处为了检测是否定位时可以正确识别状态,以防一直处于GPS定位成功状态\r
       if(Config.LOG_TOFILE) ICLogger.logToFile("GPS","工厂模式 skip stopGpsLocate");\r
     }\r
   }\r
@@ -546,12 +563,33 @@ public void updateCellInfo() {
 \r
     }\r
   }\r
+  private static String ACTION_GPSCMD="com.enqualcomm.support.gps";\r
+  public void registerBroadReceiver() {\r
+\r
+    IntentFilter intentFilter = new IntentFilter();\r
+    intentFilter.addAction(ACTION_GPSCMD);\r
+    (this.runtime.getContextProxy()).context.registerReceiver(this.mLocationBroadcastReceiver, intentFilter);\r
+  }\r
 \r
+  public void unregisterBroadReceiver() {\r
+    (this.runtime.getContextProxy()).context.unregisterReceiver(this.mLocationBroadcastReceiver);\r
+  }\r
 \r
+  private final BroadcastReceiver mLocationBroadcastReceiver = new BroadcastReceiver() {\r
+    @Override\r
+    public void onReceive(Context context, Intent intent) {\r
+      String action = intent.getAction();\r
+      if (ACTION_GPSCMD.equals(action)) {\r
+        String status = intent.getStringExtra("status");\r
+        if( status.equals("needReopen")){\r
+          runtime.setFactoryTestingStat(true);\r
+        }\r
+      }\r
+    }\r
+  };\r
 \r
   public void init() {\r
 \r
-\r
     this.mSignalUtil = SimSignalUtil.getInstance((runtime.getContextProxy()).context);\r
 \r
     //获取LBS定位服务\r
@@ -570,6 +608,7 @@ public void updateCellInfo() {
 //    intentFilter.addAction("android.intent.action.SCREEN_ON");\r
 //    (runtime.getContextProxy()).context.registerReceiver(this.screenOnReceiver, intentFilter);\r
 \r
+    registerBroadReceiver();\r
 \r
 \r
     //暂时没有处理4G、2G切换问题\r
@@ -587,6 +626,7 @@ public void updateCellInfo() {
 //      }\r
 //    });\r
     stopGpsLocate();\r
+    unregisterBroadReceiver();\r
   }\r
 \r
 \r
index 1f4480c..a0297d2 100644 (file)
@@ -32,9 +32,9 @@ import rx.functions.Action1;
 import static android.location.LocationManager.GPS_PROVIDER;\r
 \r
 public class NMEAListener implements NmeaListener, LocationListener {\r
-  private static boolean listening=false;\r
+  private static boolean listening = false;\r
 \r
-  public boolean isListening(){\r
+  public boolean isListening() {\r
     return listening;\r
   }\r
 \r
@@ -44,40 +44,43 @@ public class NMEAListener implements NmeaListener, LocationListener {
   private double longitude;\r
   private double latitude;\r
 \r
-  private boolean noStop=false;\r
+  private boolean noStop = false;\r
 \r
 \r
   private int SearchTimeout = 120;\r
-  private int noSignalCount=0;\r
-  private int searchCout=0;\r
-  private  GPS_CURRENT_STATUS  gpsMode;\r
+  private int noSignalCount = 0;\r
+  private int searchCout = 0;\r
+  private GPS_CURRENT_STATUS gpsMode;\r
   int numberOfSatellites;\r
   Runtime runtime;\r
 \r
-  private static int MaxFixedTimes=3;\r
+  private static int MaxFixedTimes = 3;\r
 \r
-  private static int locationFixedCount=0;\r
+  private static int locationFixedCount = 0;\r
 \r
 \r
-  private static location_callback mCallback=null;\r
-  public interface location_callback{\r
+  private static location_callback mCallback = null;\r
+\r
+  public interface location_callback {\r
     public void on_locating_changed(GPS_locationStatus gps_status);\r
   }\r
-  public static void set_callback(location_callback callback){\r
-    mCallback=callback;\r
+\r
+  public static void set_callback(location_callback callback) {\r
+    mCallback = callback;\r
   }\r
 \r
   private GPS_locationStatus gps_status = new GPS_locationStatus();\r
-  public GPS_locationStatus get_gps_status(){\r
+\r
+  public GPS_locationStatus get_gps_status() {\r
     return gps_status;\r
   }\r
 \r
 \r
-  public void setNoStop(boolean nostop){\r
-    noStop=nostop;\r
-    ICLogger.i("setNoStop "+nostop);\r
-    if (noStop==false ){\r
-      switch (runtime.getLocationInstance().getWorkingMod()){\r
+  public void setNoStop(boolean nostop) {\r
+    noStop = nostop;\r
+    ICLogger.i("setNoStop " + nostop);\r
+    if (noStop == false) {\r
+      switch (runtime.getLocationInstance().getWorkingMod()) {\r
         case ICLocation.CUSTOM_MOD:\r
         case ICLocation.EMERGNECY_MOD:\r
         case ICLocation.REALTIME_MOD:\r
@@ -95,30 +98,33 @@ public class NMEAListener implements NmeaListener, LocationListener {
 \r
     }\r
   }\r
+\r
   public NMEAListener(LocationManager paramLocationManager, Runtime paramRuntime) {\r
     this.locationManager = paramLocationManager;\r
     this.runtime = paramRuntime;\r
   }\r
 \r
-  static int satindex=0;\r
+  static int satindex = 0;\r
+\r
   public void onNmeaReceived(long paramLong, String nmeastr) {\r
 //    EqcAlgorithmNative.native_EqcAlgorithmMethod5(paramString);\r
 //    ICLogger.i("Nmea :"+nmeastr+" "+paramLong);\r
 \r
-    if (Config.LOG_TOFILE) FileOutputUtil.fileOutputRaw(this.runtime.getCacheDir(),"Nmea",nmeastr);\r
+    if (Config.LOG_TOFILE)\r
+      FileOutputUtil.fileOutputRaw(this.runtime.getCacheDir(), "Nmea", nmeastr);\r
 \r
-    if(nmeastr.startsWith("$RD_RSSI"))  {\r
+    if (nmeastr.startsWith("$RD_RSSI")) {\r
 \r
       searchCout++;\r
-      if (mCallback !=null)\r
+      if (mCallback != null)\r
         mCallback.on_locating_changed(get_gps_status());\r
       gps_status.numSatelliteList.clear();\r
-      gps_status.search_time_cost=searchCout;\r
+      gps_status.search_time_cost = searchCout;\r
     }\r
 \r
 \r
-    if (nmeastr.startsWith("$GPGLL,")){\r
-      String tmplist[]=nmeastr.split(",");\r
+    if (nmeastr.startsWith("$GPGLL,")) {\r
+      String tmplist[] = nmeastr.split(",");\r
 //      GPGLL编辑\r
 //(地理定位信息)\r
 //      例:$GPGLL,4250.5589,S,14718.5084,E,092204.999,A*2D\r
@@ -130,12 +136,12 @@ public class NMEAListener implements NmeaListener, LocationListener {
 //      字段5:UTC时间,hhmmss.sss格式\r
 //      字段6:状态,A=定位,V=未定位\r
 //      字段7:校验值($与*之间的数异或后的值)\r
-      String Lat=tmplist[1];\r
-      String lon=tmplist[3];\r
-      String fixed=tmplist[6];\r
+      String Lat = tmplist[1];\r
+      String lon = tmplist[3];\r
+      String fixed = tmplist[6];\r
 //      ICLogger.i("GPGLL Lat="+Lat+",Lon="+lon+",fixed="+fixed);\r
 \r
-    }else if (nmeastr.startsWith("$GPRMC,")) {\r
+    } else if (nmeastr.startsWith("$GPRMC,")) {\r
 //      GPRMC编辑\r
 //(推荐定位信息数据格式)\r
 //      例:$GPRMC,024813.640,A,3158.4608,N,11848.3737,E,10.05,324.27,150706,,,A*50\r
@@ -153,12 +159,12 @@ public class NMEAListener implements NmeaListener, LocationListener {
 //      字段11:磁偏角方向,E=东W=西\r
 //      字段12:模式,A=自动,D=差分,E=估测,N=数据无效(3.0协议内容)\r
 //      字段13:校验值($与*之间的数异或后的值)\r
-      String tmplist[]=nmeastr.split(",");\r
-      String utctime=tmplist[1];\r
-      String Lat=tmplist[3];\r
-      String lon=tmplist[5];\r
-      String fixed=tmplist[2];\r
-      String speed=tmplist[7];\r
+      String tmplist[] = nmeastr.split(",");\r
+      String utctime = tmplist[1];\r
+      String Lat = tmplist[3];\r
+      String lon = tmplist[5];\r
+      String fixed = tmplist[2];\r
+      String speed = tmplist[7];\r
 //      ICLogger.i("GPRMC GPSTime="+utctime+",Lat="+Lat+",Lon="+lon+",fixed="+fixed+",speed="+speed);\r
 //      if (Config.LOG_TOFILE)\r
 //        FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", "GPRMC GPSTime="+utctime+",Lat="+Lat+",Lon="+lon+",fixed="+fixed+",speed="+speed);\r
@@ -168,7 +174,7 @@ public class NMEAListener implements NmeaListener, LocationListener {
       }\r
 \r
 \r
-    }else if (nmeastr.startsWith("$GPGSV,")) {\r
+    } else if (nmeastr.startsWith("$GPGSV,")) {\r
 \r
 //    GPGSV编辑\r
 //            (可见卫星信息)\r
@@ -191,36 +197,36 @@ public class NMEAListener implements NmeaListener, LocationListener {
 ////    字段15:信噪比(00-99)dbHz\r
 //    字段16:校验值($与*之间的数异或后的值)\r
 \r
-      String tmplist[]=nmeastr.split(",");\r
-      int maxPageCount=Integer.valueOf(tmplist[1]);\r
-      int currentPage=Integer.valueOf(tmplist[2]);\r
-      int SatlitesCount=Integer.valueOf(tmplist[3]);\r
-      if (maxPageCount>0 && currentPage==1){\r
+      String tmplist[] = nmeastr.split(",");\r
+      int maxPageCount = Integer.valueOf(tmplist[1]);\r
+      int currentPage = Integer.valueOf(tmplist[2]);\r
+      int SatlitesCount = Integer.valueOf(tmplist[3]);\r
+      if (maxPageCount > 0 && currentPage == 1) {\r
         //第一页把数组初始化一遍。\r
-        satindex=0;\r
+        satindex = 0;\r
         runtime.getLocationInstance().numSatelliteList.clear(); //清除 SNR >0的卫星\r
         runtime.getLocationInstance().max3Satellite.clear(); //清除 最大3个星值\r
 \r
-        gps_status.satlite_numbss=SatlitesCount;\r
+        gps_status.satlite_numbss = SatlitesCount;\r
       }\r
-      int satcount=(tmplist.length-4)/4;\r
+      int satcount = (tmplist.length - 4) / 4;\r
 //      ICLogger.i("Nmea :"+nmeastr+" "+satcount);\r
       runtime.getLocationInstance().set_adding_satlite_flag(true);\r
-      for (int i=0;i<satcount;i++){\r
+      for (int i = 0; i < satcount; i++) {\r
         satindex++;\r
-        String prn=tmplist[i*4+4];\r
-        String snr=tmplist[i*4+4+3];\r
-        if (snr.contains("*")){\r
-          snr=snr.substring(0,snr.indexOf("*"));\r
+        String prn = tmplist[i * 4 + 4];\r
+        String snr = tmplist[i * 4 + 4 + 3];\r
+        if (snr.contains("*")) {\r
+          snr = snr.substring(0, snr.indexOf("*"));\r
+        }\r
+        if (snr.trim().isEmpty()) {\r
+          snr = "0";\r
         }\r
-        if (snr.trim().isEmpty()){\r
-          snr="0";\r
-         }\r
-        ICLogger.i("Sat="+satindex+",prn="+prn+",snr="+snr);\r
-\r
-        int intprn=Integer.valueOf(prn);\r
-        float floatsnr=Float.valueOf(snr);\r
-        if (floatsnr>0) {\r
+        ICLogger.i("Sat=" + satindex + ",prn=" + prn + ",snr=" + snr);\r
+\r
+        int intprn = Integer.valueOf(prn);\r
+        float floatsnr = Float.valueOf(snr);\r
+        if (floatsnr > 0) {\r
           //排序取得最大3个SNR\r
           get3MaxSnrSatellite(new ICLocation.GpsSatellitePriv(intprn, floatsnr));\r
           runtime.getLocationInstance().numSatelliteList.add(new ICLocation.GpsSatellitePriv(intprn, floatsnr));\r
@@ -229,27 +235,27 @@ public class NMEAListener implements NmeaListener, LocationListener {
       }\r
 \r
       runtime.getLocationInstance().set_adding_satlite_flag(false);\r
-      if (maxPageCount==currentPage) {\r
+      if (maxPageCount == currentPage) {\r
         //最后一页,打印搜星情况,并作一些判断。\r
-        StringBuilder sb=new StringBuilder();\r
-        sb.append("搜索"+searchCout+"次,搜索到卫星个数" + SatlitesCount+", [SNR>0] ="+ runtime.getLocationInstance().numSatelliteList.size());\r
+        StringBuilder sb = new StringBuilder();\r
+        sb.append("搜索" + searchCout + "次,搜索到卫星个数" + SatlitesCount + ", [SNR>0] =" + runtime.getLocationInstance().numSatelliteList.size());\r
         sb.append(", Max 5 SNR [");\r
-        for (int i=0;i< runtime.getLocationInstance().max3Satellite.size();i++){\r
-          sb.append( runtime.getLocationInstance().max3Satellite.get(i).getSnr()+",");\r
+        for (int i = 0; i < runtime.getLocationInstance().max3Satellite.size(); i++) {\r
+          sb.append(runtime.getLocationInstance().max3Satellite.get(i).getSnr() + ",");\r
         }\r
         sb.append("]");\r
         if (Config.LOG_TOFILE)\r
-          FileOutputUtil.fileOutput(this.runtime.getCacheDir(),"GPS",sb.toString());\r
-        ICLogger.i( sb.toString());\r
+          FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", sb.toString());\r
+        ICLogger.i(sb.toString());\r
 \r
         // 卫星总数小于2 ,或者 snr小于20\r
-        if ( runtime.getLocationInstance().numSatelliteList.size()< 3 && ( runtime.getLocationInstance().max3Satellite.size()>0?( runtime.getLocationInstance().max3Satellite.get(0).getSnr()<20?true:false) : true)){\r
+        if (runtime.getLocationInstance().numSatelliteList.size() < 3 && (runtime.getLocationInstance().max3Satellite.size() > 0 ? (runtime.getLocationInstance().max3Satellite.get(0).getSnr() < 20 ? true : false) : true)) {\r
           noSignalCount++;\r
         }\r
 \r
 \r
-        StringBuilder sb2=new StringBuilder();\r
-        if(!noStop) {\r
+        StringBuilder sb2 = new StringBuilder();\r
+        if (!noStop) {\r
           if (searchCout > ICLocation.MAX_GPS_SEARCH_TIMEOUT) {\r
             sb2.append(" 搜索" + searchCout + "次未定位,超过" + ICLocation.MAX_GPS_SEARCH_TIMEOUT + "限制退出GPS定位");\r
 \r
@@ -263,12 +269,12 @@ public class NMEAListener implements NmeaListener, LocationListener {
             stop(MSG_WHAT_GPS_NOSTAR);\r
           }\r
         }\r
-        ICLogger.i( sb2.toString());\r
+        ICLogger.i(sb2.toString());\r
         if (Config.LOG_TOFILE)\r
-          FileOutputUtil.fileOutput(this.runtime.getCacheDir(),"GPS",sb2.toString());\r
+          FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", sb2.toString());\r
 \r
       }\r
-    }else if (nmeastr.startsWith("$GPGGA,")) {\r
+    } else if (nmeastr.startsWith("$GPGGA,")) {\r
 \r
 //    GPGGA编辑\r
 //(定位信息)\r
@@ -290,76 +296,76 @@ public class NMEAListener implements NmeaListener, LocationListener {
 //    字段14:差分站ID号0000 - 1023(前导位数不足则补0,如果不是差分定位将为空)\r
 //    字段15:校验值($与*之间的数异或后的值)\r
 \r
-      String tmplist[]=nmeastr.split(",");\r
-      String utctime=tmplist[1];\r
-      String Lat=tmplist[2];\r
-      String lon=tmplist[4];\r
-      String fixed=tmplist[6];\r
-      String usedStarts=tmplist[7];\r
-      String hdop=tmplist[8];\r
+      String tmplist[] = nmeastr.split(",");\r
+      String utctime = tmplist[1];\r
+      String Lat = tmplist[2];\r
+      String lon = tmplist[4];\r
+      String fixed = tmplist[6];\r
+      String usedStarts = tmplist[7];\r
+      String hdop = tmplist[8];\r
 \r
 \r
-      if ( (fixed.trim().equals("1"))||(fixed.trim().equals("2"))||(fixed.trim().equals("6"))){\r
+      if ((fixed.trim().equals("1")) || (fixed.trim().equals("2")) || (fixed.trim().equals("6"))) {\r
 \r
 \r
-          // 转换GPS坐标为度,以便在各种应用中可以方便查找。\r
-          latitude=Double.valueOf(Lat);\r
-          longitude=Double.valueOf(lon);\r
-          // 转换单位,从分转换到度\r
+        // 转换GPS坐标为度,以便在各种应用中可以方便查找。\r
+        latitude = Double.valueOf(Lat);\r
+        longitude = Double.valueOf(lon);\r
+        // 转换单位,从分转换到度\r
 \r
-          double intdu= (int)(longitude /100f); //小数转换到分为单位\r
-          double du=(longitude - intdu*100)/60f;\r
-          double last= intdu+du;\r
-          longitude =last;\r
-          intdu= (int)(latitude /100f); //小数转换到分为单位\r
-          du=(latitude - intdu*100)/60f;\r
-          last= intdu+du;\r
-          latitude=last;\r
+        double intdu = (int) (longitude / 100f); //小数转换到分为单位\r
+        double du = (longitude - intdu * 100) / 60f;\r
+        double last = intdu + du;\r
+        longitude = last;\r
+        intdu = (int) (latitude / 100f); //小数转换到分为单位\r
+        du = (latitude - intdu * 100) / 60f;\r
+        last = intdu + du;\r
+        latitude = last;\r
 \r
-          // 经纬度 保留4位小数点\r
-          DecimalFormat df = new DecimalFormat("#.000000");\r
-          String strLatitude = df.format(latitude);\r
-          String strLongitude = df.format(longitude);\r
+        // 经纬度 保留4位小数点\r
+        DecimalFormat df = new DecimalFormat("#.000000");\r
+        String strLatitude = df.format(latitude);\r
+        String strLongitude = df.format(longitude);\r
 \r
         //定位\r
-        StringBuilder sb=new StringBuilder();\r
-        sb.append("GPGGA, location time= " + TimeUtil.getLocalTime() + ", FixedCount=" + locationFixedCount + ", GPSTime="+utctime+", Lat="+Lat+" ("+strLatitude+"), Lon="+lon+" ("+strLongitude+"), fixed="+fixed+", hdop="+hdop+", usedStarts="+usedStarts);\r
+        StringBuilder sb = new StringBuilder();\r
+        sb.append("GPGGA, location time= " + TimeUtil.getLocalTime() + ", FixedCount=" + locationFixedCount + ", GPSTime=" + utctime + ", Lat=" + Lat + " (" + strLatitude + "), Lon=" + lon + " (" + strLongitude + "), fixed=" + fixed + ", hdop=" + hdop + ", usedStarts=" + usedStarts);\r
         ICLogger.i(sb.toString());\r
         if (Config.LOG_TOFILE)\r
           FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", sb.toString());\r
         //定位了,\r
-          if (hdop!=null&& hdop.trim().length()>0 && Float.valueOf(hdop)<ICLocation.MAX_HDOP) {\r
-            locationFixedCount++;\r
-          }else{\r
-            ICLogger.i("HDOP is larger than "+ICLocation.MAX_HDOP+" , skip this location!");\r
-            if (Config.LOG_TOFILE)\r
-              FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", "HDOP is larger than "+ICLocation.MAX_HDOP+" , skip this location!");\r
-          }\r
-          if (locationFixedCount > MaxFixedTimes) {\r
+        if (hdop != null && hdop.trim().length() > 0 && Float.valueOf(hdop) < ICLocation.MAX_HDOP) {\r
+          locationFixedCount++;\r
+        } else {\r
+          ICLogger.i("HDOP is larger than " + ICLocation.MAX_HDOP + " , skip this location!");\r
+          if (Config.LOG_TOFILE)\r
+            FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", "HDOP is larger than " + ICLocation.MAX_HDOP + " , skip this location!");\r
+        }\r
+        if (locationFixedCount > MaxFixedTimes) {\r
                /*\r
                 只有当前GPS已经定位,且location不为空才给 runtime赋值GPS坐标。\r
                 延迟MaxFixedTimes秒后才设置runtime的定位标志,以便稳定坐标值。\r
               */\r
-            runtime.getLocationInstance().setLocation(Lat,lon);\r
-            runtime.getLocationInstance().setUsedStarts(Integer.valueOf(usedStarts.trim()));\r
-            runtime.getLocationInstance().setHod(Float.valueOf(hdop.trim()));\r
-            runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_FIXED);\r
-            ICLogger.i("定位"+locationFixedCount+"次 > "+MaxFixedTimes+", set LOCATION_FIXED ");\r
-            if (Config.LOG_TOFILE)\r
-              FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", "定位"+locationFixedCount+"次 > "+MaxFixedTimes+", set LOCATION_FIXED ");\r
-            if (!noStop) {\r
-              stopListen();\r
-            }\r
+          runtime.getLocationInstance().setLocation(Lat, lon);\r
+          runtime.getLocationInstance().setUsedStarts(Integer.valueOf(usedStarts.trim()));\r
+          runtime.getLocationInstance().setHod(Float.valueOf(hdop.trim()));\r
+          runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_FIXED);\r
+          ICLogger.i("定位" + locationFixedCount + "次 > " + MaxFixedTimes + ", set LOCATION_FIXED ");\r
+          if (Config.LOG_TOFILE)\r
+            FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", "定位" + locationFixedCount + "次 > " + MaxFixedTimes + ", set LOCATION_FIXED ");\r
+          if (!noStop) {\r
+            stopListen();\r
           }\r
-        gps_status.locating_status=1; //fixed\r
-      }else{\r
-        gps_status.locating_status=0; //notfixed\r
+        }\r
+        gps_status.locating_status = 1; //fixed\r
+      } else {\r
+        gps_status.locating_status = 0; //notfixed\r
       }\r
-      gps_status.hdop=Float.valueOf(hdop.trim());\r
-      gps_status.used_gps_numbs=Integer.valueOf(usedStarts.trim());\r
+      gps_status.hdop = Float.valueOf(hdop.trim());\r
+      gps_status.used_gps_numbs = Integer.valueOf(usedStarts.trim());\r
 \r
 \r
-    }else if (nmeastr.startsWith("$GPGSA,")) {\r
+    } else if (nmeastr.startsWith("$GPGSA,")) {\r
 \r
 //    GPGSA编辑\r
 //( 当前卫星信息)\r
@@ -394,19 +400,22 @@ public class NMEAListener implements NmeaListener, LocationListener {
 //      }\r
     }\r
   }\r
-  \r
-  public void onProviderDisabled(String paramString) {}\r
-  \r
-  public void onProviderEnabled(String paramString) {}\r
+\r
+  public void onProviderDisabled(String paramString) {\r
+  }\r
+\r
+  public void onProviderEnabled(String paramString) {\r
+  }\r
 \r
   @Override\r
   public void onLocationChanged(Location location) {\r
 \r
   }\r
 \r
-  public void onStatusChanged(String paramString, int paramInt, Bundle paramBundle) {}\r
+  public void onStatusChanged(String paramString, int paramInt, Bundle paramBundle) {\r
+  }\r
 \r
-  public boolean gpsColdStart(){\r
+  public boolean gpsColdStart() {\r
 //冷启动\r
     Bundle bundle = null;\r
     locationManager.sendExtraCommand("gps", "force_xtra_injection", bundle); //command\r
@@ -416,7 +425,7 @@ public class NMEAListener implements NmeaListener, LocationListener {
 \r
   }\r
 \r
-  public boolean gpsWormStart(){\r
+  public boolean gpsWormStart() {\r
 \r
 //温启动\r
     Bundle bundleWarm = new Bundle();\r
@@ -427,7 +436,7 @@ public class NMEAListener implements NmeaListener, LocationListener {
     return b2;\r
   }\r
 \r
-  public boolean gpsHotStart(){\r
+  public boolean gpsHotStart() {\r
 //热启动\r
     Bundle bundleHot = new Bundle();\r
     bundleHot.putBoolean("almanac", true);\r
@@ -438,21 +447,20 @@ public class NMEAListener implements NmeaListener, LocationListener {
   }\r
 \r
 \r
-  private final int MSG_WHAT_GPS_FIXED=300;\r
-  private final int MSG_WHAT_GPS_TIMEOUT=100;\r
-  private final int MSG_WHAT_GPS_NOSTAR=200;\r
-  private final int MSG_WHAT_GPS_FIXED_NO_STOP=400;\r
+  private final int MSG_WHAT_GPS_FIXED = 300;\r
+  private final int MSG_WHAT_GPS_TIMEOUT = 100;\r
+  private final int MSG_WHAT_GPS_NOSTAR = 200;\r
+  private final int MSG_WHAT_GPS_FIXED_NO_STOP = 400;\r
 \r
   Handler temHandler = new Handler(new Handler.Callback() {\r
     @Override\r
     public boolean handleMessage(Message message) {\r
 \r
-      if( message.what== MSG_WHAT_GPS_TIMEOUT|| message.what==MSG_WHAT_GPS_NOSTAR){\r
-      //no start\r
-      //do nothing\r
+      if (message.what == MSG_WHAT_GPS_TIMEOUT || message.what == MSG_WHAT_GPS_NOSTAR) {\r
+        //no start\r
+        //do nothing\r
 \r
-      }\r
-      else if (message.what==MSG_WHAT_GPS_FIXED){\r
+      } else if (message.what == MSG_WHAT_GPS_FIXED) {\r
         //fixed\r
          /*\r
         只有当前GPS已经定位,且location不为空才给 runtime赋值GPS坐标。\r
@@ -462,41 +470,42 @@ public class NMEAListener implements NmeaListener, LocationListener {
 \r
       }\r
 \r
-      if (!noStop){\r
-        ICLogger.i("handleMessage MSG_WHAT_GPS_TIMEOUT/ MSG_WHAT_GPS_NOSTAR/ MSG_WHAT_GPS_FIXED "+message.what);\r
+      if (!noStop) {\r
+        ICLogger.i("handleMessage MSG_WHAT_GPS_TIMEOUT/ MSG_WHAT_GPS_NOSTAR/ MSG_WHAT_GPS_FIXED " + message.what);\r
 \r
         stopListen();\r
       }\r
       return true;\r
     }\r
   });\r
-  private void get3MaxSnrSatellite(ICLocation.GpsSatellitePriv gst){\r
+\r
+  private void get3MaxSnrSatellite(ICLocation.GpsSatellitePriv gst) {\r
 \r
     float snr = gst.getSnr();\r
-    for (int k=0;k< runtime.getLocationInstance().max3Satellite.size();k++) {\r
-      if(  runtime.getLocationInstance().max3Satellite.get(k).getPrn()==gst.getPrn())\r
+    for (int k = 0; k < runtime.getLocationInstance().max3Satellite.size(); k++) {\r
+      if (runtime.getLocationInstance().max3Satellite.get(k).getPrn() == gst.getPrn())\r
         runtime.getLocationInstance().max3Satellite.remove(k);\r
     }\r
     runtime.getLocationInstance().max3Satellite.add(gst);//先添加进来。\r
 \r
     //从大到小排序\r
-    for(int i=0;i< runtime.getLocationInstance().max3Satellite.size();i++) {\r
-      for (int j=i;j< runtime.getLocationInstance().max3Satellite.size();j++) {\r
-        if ( runtime.getLocationInstance().max3Satellite.get(i).getSnr() <  runtime.getLocationInstance().max3Satellite.get(j).getSnr()) {\r
-          ICLocation.GpsSatellitePriv ts =  runtime.getLocationInstance().max3Satellite.get(j);\r
+    for (int i = 0; i < runtime.getLocationInstance().max3Satellite.size(); i++) {\r
+      for (int j = i; j < runtime.getLocationInstance().max3Satellite.size(); j++) {\r
+        if (runtime.getLocationInstance().max3Satellite.get(i).getSnr() < runtime.getLocationInstance().max3Satellite.get(j).getSnr()) {\r
+          ICLocation.GpsSatellitePriv ts = runtime.getLocationInstance().max3Satellite.get(j);\r
           runtime.getLocationInstance().max3Satellite.remove(j);\r
           runtime.getLocationInstance().max3Satellite.add(i, ts);//大的放前面\r
         }\r
       }\r
     }\r
-    if ( runtime.getLocationInstance().max3Satellite.size()>5){ //超过三个,谁小就删掉\r
+    if (runtime.getLocationInstance().max3Satellite.size() > 5) { //超过三个,谁小就删掉\r
       runtime.getLocationInstance().max3Satellite.remove(5);\r
     }\r
 \r
   }\r
 \r
   //停止定位\r
-  private void stop(int id){\r
+  private void stop(int id) {\r
 \r
     // 经纬度 保留6位小数点\r
 //    DecimalFormat df = new DecimalFormat("#.000000");\r
@@ -509,6 +518,7 @@ public class NMEAListener implements NmeaListener, LocationListener {
     //发送停止消息\r
     temHandler.sendEmptyMessage(id);\r
   }\r
+\r
   boolean isFrist = true;\r
 \r
 \r
@@ -530,7 +540,7 @@ public class NMEAListener implements NmeaListener, LocationListener {
 \r
       ICLogger.i("GPS StartListen with Provider " + provider);\r
 \r
-      if( Config.LOG_TOFILE) ICLogger.logToFile("GPS","GPS StartListen with Provider " + provider);\r
+      if (Config.LOG_TOFILE) ICLogger.logToFile("GPS", "GPS StartListen with Provider " + provider);\r
 \r
       this.locationManager.requestLocationUpdates(provider, 0L, 0.0F, this);\r
 \r
@@ -539,21 +549,23 @@ public class NMEAListener implements NmeaListener, LocationListener {
       longitude = 0;\r
       latitude = 0;\r
       searchCout = 0;\r
-      locationFixedCount=0;\r
+      locationFixedCount = 0;\r
       gpsMode = GPS_CURRENT_STATUS.GPS_LISTENING;\r
 //      locationManager.addGpsStatusListener(statusListener);//监听搜星状态\r
       locationManager.addNmeaListener(this); //监听NMEA 协议数据。\r
 \r
       //做个热启动\r
       return true;//gpsHotStart();\r
-    }else{\r
+    } else {\r
       ICLogger.i(" location listening, skip !");\r
-      if( Config.LOG_TOFILE)ICLogger.logToFile("GPS"," location listening, skip !");\r
+      if (Config.LOG_TOFILE) ICLogger.logToFile("GPS", " location listening, skip !");\r
 \r
       return true;\r
     }\r
   }\r
-  \r
+  public boolean isGpsOpening() {\r
+    return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);\r
+  }\r
 \r
   public void stopListen() {\r
     this.locationManager.removeNmeaListener(this);\r
index 4133d80..b685f0a 100644 (file)
@@ -25,7 +25,8 @@ public class Runtime {
   private boolean batteryLow;\r
   \r
   private boolean batterychanging;\r
-  \r
+\r
+\r
   public String belong;\r
   \r
   private File cacheDir;\r
@@ -90,7 +91,14 @@ public class Runtime {
 \r
   private heartRateStatus HRS=null;\r
 \r
+    private boolean FactoryTestingStat=false;\r
 \r
+    public void setFactoryTestingStat(boolean testing){\r
+        FactoryTestingStat=testing;\r
+    }\r
+    public boolean getFactoryTestingStat(){\r
+        return FactoryTestingStat;\r
+    }\r
   private boolean UseQueue=false;\r
   private boolean lockSimInfo=false;\r
 \r
index 1559b7d..8db02b4 100644 (file)
@@ -1,2 +1,2 @@
-#Wed Mar 18 17:40:12 CST 2020\r
-VERSION_CODE=379\r
+#Thu Mar 19 12:08:30 CST 2020\r
+VERSION_CODE=380\r