From 516bfa1d3919e2236aba5c07348b2bd1234ed94f Mon Sep 17 00:00:00 2001
From: endian11 <Dana_Lee1016@126.com>
Date: 星期三, 18 十二月 2019 14:56:11 +0800
Subject: [PATCH] 修改消息基类    @Override           public void channelActive(ChannelHandlerContext ctx) throws Exception {               super.channelActive(ctx);               Log.i(TAG, "channelActive: ");

---
 im_lib/src/main/java/com/anyun/im_lib/LoginAuthRespHandler.java         |    8 ++++++++
 app/src/main/java/safeluck/drive/evaluation/bean/DriveExamProtocol.java |   22 +++++++++++++---------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/app/src/main/java/safeluck/drive/evaluation/bean/DriveExamProtocol.java b/app/src/main/java/safeluck/drive/evaluation/bean/DriveExamProtocol.java
index 4448329..527c20c 100644
--- a/app/src/main/java/safeluck/drive/evaluation/bean/DriveExamProtocol.java
+++ b/app/src/main/java/safeluck/drive/evaluation/bean/DriveExamProtocol.java
@@ -23,7 +23,7 @@
     //鏍囪瘑浣�
     private byte MESSAGE_TAIL = 0x7e;
 //鏍¢獙鐮�  鍏堟殏鏃跺啓姝�
-    private int checkCode = 0x78;
+    private byte checkCode = 0x78;
 
 
 /***===========浠ヤ笅鏄秷鎭ご=============***/
@@ -35,8 +35,8 @@
     //娑堟伅浣撳睘鎬�
     private int msg_property;
 
-    //缁堢鎵嬫満鍙�
-    private String phoneOnTerminal;
+    //缁堢鎵嬫満鍙� 瀛楃涓查暱搴﹀繀椤讳负16
+    private String phoneOnTerminal = "0008618513021245";
 //13	娑堟伅娴佹按鍙�	WORD	鎸夊彂閫侀『搴忎粠0寮�濮嬪惊鐜疮鍔�
     public static short msg_serial_num=0;
 
@@ -65,29 +65,31 @@
         //鏍囪瘑浣�
         desBytes[pos] = MESSAGE_HEAD;
         pos++;
+
+
         //鍗忚鐗堟湰鍙�
         byte[] protoVersion = ByteUtil.shortGetByte(protocol_version);
         System.arraycopy(protoVersion,0,desBytes,pos,protoVersion.length);
         pos +=protoVersion.length;
 
-//娑堟伅ID
+    //娑堟伅ID
         byte[] msgIdBytes = ByteUtil.shortGetBytes(msg_id);
         System.arraycopy(msgIdBytes,0,desBytes,pos,msgIdBytes.length);
         pos+=msgIdBytes.length;
 
-//娑堟伅浣撳睘鎬�
+    //娑堟伅浣撳睘鎬�
         byte[] msg_pro_bytes = ByteUtil.shortGetBytes((short)2);
         System.arraycopy(msg_pro_bytes,0,desBytes,pos,msg_pro_bytes.length);
         pos+=msg_pro_bytes.length;
         //缁堢鎵嬫満鍙�
-        byte[] phoneBytes = ByteUtil.str2Bcd("1234567890121518");
+        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;
-//淇濈暀
+        //淇濈暀
         desBytes[pos] = 0;
         pos++;
 
@@ -97,13 +99,15 @@
         pos+=messageBodyBytes.length;
 
         //鏍¢獙鐮�
-        desBytes[pos] = 0x01;
+        // TODO: 2019/12/18 鏍¢獙鐮侀渶瑕佽绠�   杩樻湁杞箟闇�瑕佸鐞�
+        desBytes[pos] = checkCode;
         pos++;
         //鏈熬缁撴潫鏍囪瘑浣�
         desBytes[pos] = MESSAGE_TAIL;
 
         Log.i(TAG, "鍖呴暱搴�="+(pos+1));
         Log.i(TAG, "鍖呭唴瀹�: "+ByteUtil.byte2HexStr(desBytes));
+
         return desBytes;
     }
 
diff --git a/im_lib/src/main/java/com/anyun/im_lib/LoginAuthRespHandler.java b/im_lib/src/main/java/com/anyun/im_lib/LoginAuthRespHandler.java
index e0c0425..a91f238 100644
--- a/im_lib/src/main/java/com/anyun/im_lib/LoginAuthRespHandler.java
+++ b/im_lib/src/main/java/com/anyun/im_lib/LoginAuthRespHandler.java
@@ -4,6 +4,7 @@
 
 import com.anyun.im_lib.interf.IMSClientInteface;
 
+import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 
@@ -19,6 +20,13 @@
     private static final String TAG = LoginAuthRespHandler.class.getSimpleName();
     private IMSClientInteface imsClient;
 
+    @Override
+    public void channelActive(ChannelHandlerContext ctx) throws Exception {
+        super.channelActive(ctx);
+        Log.i(TAG, "channelActive: ");
+
+    }
+
     /**
      * 鏋勯�犲嚱鏁�
      * @param imsClient

--
Gitblit v1.8.0