From 1b8164d97200ce08486b48ba179b83c5d70bd97b Mon Sep 17 00:00:00 2001
From: lizhanwei <Dana_Lee1016@126.com>
Date: 星期二, 18 二月 2020 21:05:55 +0800
Subject: [PATCH] app启动发送信号配置
---
/dev/null | 51 ------------
app/src/main/java/safeluck/drive/evaluation/MainActivity.java | 68 ++++++++++++++++
app/src/main/java/safeluck/drive/evaluation/im/IMSEventListener.java | 10 --
app/src/main/java/safeluck/drive/evaluation/fragment/SignalConfigFragment.java | 39 ---------
app/src/main/java/safeluck/drive/evaluation/im/MessageProcessor.java | 19 ----
5 files changed, 68 insertions(+), 119 deletions(-)
diff --git a/app/src/main/java/safeluck/drive/evaluation/MainActivity.java b/app/src/main/java/safeluck/drive/evaluation/MainActivity.java
index afb7b18..edac8ba 100644
--- a/app/src/main/java/safeluck/drive/evaluation/MainActivity.java
+++ b/app/src/main/java/safeluck/drive/evaluation/MainActivity.java
@@ -5,6 +5,7 @@
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
@@ -21,6 +22,9 @@
import safeluck.drive.evaluation.DB.WokViewModel;
import safeluck.drive.evaluation.DB.rtktb.RTKConfig;
import safeluck.drive.evaluation.DB.rtktb.RTKConfigViewModel;
+import safeluck.drive.evaluation.DB.signalConfigdb.SignalConfigViewModel;
+import safeluck.drive.evaluation.DB.signalConfigdb.SingalConfig;
+import safeluck.drive.evaluation.bean.SignalConfigRemote;
import safeluck.drive.evaluation.cEventCenter.CEventCenter;
import safeluck.drive.evaluation.cEventCenter.ICEventListener;
import safeluck.drive.evaluation.fragment.HomeFragment;
@@ -35,7 +39,9 @@
import java.io.IOException;
import java.nio.charset.Charset;
+import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.ArrayBlockingQueue;
import safeluck.drive.evaluation.util.CThreadPoolExecutor;
import safeluck.drive.evaluation.util.FileUtil;
@@ -48,7 +54,7 @@
private static final int PERMISSIONS_REQUEST_CODE = 1001;
private String TAG = MainActivity.class.getCanonicalName();
-
+ SignalConfigViewModel signalConfigViewModel;
private PermissionManager mPermissionsManager;
private RTKConfig mRTKConfig;//RTK閰嶇疆淇℃伅
private Gson gson = new Gson();
@@ -81,10 +87,12 @@
}
if (msgCode == Constant.NDK_START){
sendRtkConfigInfo();
+ sendSignalConfigsToRemote();
sendMcuUprgrade();
}
}
};
+ private List<SignalConfigRemote> signalConfiglist = new ArrayList<>();
private void sendMcuUprgrade() {
CThreadPoolExecutor.runInBackground(new Runnable() {
@@ -166,7 +174,23 @@
}
});
+ signalConfigViewModel = ViewModelProviders.of(this).get(SignalConfigViewModel.class);
+ signalConfigViewModel.getSignalConfigs().observe(this, new Observer<List<SingalConfig>>() {
+ @Override
+ public void onChanged(List<SingalConfig> singalConfigs) {
+ signalConfiglist.clear();
+ MyLog.i(TAG, "淇″彿閰嶇疆鍙戠敓鍙樺寲");
+ for (int i = 0; i < singalConfigs.size(); i++) {
+ SignalConfigRemote signalConfigRemote = new SignalConfigRemote();
+ signalConfigRemote.setFunc_id(i);
+ signalConfigRemote.setGpio_num(singalConfigs.get(i).getIndex());
+ signalConfigRemote.setLevel(singalConfigs.get(i).getHighLevel());
+ signalConfiglist.add(signalConfigRemote);
+ }
+ sendSignalConfigsToRemote();
+ }
+ });
mPermissionsManager = new PermissionManager(this) {
@Override
@@ -215,6 +239,32 @@
CEventCenter.onBindEvent(false, icEventListener, Constant.BIND_CONNECT_RTK_TOPIC);
Log.i(TAG, "onDestroy: ");
}
+ private void sendSignalConfigsToRemote() {
+ if (signalConfiglist.size()>0){
+ new AsyncTask<Void, Void, List<Integer>>(
+
+ ) {
+ @Override
+ protected List<Integer> doInBackground(Void... voids) {
+ return signalConfigViewModel.getAllIndexs();
+ }
+
+ @Override
+ protected void onPostExecute(List<Integer> indexs) {
+ if (listContainsSameValue(indexs)){
+ Log.i(TAG, "sendSignalConfigsToRemote: 鏈夌浉鍚岀殑index锛屼笉鑳藉彂閫�"+gson.toJson(signalConfiglist));
+ Toast.makeText(getApplicationContext(), "涓嶈兘鏈夌浉鍚岀殑鐗╃悊鎵�寮曪紒", Toast.LENGTH_SHORT).show();
+ }else{
+ AYSdk.getInstance().sendCmd(Constant.SEND_CONFIG_SIGNAL,gson.toJson(signalConfiglist));
+ }
+ }
+ }.execute();
+
+ }
+
+
+
+ }
@Override
protected void onResume() {
@@ -227,4 +277,20 @@
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
mPermissionsManager.recheckPermissions(PERMISSIONS_REQUEST_CODE, permissions, grantResults);
}
+ private boolean listContainsSameValue(List<Integer> indexs) {
+ for (int i = 0; i < indexs.size(); i++) {
+ //鍙互榛樿鏄�0 0涓嶅垽鏂槸鍚︽湁鐩稿悓鐨刬ndex
+ if (indexs.get(i) == 0){
+ continue;
+ }
+ for (int j=i+1;j<indexs.size();j++){
+
+ if (indexs.get(i) == indexs.get(j)){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
}
diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/SignalConfigFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/SignalConfigFragment.java
index 3261a80..ece42fa 100644
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/SignalConfigFragment.java
+++ b/app/src/main/java/safeluck/drive/evaluation/fragment/SignalConfigFragment.java
@@ -135,7 +135,6 @@
signalConfigRemote.setLevel(singalConfigs.get(i).getHighLevel());
list.add(signalConfigRemote);
}
- sendSignalConfigsToRemote();
for (int i = 0; i < singalConfigs.size(); i++) {
SingalConfig singalConfig = singalConfigs.get(i);
@@ -155,47 +154,9 @@
}
private Gson gson = new Gson();
- private void sendSignalConfigsToRemote() {
- new AsyncTask<Void, Void, List<Integer>>(
-
- ) {
- @Override
- protected List<Integer> doInBackground(Void... voids) {
- return signalConfigViewModel.getAllIndexs();
- }
-
- @Override
- protected void onPostExecute(List<Integer> indexs) {
- if (listContainsSameValue(indexs)){
- Log.i(TAG, "sendSignalConfigsToRemote: 鏈夌浉鍚岀殑index锛屼笉鑳藉彂閫�"+gson.toJson(list));
- Toast.makeText(_mActivity, "涓嶈兘鏈夌浉鍚岀殑鐗╃悊鎵�寮曪紒", Toast.LENGTH_SHORT).show();
- }else{
- AYSdk.getInstance().sendCmd(Constant.SEND_CONFIG_SIGNAL,gson.toJson(list));
- }
- }
- }.execute();
- }
-
-
-
- private boolean listContainsSameValue(List<Integer> indexs) {
- for (int i = 0; i < indexs.size(); i++) {
- //鍙互榛樿鏄�0 0涓嶅垽鏂槸鍚︽湁鐩稿悓鐨刬ndex
- if (indexs.get(i) == 0){
- continue;
- }
- for (int j=i+1;j<indexs.size();j++){
-
- if (indexs.get(i) == indexs.get(j)){
- return true;
- }
- }
- }
- return false;
- }
private class MySignalsAdapter extends BaseAdapter{
diff --git a/app/src/main/java/safeluck/drive/evaluation/im/IMSEventListener.java b/app/src/main/java/safeluck/drive/evaluation/im/IMSEventListener.java
index 27afae5..59bb12b 100644
--- a/app/src/main/java/safeluck/drive/evaluation/im/IMSEventListener.java
+++ b/app/src/main/java/safeluck/drive/evaluation/im/IMSEventListener.java
@@ -2,8 +2,6 @@
import com.anyun.im_lib.listener.OnEventListener;
-import safeluck.drive.evaluation.platformMessage.RegisterMessage;
-
/**
* MyApplication2
* Created by lzw on 2019/12/12. 16:12:40
@@ -71,12 +69,6 @@
@Override
public byte[] getRegisterMessage() {
- RegisterMessage registerMessage = new RegisterMessage((short)0x0100);
- registerMessage.setCityid((short) 1);
- registerMessage.setProviceId((short)23);
- registerMessage.setImei("460123874561");
- registerMessage.setModel("123");
- registerMessage.setSn("0314200100000004");
- return registerMessage.toBytes();
+ return null;
}
}
diff --git a/app/src/main/java/safeluck/drive/evaluation/im/MessageProcessor.java b/app/src/main/java/safeluck/drive/evaluation/im/MessageProcessor.java
index 9f03415..c585876 100644
--- a/app/src/main/java/safeluck/drive/evaluation/im/MessageProcessor.java
+++ b/app/src/main/java/safeluck/drive/evaluation/im/MessageProcessor.java
@@ -8,12 +8,9 @@
import safeluck.drive.evaluation.platformMessage.JK2019MessageBase;
import safeluck.drive.evaluation.platformMessage.PlatFormConstant;
-import safeluck.drive.evaluation.platformMessage.RegisterResp;
-import safeluck.drive.evaluation.platformMessage.ServerCommonRsp;
import safeluck.drive.evaluation.platformMessage.utils.MessageEscaper;
import safeluck.drive.evaluation.platformMessage.utils.MessageManager;
import safeluck.drive.evaluation.util.CThreadPoolExecutor;
-import safeluck.drive.evaluation.util.Utils;
/**
* MyApplication2
@@ -49,23 +46,7 @@
}
- private void parseMessage(byte[] datas) {
- byte[] msgidBytes = ByteUtil.subArray(datas,1,2);
- short msgid = ByteUtil.getShort(msgidBytes);
- switch (msgid){
- case (short) 0x8100:
- RegisterResp registerResp = new RegisterResp(datas);
- break;
- case (short) 0x8001://鏈嶅姟鍣ㄧ 閫氱敤搴旂瓟
- ServerCommonRsp serverCommonRsp = new ServerCommonRsp(datas);
- if (serverCommonRsp.getResult() == PlatFormConstant.SUCCESS){
- MyLog.i(PlatFormConstant.TAG,"纭"+serverCommonRsp.getMsgId()+"娑堟伅鎴愬姛");
- }
- break;
-
- }
- }
@Override
public void sendMessage(final byte[] msg) {
diff --git a/app/src/main/java/safeluck/drive/evaluation/platformMessage/DriveExamProtocol.java b/app/src/main/java/safeluck/drive/evaluation/platformMessage/DriveExamProtocol.java
deleted file mode 100644
index 187deaa..0000000
--- a/app/src/main/java/safeluck/drive/evaluation/platformMessage/DriveExamProtocol.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package safeluck.drive.evaluation.platformMessage;
-
-import android.util.Log;
-
-import com.anyun.exam.lib.MyLog;
-import com.anyun.im_lib.util.ByteUtil;
-
-import safeluck.drive.evaluation.util.Utils;
-
-/**
- * MyApplication2
- * Created by lzw on 2019/12/17. 15:39:23
- * 閭锛�632393724@qq.com
- * All Rights Saved! Chongqing AnYun Tech co. LTD
- */
-public abstract class DriveExamProtocol {
-
- private static final String TAG = "DriveExamProtocol";
- /***========================
- 娑堟伅缁撴瀯琛�
- 鏍囪瘑浣� 娑堟伅澶� 娑堟伅浣� 鏍¢獙鐮� 鏍囪瘑浣�
- 0x7E 0x7E
- ======================**/
- // 鏍囪瘑浣�(瀛楄妭娴佸紑濮嬶級
- private byte MESSAGE_HEAD = 0x7e;
- //鏍囪瘑浣嶏紙瀛楄妭娴佺粨鏉燂級
- private byte MESSAGE_TAIL = 0x7e;
-
- //鏍¢獙鐮佹寚浠庢秷鎭ご寮�濮嬶紝鍚屽悗涓�瀛楄妭寮傛垨锛岀洿鍒版牎楠岀爜鍓嶄竴涓瓧鑺傦紝鍗犵敤涓�涓瓧鑺�
-//鏍¢獙鐮� 鍏堟殏鏃跺啓姝� todo
- private byte checkCode = 0x78;
-
-
-/***===========浠ヤ笅鏄秷鎭ご=============***/
- //鍗忚鐗堟湰鍙� BYTE 235锛屽浐瀹�
- private short protocol_version = 235;
-//娑堟伅ID
- private short msg_id;
-
-
- /**銆�娑堟伅浣撳睘鎬ф牸寮忕粨鏋勮〃
-15 14 13 | 12 11 10 | 9 8 7 6 5 4 3 2 1 0
- 淇濈暀 鏁版嵁鍔犲瘑鏂瑰紡 娑堟伅浣撻暱搴�
-**/
- //娑堟伅浣撳睘鎬�
- private short msg_property =2;
-
- /**
- * 缁堢鎵嬫満鍙� 瀛楃涓查暱搴﹀繀椤讳负16
- **/
- private String phoneOnTerminal = "0008618513021245";
-
- /**
- *
- * 13 娑堟伅娴佹按鍙� WORD 鎸夊彂閫侀『搴忎粠0寮�濮嬪惊鐜疮鍔�
- *
- */
- public static short msg_serial_num=0;
-
- //15 棰勭暀 BYTE 棰勭暀
- private byte reserve = 0x00;
- /***===========娑堟伅澶寸粨鏉�=============***/
-
- /**
- * 娑堟伅浣� 闇�瑕佸瓙绫诲疄鐜�
- */
- protected abstract byte[] createMessageBody();
-
- /**
- * 鏋勯�犲嚱鏁�
- * @param msg_id 娑堟伅ID
- */
- public DriveExamProtocol(short msg_id) {
- this.msg_id = msg_id;
- }
-
- /**
- * 娑堟伅杞负byte鏁扮粍 7E......7E
- * @return
- */
- public byte[] toBytes(){
- byte[] desBytes = new byte[1+16+msgBodyLength()+1+1];
- int pos = 0;
-
-
- //鏍囪瘑浣�
- desBytes[pos] = MESSAGE_HEAD;
- pos++;
-
-
- //鍗忚鐗堟湰鍙�
- byte[] protoVersion = ByteUtil.shortGetByte(protocol_version);
- System.arraycopy(protoVersion,0,desBytes,pos,protoVersion.length);
- pos +=protoVersion.length;
-
- //娑堟伅ID
- byte[] msgIdBytes = ByteUtil.shortGetBytes(msg_id);
- System.arraycopy(msgIdBytes,0,desBytes,pos,msgIdBytes.length);
- pos+=msgIdBytes.length;
-
- //娑堟伅浣撳睘鎬� 榛樿涓烘秷鎭綋闀垮害
- msg_property = msgBodyLength();
- byte[] msg_pro_bytes = ByteUtil.shortGetBytes(msg_property);
- System.arraycopy(msg_pro_bytes,0,desBytes,pos,msg_pro_bytes.length);
- pos+=msg_pro_bytes.length;
- //缁堢鎵嬫満鍙�
- byte[] phoneBytes = ByteUtil.str2Bcd(phoneOnTerminal);
- System.arraycopy(phoneBytes,0,desBytes,pos,phoneBytes.length);
- pos+=phoneBytes.length;
- //娑堟伅娴佹按鍙�
- byte[] msg_serialNum = ByteUtil.shortGetBytes(msg_serial_num++);
- System.arraycopy(msg_serialNum,0,desBytes,pos,msg_serialNum.length);
- pos+=msg_serialNum.length;
- //淇濈暀byte
- desBytes[pos] = reserve;
- pos++;
-
- //娑堟伅浣�
- byte[] messageBodyBytes = createMessageBody();
- System.arraycopy(messageBodyBytes,0,desBytes,pos,messageBodyBytes.length);
- pos+=messageBodyBytes.length;
-
- //鏍¢獙鐮�
- checkCode = Utils.calCheckCode(ByteUtil.subArray(desBytes,1,pos-1));
- desBytes[pos] = checkCode;
- pos++;
- //鏈熬缁撴潫鏍囪瘑浣�
- desBytes[pos] = MESSAGE_TAIL;
-
- MyLog.i(TAG, "鍘熷鍖呴暱搴�="+(pos+1));
- MyLog.i(TAG, "鍘熷鍖呭唴瀹�: "+ByteUtil.byte2HexStr(desBytes));
- byte[] tranferbytes = Utils.transferMeaning(desBytes);
- MyLog.i(TAG,"杞箟鍚庣殑鍖呭唴瀹癸細"+ByteUtil.byte2HexStr(tranferbytes));
- return tranferbytes;
- }
-
- protected abstract short msgBodyLength();
-
-}
diff --git a/app/src/main/java/safeluck/drive/evaluation/platformMessage/KeepaliveMessage.java b/app/src/main/java/safeluck/drive/evaluation/platformMessage/KeepaliveMessage.java
deleted file mode 100644
index 073fb1d..0000000
--- a/app/src/main/java/safeluck/drive/evaluation/platformMessage/KeepaliveMessage.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package safeluck.drive.evaluation.platformMessage;
-
-import safeluck.drive.evaluation.platformMessage.DriveExamProtocol;
-
-/**
- * 蹇冭烦娑堟伅
- * MyApplication2
- * Created by lzw on 2019/12/19. 18:24:47
- * 閭锛�632393724@qq.com
- * All Rights Saved! Chongqing AnYun Tech co. LTD
- */
-public class KeepaliveMessage extends DriveExamProtocol {
-
-
- private static final int BODY_LENGTH = 0;
-// TODO: 2019/12/19
-
- public KeepaliveMessage(short msg_id) {
- super(msg_id);
- }
-
- @Override
- protected short msgBodyLength() {
- return BODY_LENGTH;
- }
-
- @Override
- protected byte[] createMessageBody() {
- return new byte[BODY_LENGTH];
- }
-}
diff --git a/app/src/main/java/safeluck/drive/evaluation/platformMessage/RegisterMessage.java b/app/src/main/java/safeluck/drive/evaluation/platformMessage/RegisterMessage.java
deleted file mode 100644
index 47a6ef5..0000000
--- a/app/src/main/java/safeluck/drive/evaluation/platformMessage/RegisterMessage.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package safeluck.drive.evaluation.platformMessage;
-
-
-import android.text.TextUtils;
-
-import com.anyun.im_lib.util.ByteUtil;
-
-import safeluck.drive.evaluation.platformMessage.DriveExamProtocol;
-
-/**
- * 娉ㄥ唽娑堟伅
- * MyApplication2
- * Created by lzw on 2019/12/17. 17:51:44
- * 閭锛�632393724@qq.com
- * All Rights Saved! Chongqing AnYun Tech co. LTD
- */
-public class RegisterMessage extends DriveExamProtocol {
-
- /**
- * 1.1.1 缁堢娉ㄥ唽
- * 娑堟伅ID锛�0x0100銆�
- * 璧峰瀛楄妭
- * 瀛楁
- * 鏁版嵁绫诲瀷
- * 鎻忚堪鍙婅姹�
- * 0
- * 鐪佸煙ID
- * WORD
- * 缁堢鎵�鍦ㄥ湴鐪両D
- * 2
- * 甯傚幙鍩烮D
- * WORD
- * 缁堢鎵�鍦ㄥ湴甯侷D
- * 4
- * 缁堢鍨嬪彿
- * BYTE[20]
- * 20涓瓧鑺傦紝姝ょ粓绔瀷鍙风敱鍒堕�犲晢鑷瀹氫箟锛屼綅鏁颁笉瓒�20浣嶇殑锛屽悗琛モ��0X00鈥�
- * 24
- * 缁堢鍑哄巶搴忓垪鍙�
- * BYTE[8]
- * 8涓瓧鑺傦紝鐢卞ぇ鍐欏瓧姣嶅拰鏁板瓧缁勬垚锛屾缁堢ID鐢卞埗閫犲晢鑷瀹氫箟锛屼綅鏁颁笉瓒虫椂锛屽悗琛モ��0X00鈥�
- * 32
- * IMEI
- * BYTE[15]
- * 鍥介檯绉诲姩璁惧鏍囪瘑锛孉SCII鐮�
- */
- private static final int BODY_LENGTH = 55;
-
- private short proviceId;
- private short cityid;
- private String model;//缁堢鍨嬪彿
- private String sn;//鍑哄巶搴忓垪鍙�
- private String imei;//
-
- /**
- * 鏋勯�犲嚱鏁�
- *
- * @param msg_id 娑堟伅ID
- */
- public RegisterMessage(short msg_id) {
- super(msg_id);
- }
-
- public static int getBodyLength() {
- return BODY_LENGTH;
- }
-
- public short getProviceId() {
- return proviceId;
- }
-
- public void setProviceId(short proviceId) {
- this.proviceId = proviceId;
- }
-
- public short getCityid() {
- return cityid;
- }
-
- public void setCityid(short cityid) {
- this.cityid = cityid;
- }
-
- public String getModel() {
- return model;
- }
-
- public void setModel(String model) {
- this.model = model;
- }
-
- public String getSn() {
- return sn;
- }
-
- public void setSn(String sn) {
- this.sn = sn;
- }
-
- public String getImei() {
- return imei;
- }
-
- public void setImei(String imei) {
- this.imei = imei;
- }
-
- @Override
- protected short msgBodyLength() {
- return BODY_LENGTH;
- }
-
-
- @Override
- protected byte[] createMessageBody() {
- int pos = 0;
- byte[] messageBody = new byte[BODY_LENGTH];
- //鐪佸煙ID
- byte[] provinceIdBytes = ByteUtil.shortGetBytes(proviceId);
- System.arraycopy(provinceIdBytes,0,messageBody,pos,provinceIdBytes.length);
- pos += provinceIdBytes.length;
- //甯傚煙ID
- byte[] cityIdBytes = ByteUtil.shortGetBytes(cityid);
- System.arraycopy(cityIdBytes,0,messageBody,pos,cityIdBytes.length);
- pos += cityIdBytes.length;
- //model
- byte[] modelBytes = !TextUtils.isEmpty(model)?model.getBytes():"".getBytes();
- System.arraycopy(modelBytes,0,messageBody,pos,modelBytes.length);
- pos += 20;
-
- //sn
- byte[] snBytes = !TextUtils.isEmpty(sn)?sn.getBytes():"".getBytes();
- System.arraycopy(snBytes,0,messageBody,pos,snBytes.length);
- pos += 16;
-
- //IMEI
- byte[] imeiBytes = !TextUtils.isEmpty(imei)?imei.getBytes():"".getBytes();
- System.arraycopy(imeiBytes,0,messageBody,pos,imeiBytes.length);
-
- return messageBody;
- }
-}
diff --git a/app/src/main/java/safeluck/drive/evaluation/platformMessage/RegisterResp.java b/app/src/main/java/safeluck/drive/evaluation/platformMessage/RegisterResp.java
deleted file mode 100644
index e110507..0000000
--- a/app/src/main/java/safeluck/drive/evaluation/platformMessage/RegisterResp.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package safeluck.drive.evaluation.platformMessage;
-
-import com.anyun.exam.lib.MyLog;
-import com.anyun.im_lib.util.ByteUtil;
-
-
-import safeluck.drive.evaluation.im.MessageProcessor;
-
-public class RegisterResp extends ServerProtocol {
- private String hexpwd;
- private short result;
- private int currPos = 0;
-
- public RegisterResp(byte[] rspBytes) {
- super(rspBytes);
- }
-
- @Override
- protected void parseMsgBody(byte[] msgbodyData) {
- currPos += 2;
- result = ByteUtil.getShort(ByteUtil.subArray(msgbodyData,currPos,1));
- if (result == PlatFormConstant.SUCCESS){
- MyLog.i(PlatFormConstant.TAG,"璁惧娉ㄥ唽鎴愬姛");
- }else{
- MyLog.i(PlatFormConstant.TAG,"璁惧娉ㄥ唽澶辫触");
- }
- }
-}
diff --git a/app/src/main/java/safeluck/drive/evaluation/platformMessage/ServerCommonRsp.java b/app/src/main/java/safeluck/drive/evaluation/platformMessage/ServerCommonRsp.java
deleted file mode 100644
index eb311ec..0000000
--- a/app/src/main/java/safeluck/drive/evaluation/platformMessage/ServerCommonRsp.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package safeluck.drive.evaluation.platformMessage;
-
-import com.anyun.im_lib.util.ByteUtil;
-
-/**
- * 鏈嶅姟绔�氱敤搴旂瓟
- */
-public class ServerCommonRsp extends ServerProtocol {
-
- /**
- * 80
- * 80 01
- * 00 05
- * 00 08 61 85 13 02 12 45
- * 30 AF
- * FF
- *
- * 00 02
- * 01 01
- * 00
- *
- * CC
- *
- * 鍑哄幓澶村熬鏍囪瘑浣�0x7e鍚庣殑 閫氱敤鏈嶅姟鍣ㄥ簲绛旀秷鎭�
- */
- private short result;
- private int currPos=0;
-
- private short msgId;//瀵瑰簲瀹㈡埛绔殑娑堟伅ID锛�
-
- private short msg_serial_num;//瀵瑰簲瀹㈡埛绔粰鐨勬秷鎭祦姘村彿
- /**
- * 闄や簡澶村熬鏍囩ず浣�0x7e鐨勬秷鎭�
- * @param message
- */
- public ServerCommonRsp(byte[] message) {
- super(message);
- }
-
- @Override
- protected void parseMsgBody(byte[] msgbodyData) {
- byte[] msg_serial_numBytes = ByteUtil.subArray(msgbodyData,currPos,2);
- currPos += 2;
- byte[] msgIdBytes = ByteUtil.subArray(msgbodyData,currPos,2);
- currPos += 2;
- result = ByteUtil.getShort(ByteUtil.subArray(msgbodyData,currPos,1));
- }
-
- public short getResult() {
- return result;
- }
-
- public short getMsgId() {
- return msgId;
- }
-
- public short getMsg_serial_num() {
- return msg_serial_num;
- }
-}
diff --git a/app/src/main/java/safeluck/drive/evaluation/platformMessage/ServerProtocol.java b/app/src/main/java/safeluck/drive/evaluation/platformMessage/ServerProtocol.java
deleted file mode 100644
index 6c5826f..0000000
--- a/app/src/main/java/safeluck/drive/evaluation/platformMessage/ServerProtocol.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package safeluck.drive.evaluation.platformMessage;
-
-import com.anyun.im_lib.util.ByteUtil;
-
-public abstract class ServerProtocol {
- /**娉ㄥ唽搴旂瓟娑堟伅涓轰緥
- * 80 鐗堟湰鍙�
- * 81 00 娑堟伅id
- * 00 0B 娑堟伅浣撳睘鎬э紙閲岄潰娑堟伅浣撻暱搴︽湁鐢級
- * 00 00 00 00 00 00 00 00 鐢佃瘽
- * 1E 5E 娴佹按鍙�
- * FF 淇濈暀瀛楄妭
- *
- *
- * 涓嬮潰鏄簲绛斿唴瀹�
- * 00 00
- * 00
- * 01 02 03 04 05 06 07 08
- * BD
- */
- private short version ;//鐗堟湰鍙� 涓�涓瓧鑺�
- protected short msgId;//娑堟伅id 涓や釜瀛楄妭 澶х
- protected short msgBodyLength; //娑堟伅浣撻暱搴�
- private String phone; // 8涓瓧鑺傜殑string
- private short message_serial_num;//娴佹按鍙凤紝涓や釜瀛楄妭
- private byte reserved;//淇濈暀瀛楁 涓�涓瓧鑺�
- private int pos = 0;
-
- public ServerProtocol(byte[] rspBytes) {
-
- byte[] versionByte = ByteUtil.subArray(rspBytes,pos,1);
- this.version = ByteUtil.getShort(versionByte);
- pos+=1;//娑堟伅ID寮�濮嬬殑浣嶇疆
-
-
- pos += 2;// 娑堟伅灞炴�у紑濮嬬殑浣嶇疆
- byte[] msgProperty = ByteUtil.subArray(rspBytes,pos,2);
- msgBodyLength |= (msgProperty[1]&0x3f);
- pos+=2; //鐢佃瘽寮�濮嬬殑瀛楄妭浣嶇疆
-
- pos += 8;// liusshui鍙峰紑濮嬬殑浣嶇疆
-
- pos +=2;//淇濈暀瀛楄妭寮�濮嬬殑浣嶇疆
-
- pos+=1;//娑堟伅浣撶涓�涓瓧鑺傚紑濮嬬殑浣嶇疆 瀛愮被鍙互鐩存帴鍙杙os浣嶇疆
-
- parseMsgBody(ByteUtil.subArray(rspBytes,pos,rspBytes.length-(pos)));
- }
-
- protected abstract void parseMsgBody(byte[] msgbodyData);
-}
--
Gitblit v1.8.0