completed shoot text table.
authorTrillGates <williamtrillgates@gmail.com>
Wed, 4 Aug 2021 06:28:50 +0000 (14:28 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Wed, 4 Aug 2021 06:28:50 +0000 (14:28 +0800)
app/src/main/java/com/enqualcomm/support/provider/ICDatabaseHelper.java
app/src/main/java/com/ic/protocols/protocol_s123.java

index 5a3b60d..c9c6a87 100644 (file)
@@ -254,6 +254,24 @@ public class ICDatabaseHelper extends SQLiteOpenHelper {
                 " date)";
         ICLogger.d(createNotification);
         db.execSQL(createNotification);
+        //创建快捷回复表
+        String createShoot = "create table " +
+                tb_shoot_text_list +
+                " (" +
+                shoot_id +
+                " integer primary key autoincrement, " +
+                shoot_type +
+                " text, " +
+                shoot_value +
+                " text, " +
+                shoot_order +
+                " integer, " +
+                shoot_create_time +
+                " date, " +
+                shoot_update_time +
+                " date)";
+        ICLogger.d(createShoot);
+        db.execSQL(createShoot);
     }
 
     //闹钟数据库
@@ -298,6 +316,16 @@ public class ICDatabaseHelper extends SQLiteOpenHelper {
     public static final String notification_order = "`order`";
     public static final String notification_create_time = "create_time";
 
+
+    //快捷回复数据库
+    public static final String tb_shoot_text_list = "shoot_text_list";
+    public static final String shoot_id = "_id";
+    public static final String shoot_type = "type";
+    public static final String shoot_value = "value";
+    public static final String shoot_order = "`order`";
+    public static final String shoot_create_time = "create_time";
+    public static final String shoot_update_time = "update_time";
+
     @Override
     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
         //升级数据库
index ab969fc..3687bc9 100644 (file)
@@ -219,6 +219,8 @@ public class protocol_s123 {
         APIP,
         BPWF,//WIFI设置
         APWF,
+        BPSM,//快捷回复指令
+        APSM,
         UNKNOWN_CMD,
     }
 
@@ -353,6 +355,8 @@ public class protocol_s123 {
         cmdMap.put(CMD_TYPE.APIP, "APIP");
         cmdMap.put(CMD_TYPE.BPWF, "BPWF");
         cmdMap.put(CMD_TYPE.APWF, "APWF");
+        cmdMap.put(CMD_TYPE.BPSM, "BPSM");
+        cmdMap.put(CMD_TYPE.APSM, "APSM");
     }
 
 
@@ -3491,6 +3495,10 @@ public class protocol_s123 {
                 ICLogger.d("收到服务器设置WIFI的指令.");
                 handleBPWF(cmd);
                 break;
+            case BPSM:
+                ICLogger.d("收到服务器设置快捷短语的指令.");
+                handleBPSM(cmd);
+                break;
             case APTM:
                 break;
             case APCH:
@@ -3587,17 +3595,72 @@ public class protocol_s123 {
                 break;
             case AP47:
                 break;
+            case APMK:
+                break;
             case APGJ:
                 break;
             case APFX:
                 break;
             case UNKNOWN_CMD:
                 break;
+            case APPH:
+                break;
+            case APSS:
+                break;
+            case APAP:
+                break;
+            case APIP:
+                break;
+            case APWF:
+                break;
+            case APSM:
+                break;
         }
 
         return ret;
     }
 
+    /**
+     * IWBPSM,353456789012345,080835,1,2,4f60597dff0c8fd991cc6b635e383002@5f0059cb4e0a8bfe3002#
+     * 快捷指令语设置
+     * IW:标识符
+     * BPSM: 命令字符
+     * 353456789012345:IMEI号,设备唯一ID
+     * 080835 :指令流水号
+     * 1:快捷回复内容类型;1:签到快捷回复内容, 2:短信快捷回复内容(发短信用,与平台无关),3:Web(APP)快捷回复内容。
+     * 2: 快捷回复内容条数。
+     * 4f60597dff0c8fd991cc6b635e383002:
+     * 一条快捷回复内容(你好,这里正常。),单条内容独立转Unicode编码
+     * 多条内容分别转Unicode编码再用@隔开,最多10条。
+     *
+     * @param cmd
+     */
+    private void handleBPSM(String cmd) {
+        String[] split = cmd.split(CMDSPLIT);
+        if (split.length == 6) {
+
+            String id = split[2];
+            String type = split[3];
+            String count = split[4];
+            String contentStr = split[5];
+            //对内容进行切割
+            int countInt = Integer.parseInt(count);
+            ICLogger.d("countInt==> " + countInt);
+            String[] contentArray = contentStr.split("@");
+            for (String s : contentArray) {
+                ICLogger.d("item data==> " + Util.decodeUnicode2Utf8(s));
+                //TODO:入库
+            }
+            //回复
+            //IWAPSM,080835, 1#
+            //080835: 设备响应的时候带上响应流水号
+            //1: 快捷回复内容类型。
+            responseWithId(cmdMap.get(CMD_TYPE.APSM), id, type);
+        } else {
+            ICLogger.d("parse error=> " + cmd);
+        }
+    }
+
     /**
      * 设置WIFI数据
      * IWBPWF,353456789012345,080835,SSIDName,Password,psk#
@@ -3885,7 +3948,8 @@ public class protocol_s123 {
                 //设置麦克风开关
                 //根据值去开关麦克风
                 //UI状态栏是否需要去显示Icon没有说明嗷
-                AudioManager audioManager = (AudioManager) mRuntime.getContextProxy().context.getSystemService(Context.AUDIO_SERVICE);
+                AudioManager audioManager = (AudioManager) mRuntime.getContextProxy()
+                        .context.getSystemService(Context.AUDIO_SERVICE);
                 if (audioManager != null) {
                     audioManager.setMicrophoneMute("1".equals(value));
                 }