|
@@ -8,6 +8,7 @@ import android.content.Context;
|
|
import android.content.DialogInterface;
|
|
import android.content.DialogInterface;
|
|
import android.content.DialogInterface.OnClickListener;
|
|
import android.content.DialogInterface.OnClickListener;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
|
+import android.content.IntentFilter;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.pm.PackageManager;
|
|
import android.net.Uri;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.os.Build;
|
|
@@ -29,6 +30,7 @@ import android.widget.Toast;
|
|
import com.example.moduleGis.gnsstest.DiffConnectManager;
|
|
import com.example.moduleGis.gnsstest.DiffConnectManager;
|
|
import com.example.moduleGis.gnsstest.GnssListener;
|
|
import com.example.moduleGis.gnsstest.GnssListener;
|
|
import com.example.moduleGis.gnsstest.GnssServiceManager;
|
|
import com.example.moduleGis.gnsstest.GnssServiceManager;
|
|
|
|
+import com.example.moduleGis.gnsstest.ReceiveLocationBroadcastReceiver;
|
|
import com.example.moduleGis.gnsstest.ReceiverConnectProxy;
|
|
import com.example.moduleGis.gnsstest.ReceiverConnectProxy;
|
|
import com.example.moduleGis.gnsstest.consts.BleStatusDefine;
|
|
import com.example.moduleGis.gnsstest.consts.BleStatusDefine;
|
|
import com.example.moduleGis.gnsstest.event.GnssConnectStatusEvent;
|
|
import com.example.moduleGis.gnsstest.event.GnssConnectStatusEvent;
|
|
@@ -58,8 +60,10 @@ import org.json.JSONObject;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Locale;
|
|
import java.util.Locale;
|
|
|
|
+import java.util.Map;
|
|
import java.util.TimeZone;
|
|
import java.util.TimeZone;
|
|
import java.util.Timer;
|
|
import java.util.Timer;
|
|
import java.util.TimerTask;
|
|
import java.util.TimerTask;
|
|
@@ -116,6 +120,69 @@ public class APIModuleGis extends UZModule {
|
|
gnssInfoJson = "";
|
|
gnssInfoJson = "";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ReceiveLocationBroadcastReceiver myReceiver;
|
|
|
|
+
|
|
|
|
+ //TODO Lx 启动广播接收
|
|
|
|
+ public ModuleResult jsmethod_startCeditongIntent_sync(final UZModuleContext context){
|
|
|
|
+ JSONObject res = new JSONObject();
|
|
|
|
+ try {
|
|
|
|
+ if (myReceiver!=null){
|
|
|
|
+ this.context().unregisterReceiver(myReceiver);
|
|
|
|
+ }
|
|
|
|
+ myReceiver=new ReceiveLocationBroadcastReceiver();
|
|
|
|
+ IntentFilter intentFilter=new IntentFilter();
|
|
|
|
+ intentFilter.addAction("com.huace.landstar.api.action");
|
|
|
|
+ this.context().registerReceiver(myReceiver,intentFilter);
|
|
|
|
+ res.put("code", "0");
|
|
|
|
+ res.put("msg", "");
|
|
|
|
+ }catch(Exception ex){
|
|
|
|
+ Log.e(TAG,ex.getLocalizedMessage());
|
|
|
|
+ }
|
|
|
|
+ return new ModuleResult(res);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //TODO 获取广播经纬度
|
|
|
|
+ public ModuleResult jsmethod_getIntentGis_sync(final UZModuleContext context){
|
|
|
|
+ JSONObject res = new JSONObject();
|
|
|
|
+ try {
|
|
|
|
+ res.put("code", "1");
|
|
|
|
+ res.put("msg", "");
|
|
|
|
+ res.put("version", "1.2.3");
|
|
|
|
+
|
|
|
|
+ //TODO 逻辑块
|
|
|
|
+ Map<String,Object> dataMap = new HashMap<>();
|
|
|
|
+ dataMap.put("wgslng",ReceiveLocationBroadcastReceiver.wgslng);
|
|
|
|
+ dataMap.put("wgslat",ReceiveLocationBroadcastReceiver.wgslat);
|
|
|
|
+ dataMap.put("wgsblh",ReceiveLocationBroadcastReceiver.wgsblh);
|
|
|
|
+ dataMap.put("solveStatus",ReceiveLocationBroadcastReceiver.solveStatus);
|
|
|
|
+ dataMap.put("conenctItent",ReceiveLocationBroadcastReceiver.conenctItent);
|
|
|
|
+
|
|
|
|
+ ReceiveLocationBroadcastReceiver.wgslng = "";
|
|
|
|
+ ReceiveLocationBroadcastReceiver.wgslat = "";
|
|
|
|
+ ReceiveLocationBroadcastReceiver.wgsblh = "";
|
|
|
|
+ ReceiveLocationBroadcastReceiver.solveStatus = "";
|
|
|
|
+ ReceiveLocationBroadcastReceiver.conenctItent = "1";
|
|
|
|
+ res.put("code","0");
|
|
|
|
+ res.put("data", com.qx.wz.external.fastjson.JSONObject.toJSONString(dataMap));
|
|
|
|
+ }catch(Exception ex){
|
|
|
|
+ Log.e(TAG,ex.getLocalizedMessage());
|
|
|
|
+ }
|
|
|
|
+ return new ModuleResult(res);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //TODO LX 释放广播接收器
|
|
|
|
+ public ModuleResult jsmethod_stopCeditongIntent_sync(final UZModuleContext context){
|
|
|
|
+ JSONObject res = new JSONObject();
|
|
|
|
+ try {
|
|
|
|
+ res.put("code", "0");
|
|
|
|
+ res.put("msg", "");
|
|
|
|
+ this.context().unregisterReceiver(myReceiver);
|
|
|
|
+ }catch(Exception ex){
|
|
|
|
+ Log.e(TAG,ex.getLocalizedMessage());
|
|
|
|
+ }
|
|
|
|
+ return new ModuleResult(res);
|
|
|
|
+ }
|
|
|
|
+
|
|
//TODO Lx 统一断开所有的服务
|
|
//TODO Lx 统一断开所有的服务
|
|
public ModuleResult jsmethod_stopAllService_sync(final UZModuleContext context){
|
|
public ModuleResult jsmethod_stopAllService_sync(final UZModuleContext context){
|
|
JSONObject res = new JSONObject();
|
|
JSONObject res = new JSONObject();
|
|
@@ -313,7 +380,7 @@ public class APIModuleGis extends UZModule {
|
|
userName!=null&&userName.length()>0&&
|
|
userName!=null&&userName.length()>0&&
|
|
passWord!=null&&passWord.length()>0){
|
|
passWord!=null&&passWord.length()>0){
|
|
//TODO 重连必须满足以上条件
|
|
//TODO 重连必须满足以上条件
|
|
- if(!"0".equals(logCorsCod)&&!"1".equals(logCorsStatus)) {
|
|
|
|
|
|
+ if("0".equals(connectCode)&&!"0".equals(logCorsCod)&&!"1".equals(logCorsStatus)) {
|
|
DiffConnectManager.loginCors(this.context(), ip, port, mountName, userName, passWord, diffType, stationId, type);
|
|
DiffConnectManager.loginCors(this.context(), ip, port, mountName, userName, passWord, diffType, stationId, type);
|
|
}
|
|
}
|
|
}
|
|
}
|