|
|
@@ -320,6 +320,7 @@ public class ControlActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
protected void bindSocketService() {
|
|
|
+
|
|
|
sc = new ServiceConnection() {
|
|
|
@Override
|
|
|
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
|
|
@@ -331,7 +332,6 @@ public class ControlActivity extends BaseActivity {
|
|
|
}
|
|
|
};
|
|
|
socketIntent = new Intent(getApplicationContext(), SocketService.class);
|
|
|
- startService(socketIntent);
|
|
|
bindService(socketIntent, sc, BIND_AUTO_CREATE);
|
|
|
}
|
|
|
|
|
|
@@ -434,12 +434,22 @@ public class ControlActivity extends BaseActivity {
|
|
|
case "cdw":
|
|
|
rs = socketService.sendData("Hcdw,"+id+","+args[0]+"T");
|
|
|
if(rs){
|
|
|
- socketService.checkID.put(id, new String[]{"重定位成功", "重定位失败"});
|
|
|
+ Map<String, String> msg = new HashMap<>();
|
|
|
+ msg.put("1T", "重定位成功");
|
|
|
+ msg.put("2T", "重定位失败");
|
|
|
+ socketService.checkID.put(id, msg);
|
|
|
checkCDW(id, 3);
|
|
|
}
|
|
|
break;
|
|
|
case "cdwtx":
|
|
|
- socketService.sendData("Hcdwtx,"+id+",T");
|
|
|
+ rs = socketService.sendData("Hcdwtx,"+id+",T");
|
|
|
+ break;
|
|
|
+ case "qrdw":
|
|
|
+ Map<String, String> msg = new HashMap<>();
|
|
|
+ msg.put("0T", "定位成功");
|
|
|
+ msg.put("1T", "定位失败");
|
|
|
+ socketService.checkID.put(id, msg);
|
|
|
+ rs = socketService.sendData("qrdw,"+id+",T");
|
|
|
break;
|
|
|
}
|
|
|
if(!rs){
|
|
|
@@ -473,7 +483,6 @@ public class ControlActivity extends BaseActivity {
|
|
|
try {
|
|
|
String value = params.get(position).get("value");
|
|
|
sendCommand("cdw",value);
|
|
|
- ToastUtils.showToast(context, "重定位发送成功");
|
|
|
popupWindow.dismiss();
|
|
|
}catch (Exception ex){
|
|
|
mylog.error("选择位置异常", ex);
|
|
|
@@ -522,11 +531,11 @@ public class ControlActivity extends BaseActivity {
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
super.onDestroy();
|
|
|
- if(socketIntent != null) {
|
|
|
- stopService(socketIntent);
|
|
|
- }
|
|
|
if(sc!=null) {
|
|
|
unbindService(sc);
|
|
|
}
|
|
|
+ if(socketIntent != null) {
|
|
|
+ stopService(socketIntent);
|
|
|
+ }
|
|
|
}
|
|
|
}
|