\r
public void waitAndSendLocation(){\r
\r
-\r
+ long timeCost=0L;\r
wifi_ok=false;\r
gps_ok=false;\r
lbs_ok=false;\r
\r
\r
//GPS 优先的话多给些时间(10秒)\r
- if (checktimes> 50 ||\r
- ((startCheckTime!=0L)&&(System.currentTimeMillis()-startCheckTime > 50*1000L)) //有时timer计数不准,则根据实际时间计算\r
- ) timeout=true;\r
+ if (checktimes> 50 )\r
+ {\r
+ ICLogger.i("waitAndSendLocation "+checktimes+" timeout");\r
+ timeout=true;\r
+ }\r
+ timeCost=System.currentTimeMillis()-startCheckTime;\r
+ if ((startCheckTime!=0L)&& (timeCost> 50*1000L)){\r
+ //有时timer计数不准,则根据实际时间计算\r
+ ICLogger.i("waitAndSendLocation "+timeCost+"> 50000ms timeout");\r
+ timeout=true;\r
+ }\r
\r
// lbs only +timeout, lbs+wifi+gpsNosignal, libs+ , lbs+gps+wifi, Timeout can override wifi and gps\r
if ((lbs_ok && timeout==true)\r
runtime.getLocationInstance().setLocationType(locationtype);\r
runtime.getLocationInstance().setLocationTime(TimeUtil.getSystemTime3());\r
\r
- String msg="Location Fixed Type "+runtime.getLocationInstance().getLocationType()+" at "+runtime.getLocationInstance().getLocationTime();\r
+ String msg="Location Fixed Type "+runtime.getLocationInstance().getLocationType()+" at "+runtime.getLocationInstance().getLocationTime()+" timeout "+timeout;\r
ICLogger.i(msg);\r
\r
if (Config.LOG_TOFILE)\r
- FileOutputUtil.fileOutput(this.runtime.getCacheDir(),"GPS",msg);\r
+ ICLogger.logToFile("GPS",msg);\r
\r
\r
}else if (timeout==true){\r
ICLogger.i("timeout no location ");\r
stopCheckLocationResult();\r
if (Config.LOG_TOFILE)\r
- FileOutputUtil.fileOutput(this.runtime.getCacheDir(),"GPS","timeout no location ");\r
+ ICLogger.logToFile("GPS","timeout no location ");\r
}\r
break;\r
\r
case ICLocation.LOWPOWER_MOD:\r
default:\r
//wifi优先的话给20秒时间\r
- if (checktimes> 20 ||\r
- ((startCheckTime!=0L)&&(System.currentTimeMillis()-startCheckTime > 20*1000L)) //有时timer计数不准,则根据实际时间计算\r
- ) timeout=true;\r
+\r
+ if (checktimes> 20 )\r
+ {\r
+ ICLogger.i("waitAndSendLocation "+checktimes+" timeout");\r
+ timeout=true;\r
+ }\r
+ timeCost=System.currentTimeMillis()-startCheckTime;\r
+ if ((startCheckTime!=0L)&& (timeCost> 20*1000L)){\r
+ //有时timer计数不准,则根据实际时间计算\r
+ ICLogger.i("waitAndSendLocation "+timeCost+"> 20000ms timeout");\r
+ timeout=true;\r
+ }\r
\r
if ((lbs_ok && timeout==true) ||(lbs_ok && wifi_ok )){\r
\r
runtime.getLocationInstance().setLocationType(locationtype);\r
runtime.getLocationInstance().setLocationTime(TimeUtil.getSystemTime3());\r
\r
- String msg="Location Fixed Type "+runtime.getLocationInstance().getLocationType()+" at "+runtime.getLocationInstance().getLocationTime();\r
+ String msg="Location Fixed Type "+runtime.getLocationInstance().getLocationType()+" at "+runtime.getLocationInstance().getLocationTime()+" timeout "+timeout;\r
ICLogger.i(msg);\r
\r
if (Config.LOG_TOFILE)\r
- FileOutputUtil.fileOutput(this.runtime.getCacheDir(),"GPS",msg);\r
+ ICLogger.logToFile("GPS",msg);\r
\r
\r
}else if (timeout==true){\r
ICLogger.i("timeout no location ");\r
stopCheckLocationResult();\r
if (Config.LOG_TOFILE)\r
- FileOutputUtil.fileOutput(this.runtime.getCacheDir(),"GPS","timeout no location ");\r
+ ICLogger.logToFile("GPS","timeout no location ");\r
}\r
break;\r
}\r
startWifiScan();\r
switch(mod){\r
case ICLocation.CUSTOM_MOD:\r
- if(runtime.getLocationInstance().getLocation_cycle()<60){\r
+ if(runtime.getLocationInstance().getLocation_cycle()<=60){\r
nmeaListener.setNoStop(true);\r
}else{\r
nmeaListener.setNoStop(false);\r
break;\r
case ICLocation.EMERGNECY_MOD:\r
case ICLocation.REALTIME_MOD:\r
- nmeaListener.setNoStop(false);//保证从Custom切换回来的时候不至于不关闭gps\r
+ nmeaListener.setNoStop(true);\r
+// nmeaListener.setNoStop(false);//保证从Custom切换回来的时候不至于不关闭gps\r
startGpsLocate();\r
break;\r
case ICLocation.LOWPOWER_MOD:\r