|
@@ -11,6 +11,7 @@ import android.content.Intent;
|
|
|
import android.content.pm.PackageManager;
|
|
|
import android.net.Uri;
|
|
|
import android.os.Build;
|
|
|
+import android.os.Environment;
|
|
|
import android.os.Vibrator;
|
|
|
import android.provider.Settings;
|
|
|
import android.support.annotation.NonNull;
|
|
@@ -82,11 +83,11 @@ public class APIModuleGis extends UZModule {
|
|
|
private UZModuleContext mJsCallback;
|
|
|
private MyTextView mMyTextView;
|
|
|
|
|
|
- private volatile String wgslng = "0.0";
|
|
|
- private volatile String wgslat = "0.0";
|
|
|
- private volatile String wgsblh = "0.0";
|
|
|
+ private volatile static String wgslng = "0.0";
|
|
|
+ private volatile static String wgslat = "0.0";
|
|
|
+ private volatile static String wgsblh = "0.0";
|
|
|
|
|
|
- private volatile String postType = "";
|
|
|
+ private volatile static String postType = "";
|
|
|
|
|
|
public APIModuleGis(UZWebView webView) {
|
|
|
super(webView);
|
|
@@ -97,6 +98,19 @@ public class APIModuleGis extends UZModule {
|
|
|
|
|
|
private volatile static String logCorsCod = "";//连接状态:0登录成功 1:登录失败
|
|
|
|
|
|
+ private void initData(){
|
|
|
+ wgslng = "0.0";
|
|
|
+ wgslat = "0.0";
|
|
|
+ wgsblh = "0.0";
|
|
|
+ postType = "";
|
|
|
+ ramRtkName = null;
|
|
|
+ ramIp = null;
|
|
|
+ ramPort = null;
|
|
|
+ ramMountName = null;
|
|
|
+ ramCorsUserName = null;
|
|
|
+ ramCorsPassword = null;
|
|
|
+ }
|
|
|
+
|
|
|
//TODO Lx 统一断开所有的服务
|
|
|
public ModuleResult jsmethod_stopAllService_sync(final UZModuleContext context){
|
|
|
JSONObject res = new JSONObject();
|
|
@@ -128,7 +142,7 @@ public class APIModuleGis extends UZModule {
|
|
|
try {
|
|
|
res.put("code",code);
|
|
|
res.put("msg",msg);
|
|
|
- res.put("version","1.1.0");
|
|
|
+ res.put("version","1.1.7");
|
|
|
|
|
|
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
|
|
if (adapter == null) {
|
|
@@ -184,6 +198,9 @@ public class APIModuleGis extends UZModule {
|
|
|
code = "0";
|
|
|
res.put("code", code);
|
|
|
JSONObject gisObj = new JSONObject();
|
|
|
+ Log.i(TAG+"test",wgslat);
|
|
|
+ Log.i(TAG+"test",wgslng);
|
|
|
+ Log.i(TAG+"test",wgsblh);
|
|
|
if(!"0.0".equals(wgslat)&&!"0.0".equals(wgslng)) {
|
|
|
gisObj.put("wgslat", wgslat);
|
|
|
gisObj.put("wgslng", wgslng);
|
|
@@ -201,6 +218,11 @@ public class APIModuleGis extends UZModule {
|
|
|
gisObj.put("connectCode",connectCode);
|
|
|
gisObj.put("logCorsCod",logCorsCod);
|
|
|
|
|
|
+ if("1".equals(connectCode)||"1".equals(bindCode)){
|
|
|
+ initData();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//TODO 当前连接的信息
|
|
|
gisObj.put("ramRtkName",ramRtkName);//RTK设备名称
|
|
|
gisObj.put("ramIp",ramIp);//corsIp
|
|
@@ -215,7 +237,8 @@ public class APIModuleGis extends UZModule {
|
|
|
// String rtkName = context.optString("rtkName");
|
|
|
//TODO cors相关判断 , 全传就登录, 有一个没传就不登
|
|
|
String ip = context.optString("ip");
|
|
|
- Integer port = Integer.valueOf(context.optString("port"));
|
|
|
+ Integer port = Integer.valueOf(context.optString("port")!=null&&
|
|
|
+ context.optString("port").length()>0?context.optString("port"):"0");
|
|
|
String mountName = context.optString("mountName");
|
|
|
String userName = context.optString("userName");
|
|
|
String passWord = context.optString("passWord");
|
|
@@ -267,6 +290,7 @@ public class APIModuleGis extends UZModule {
|
|
|
||(passWord!=null&&!passWord.equals(ramCorsPassword))){
|
|
|
//TODO 有一个条件不一致就要重连 cors
|
|
|
DiffConnectManager.loginOutCors(this.context());
|
|
|
+ logCorsCod = "1";
|
|
|
if(ip!=null&&ip.length()>0&&
|
|
|
port!=null&&
|
|
|
mountName!=null&&mountName.length()>0&&
|
|
@@ -274,15 +298,22 @@ public class APIModuleGis extends UZModule {
|
|
|
passWord!=null&&passWord.length()>0){
|
|
|
//TODO 重连必须满足以上条件
|
|
|
DiffConnectManager.loginCors(this.context(),ip,port,mountName,userName,passWord);
|
|
|
- ramIp = ip;
|
|
|
- ramPort = port;
|
|
|
- ramMountName = mountName;
|
|
|
- ramCorsUserName = userName;
|
|
|
- ramCorsPassword = passWord;
|
|
|
}
|
|
|
}
|
|
|
+ ramRtkName = rtkName;
|
|
|
+ ramIp = ip;
|
|
|
+ ramPort = port;
|
|
|
+ ramMountName = mountName;
|
|
|
+ ramCorsUserName = userName;
|
|
|
+ ramCorsPassword = passWord;
|
|
|
}catch (Exception ex){
|
|
|
Log.i(TAG,ex.getLocalizedMessage());
|
|
|
+ try {
|
|
|
+ res.put("msg", ex.getLocalizedMessage());
|
|
|
+ }catch(Exception e){
|
|
|
+ e.getLocalizedMessage();
|
|
|
+ }
|
|
|
+ return new ModuleResult(res);
|
|
|
}
|
|
|
return new ModuleResult(res);
|
|
|
}
|
|
@@ -688,7 +719,8 @@ public class APIModuleGis extends UZModule {
|
|
|
}
|
|
|
//TODO cors相关判断 , 全传就登录, 有一个没传就不登
|
|
|
String ip = moduleContext.optString("ip");
|
|
|
- Integer port = Integer.valueOf(moduleContext.optString("port"));
|
|
|
+ Integer port = Integer.valueOf(moduleContext.optString("port")!=null&&
|
|
|
+ moduleContext.optString("port").length()>0?moduleContext.optString("port"):"0");
|
|
|
String mountName = moduleContext.optString("mountName");
|
|
|
String userName = moduleContext.optString("userName");
|
|
|
String passWord = moduleContext.optString("passWord");
|
|
@@ -767,11 +799,6 @@ public class APIModuleGis extends UZModule {
|
|
|
passWord!=null&&passWord.length()>0){
|
|
|
//TODO 重连必须满足以上条件
|
|
|
DiffConnectManager.loginCors(thisContext,ip,port,mountName,userName,passWord);
|
|
|
- ramIp = ip;
|
|
|
- ramPort = port;
|
|
|
- ramMountName = mountName;
|
|
|
- ramCorsUserName = userName;
|
|
|
- ramCorsPassword = passWord;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -889,26 +916,25 @@ public class APIModuleGis extends UZModule {
|
|
|
Log.i(TAG,"" + gnssinfo.staUseCount + "/" + gnssinfo.staCount);
|
|
|
postType = String.valueOf(gnssinfo.posType);
|
|
|
Log.i(TAG,String.valueOf(gnssinfo.posType));
|
|
|
- if (gnssinfo.posType!=6) {
|
|
|
- if("0".equals(logCorsCod)){
|
|
|
- if(gnssinfo.posType!=4) {
|
|
|
- wgslat = String.valueOf(gnssinfo.latitude);
|
|
|
- wgslng = String.valueOf(gnssinfo.longitude);
|
|
|
- wgsblh = String.valueOf(gnssinfo.altitude);
|
|
|
- }
|
|
|
- }else {
|
|
|
- wgslat = String.valueOf(gnssinfo.latitude);
|
|
|
- wgslng = String.valueOf(gnssinfo.longitude);
|
|
|
- wgsblh = String.valueOf(gnssinfo.altitude);
|
|
|
- }
|
|
|
- }
|
|
|
- if (gnssinfo.time != null && !gnssinfo.time.isEmpty()) {
|
|
|
- //format在使用之前必须加TimeZone.getDefault();
|
|
|
- long longtime = TimeZone.getDefault().getRawOffset() + Long.parseLong(gnssinfo.time);
|
|
|
- format.setTimeZone(TimeZone.getDefault());
|
|
|
- String time = format.format(new Date(longtime));
|
|
|
- Log.i(TAG,time);
|
|
|
- }
|
|
|
+// if (gnssinfo.posType!=6) {
|
|
|
+// if("0".equals(logCorsCod)){
|
|
|
+// if(gnssinfo.posType!=4) {
|
|
|
+// wgslat = String.valueOf(gnssinfo.latitude);
|
|
|
+// wgslng = String.valueOf(gnssinfo.longitude);
|
|
|
+// wgsblh = String.valueOf(gnssinfo.altitude);
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// wgslat = String.valueOf(gnssinfo.latitude);
|
|
|
+// wgslng = String.valueOf(gnssinfo.longitude);
|
|
|
+// wgsblh = String.valueOf(gnssinfo.altitude);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ wgslat = String.valueOf(gnssinfo.latitude);
|
|
|
+ wgslng = String.valueOf(gnssinfo.longitude);
|
|
|
+ wgsblh = String.valueOf(gnssinfo.altitude);
|
|
|
+ Log.i(TAG+"test22",wgslat);
|
|
|
+ Log.i(TAG+"test22",wgslng);
|
|
|
+ Log.i(TAG+"test22",wgsblh);
|
|
|
}
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN,sticky =true)
|