completed cmd response to server.
authorTrillGates <williamtrillgates@gmail.com>
Fri, 9 Apr 2021 12:38:27 +0000 (20:38 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Fri, 9 Apr 2021 12:38:27 +0000 (20:38 +0800)
app/src/main/java/com/enqualcomm/support/provider/FZDSettingsProvider.java
app/src/main/java/com/enqualcomm/support/service/Deliver.java
app/src/main/java/com/ic/protocols/protocol_fzd.java

index b66a5e3..cc286db 100644 (file)
@@ -82,8 +82,8 @@ public class FZDSettingsProvider extends ContentProvider {
                     writableDatabase.update(FZDDatabaseHelper.tSettings,
                             values, FZDDatabaseHelper.sKey + "=?",
                             new String[]{key});
-                    query.close();
                     targetUri = Uri.parse(SETTINGS + "/" + query.getInt(query.getColumnIndex(FZDDatabaseHelper.sId)));
+                    query.close();
                 } else {
                     ICLogger.d("do insert == > " + key);
                     //为了确保key唯一,没有在sql上加约束,所以先查询一下吧。如果有就走更新
index 1a61b49..9054703 100644 (file)
@@ -600,21 +600,16 @@ public class Deliver extends AbstractConnectionService {
                     }
                 }
             }, 500);
-
             return true;
         } else if ("findDev".equals(paramStringMessage.cmd())) {
-
-            mSendMSGHandler.postDelayed(new Runnable() {
-                @Override
-                public void run() {
-                    final Context context = (Deliver.this.mRuntime.getContextProxy()).context;
-                    Intent intent = new Intent();
-                    ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED + " " + paramStringMessage.isFromCache());
-                    //显示提示窗口
-                    intent.setAction(DIALOG_ACTION);
-                    intent.putExtra("findDev", "Find Device");
-                    context.sendBroadcast(intent);
-                }
+            mSendMSGHandler.postDelayed(() -> {
+                final Context context = (mRuntime.getContextProxy()).context;
+                Intent intent = new Intent();
+                ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED + " " + paramStringMessage.isFromCache());
+                //显示提示窗口
+                intent.setAction(DIALOG_ACTION);
+                intent.putExtra("findDev", "Find Device");
+                context.sendBroadcast(intent);
             }, 500);
 
             return true;
index c499443..283c695 100644 (file)
@@ -1557,7 +1557,7 @@ public class protocol_fzd {
             case CENTER:
                 ICLogger.d("收到中心号码设置--> " + data);
                 handleCENTER(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("CENTER", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.CENTER)));
                 break;
             case SILENCETIME2:
                 handleSILENCETIME2(mConnection, mRuntime, cmd, data);
@@ -1569,6 +1569,7 @@ public class protocol_fzd {
                 mConnection.DeliverCMDMessageToSystem("findDev", cmd);
                 break;
             case MESSAGE:
+                ICLogger.d("收到服务器发来的消息.");
                 handleMESSAGE(mConnection, data);
                 break;
             case WT:
@@ -1576,12 +1577,10 @@ public class protocol_fzd {
                 //ICLogger.d("WT--> DATA--> " + data);
                 //处理消息
                 handleWT(data);
-                mConnection.DeliverCMDMessageToSystem("WT", cmd);
                 break;
             case WT2:
                 ICLogger.d("收到请求的天气信息... WT2");
                 handleWT2(data);
-                mConnection.DeliverCMDMessageToSystem("WT2", cmd);
                 break;
             case WG:
                 ICLogger.d("收到请求的地理位置详细信息...WG");
@@ -1590,15 +1589,15 @@ public class protocol_fzd {
             case rcapture:
                 ICLogger.d("收到远程拍照的指令...rcapture");
                 handleCapture(mRuntime);
-                mConnection.DeliverCMDMessageToSystem("rcapture", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.rcapture)));
                 break;
             case CALL:
                 handleCALL(data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("CALL", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.CALL)));
                 break;
             case MONITOR:
                 handleMONITOR(mRuntime);
-                mConnection.DeliverCMDMessageToSystem("MONITOR", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.MONITOR)));
                 break;
             case TKQ:
                 ICLogger.d("服务器收到客户端请求离线语音的指令.");
@@ -1606,82 +1605,82 @@ public class protocol_fzd {
             case DLT:
                 ICLogger.d("收到服务器解绑消息.");
                 //TODO:煌城的是重置机器
-                mConnection.DeliverCMDMessageToSystem("DLT", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.DLT)));
                 break;
             case FLOWER:
                 ICLogger.d("收到服务器发来的小红花");
                 handleFollow(data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("FLOWER", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.FLOWER)));
                 break;
             case INFO:
                 ICLogger.d("收到服务器更改开关配置信息.");
                 handleSettingsInfo(data);
-                mConnection.DeliverCMDMessageToSystem("INFO", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.INFO)));
                 break;
             case LOWBAT:
                 ICLogger.d("收到低电量警报的开关设置");
                 handleSettings(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("LOWBAT", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.LOWBAT)));
                 break;
             case SOSSMS:
                 ICLogger.d("收到SOS短信警报开关设置");
                 handleSettings(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("SOSSMS", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.SOSSMS)));
                 break;
             case REMOVE:
                 ICLogger.d("收到表带的警报开关设置");
                 handleSettings(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("REMOVE", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.REMOVE)));
                 break;
             case WLKEY:
                 ICLogger.d("收到白名单功能开关设置");
                 handleSettings(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("WLKEY", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.WLKEY)));
                 break;
             case KEYBRD:
                 ICLogger.d("收到拨号盘开关设置");
                 handleSettings(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("KEYBRD", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.KEYBRD)));
                 break;
             case FALLDOWN:
                 ICLogger.d("收到跌倒报警开关设置");
                 handleSettings(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("FALLDOWN", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.FALLDOWN)));
                 break;
             case SHAKE:
                 ICLogger.d("收到震动提醒开关设置");
                 handleSettings(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("SHAKE", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.SHAKE)));
                 break;
             case PEDO:
                 ICLogger.d("收到计步功能开关设置");
                 handleSettings(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("PEDO", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.PEDO)));
                 break;
             case FACTORY:
                 ICLogger.d("收到重置系统指令");
                 handleFACTORY(mRuntime);
-                mConnection.DeliverCMDMessageToSystem("FACTORY", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.FACTORY)));
                 break;
             case SLEEPTIME:
                 ICLogger.d("收到服务器发来的翻转检测时间设置");
                 handleSLEEPTIME(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("SLEEPTIME", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.SLEEPTIME)));
                 break;
             case REMIND:
                 ICLogger.d("收到闹钟设置指令");
                 handleREMIND(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("REMIND", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.REMIND)));
                 break;
             case profile:
                 ICLogger.d("收到情景模式设置指令");
                 handleProfile(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("profile", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.profile)));
                 break;
             case BOOTOFF:
                 ICLogger.d("收到开关机时间设置指令");
                 handleBOOTOFF(cmd, data, mRuntime);
-                mConnection.DeliverCMDMessageToSystem("BOOTOFF", cmd);
+                mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.BOOTOFF)));
                 break;
         }
         return ret;