From ef2d7e990097e54917b492ae64a4d397d3a1a418 Mon Sep 17 00:00:00 2001 From: TrillGates Date: Wed, 4 Aug 2021 14:28:50 +0800 Subject: [PATCH] completed shoot text table. --- .../support/provider/ICDatabaseHelper.java | 28 ++++++++ .../java/com/ic/protocols/protocol_s123.java | 66 ++++++++++++++++++- 2 files changed, 93 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/enqualcomm/support/provider/ICDatabaseHelper.java b/app/src/main/java/com/enqualcomm/support/provider/ICDatabaseHelper.java index 5a3b60df..c9c6a87d 100644 --- a/app/src/main/java/com/enqualcomm/support/provider/ICDatabaseHelper.java +++ b/app/src/main/java/com/enqualcomm/support/provider/ICDatabaseHelper.java @@ -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) { //升级数据库 diff --git a/app/src/main/java/com/ic/protocols/protocol_s123.java b/app/src/main/java/com/ic/protocols/protocol_s123.java index ab969fc4..3687bc9e 100644 --- a/app/src/main/java/com/ic/protocols/protocol_s123.java +++ b/app/src/main/java/com/ic/protocols/protocol_s123.java @@ -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)); } -- 2.17.1