From af2cbc2a24b3724e7fc3e6b42e134b21a3144c75 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期四, 17 二月 2022 15:33:19 +0800
Subject: [PATCH] 过滤掉非json数据不传给三方使用

---
 HDLSDK_DEMO/app/src/main/java/com/hdl/hdlsdk/MainActivity.java |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/HDLSDK_DEMO/app/src/main/java/com/hdl/hdlsdk/MainActivity.java b/HDLSDK_DEMO/app/src/main/java/com/hdl/hdlsdk/MainActivity.java
index 2033551..c5c8f1e 100644
--- a/HDLSDK_DEMO/app/src/main/java/com/hdl/hdlsdk/MainActivity.java
+++ b/HDLSDK_DEMO/app/src/main/java/com/hdl/hdlsdk/MainActivity.java
@@ -72,6 +72,25 @@
         removeAllTopicsListener();
     }
 
+    void initDeviceInfo()
+    {
+        AuthenticateRequest.AuthenticateDeviceInfoBean infoBean = new AuthenticateRequest.AuthenticateDeviceInfoBean();
+        infoBean.setDeviceMAC("123456789");
+        infoBean.setIPMAC("12345678900");
+        infoBean.setDeviceName("闊充箰鎾斁鍣�");//璁惧鍚嶅瓧
+        infoBean.setDeviceModel("MCLog.431");//璁惧鍨嬪彿
+        infoBean.setAccessMode("WIFI");
+        infoBean.setIPGateway("192.168.88.1");
+        infoBean.setIPAddress("192.168.88.100");
+        infoBean.setGateway_type("music.standard");
+        infoBean.setHw_version("HW2.0");
+        infoBean.setFw_version("Fw1.0");
+        infoBean.setOID("010105000000FE08");
+        infoBean.setSid("010105000000FE08110100000000");
+        HDLLinkConfig.getInstance().setDeviceInfoBean(infoBean);
+    }
+
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -82,7 +101,7 @@
         rv.setLayoutManager(new LinearLayoutManager(this));
 
         checkIfCertified();
-
+        initDeviceInfo();
         registerAllTopicsListener();
 
         ActivityResultLauncher<String[]> launcher = registerForActivityResult(new ActivityResultContracts.RequestMultiplePermissions(), new ActivityResultCallback<Map<String, Boolean>>() {
@@ -262,7 +281,7 @@
         String macStr = "AA000000000000BB";//璁惧鍞竴MAC鍦板潃
         String secret = "87ae414b7a853f65";//閫氳繃spk鍜宮ac鎻愪氦浜戠璁よ瘉鍚庡垎閰嶇殑secret
 
-        //姝e紡鏈嶅姟鍣�
+//        //姝e紡鏈嶅姟鍣�
 //        String spkStr = "screen.mirror";//浜у搧spk
 //        String macStr = "AA000000000000AC";//璁惧鍞竴MAC鍦板潃
 //        String secret = "ee62124c151b737c";//閫氳繃spk鍜宮ac鎻愪氦浜戠璁よ瘉鍚庡垎閰嶇殑secret
@@ -270,6 +289,7 @@
         String mac_key = stringToMD5(stringToMD5(macStr + secret));
         String versionString = "HDL_V1.0.1";//
         String time = String.valueOf(System.currentTimeMillis());
+        HDLLinkConfig.getInstance().getDeviceInfoBean().setDeviceMAC(macStr);
 
         //1.璁剧疆璁よ瘉淇℃伅
         AuthenticateRequest.RequestBean requestBean = new AuthenticateRequest.RequestBean();
@@ -281,23 +301,8 @@
         authbean.setSpk(spkStr);
         authbean.setMACKey(mac_key);
         authbean.setRequest(requestBean);
-
-        //2.璁剧疆璁惧淇℃伅
-        AuthenticateRequest.AuthenticateDeviceInfoBean infoBean = new AuthenticateRequest.AuthenticateDeviceInfoBean();
-        infoBean.setDeviceMAC(macStr);
-        infoBean.setIPMAC(macStr);
-        infoBean.setDeviceName("绾㈠瀹�");//璁惧鍚嶅瓧
-        infoBean.setDeviceModel("HDL");//
-        infoBean.setAccessMode("WIFI");
-        infoBean.setIPGateway("192.168.88.1");
-        infoBean.setIPAddress(IpUtils.getIP(this));
-
-        infoBean.setOID("010105000000FE08");
-        infoBean.setSid("010105000000FE08110100000000");
-//        infoBean.set
-        AuthenticateRequest.VersionBean[] versionBeans = new AuthenticateRequest.VersionBean[]{new AuthenticateRequest.VersionBean("FW", versionString), new AuthenticateRequest.VersionBean("HW", "1956F")};
-        infoBean.setVersions(versionBeans);
-        AuthenticateRequest request = new AuthenticateRequest(IdUtils.getUUId(), time, infoBean, authbean);
+        //HDLLinkConfig.getInstance().getDeviceInfoBean()杩欎釜鍒濆鍖栫殑鏃跺�欒鍏堣缃ソ
+        AuthenticateRequest request = new AuthenticateRequest(IdUtils.getUUId(), time, HDLLinkConfig.getInstance().getDeviceInfoBean(), authbean);
         HDLLink.getInstance().startAuthenticateRequest(request, new HDLLinkCallBack() {
             @Override
             public void onError(HDLLinkException e) {

--
Gitblit v1.8.0