From a03799e08e7cc9b984b89cd125fd01e31f78486d Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 02 十二月 2021 09:44:20 +0800
Subject: [PATCH] 2021-12-02 1.增加网关认证错误
---
HDLSDK/app/src/main/java/com/hdl/hdlsdk/MainActivity.java | 31 ++++++++++++++-----------------
1 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/HDLSDK/app/src/main/java/com/hdl/hdlsdk/MainActivity.java b/HDLSDK/app/src/main/java/com/hdl/hdlsdk/MainActivity.java
index 2a652c1..33838bc 100644
--- a/HDLSDK/app/src/main/java/com/hdl/hdlsdk/MainActivity.java
+++ b/HDLSDK/app/src/main/java/com/hdl/hdlsdk/MainActivity.java
@@ -69,6 +69,7 @@
rv.setLayoutManager(new LinearLayoutManager(this));
checkIfCertified();
+
registerAllTopicsListener();
ActivityResultLauncher<String[]> launcher = registerForActivityResult(new ActivityResultContracts.RequestMultiplePermissions(), new ActivityResultCallback<Map<String, Boolean>>() {
@@ -181,12 +182,13 @@
*/
void sendAuthenticateRequest(){
tv.setText("寮�濮嬪叆缃戣璇�...");
+ //璁よ瘉鎻愪氦鍙傛暟鍑嗗
- String macStr = "AA000000000000BB";
- String secret = "87ae414b7a853f65";
+ String spkStr = "ir.module";//浜у搧spk
+ String macStr = "AA000000000000BB";//璁惧鍞竴MAC鍦板潃
+ String secret = "87ae414b7a853f65";//閫氳繃spk鍜宮ac鎻愪氦浜戠璁よ瘉鍚庡垎閰嶇殑secret
String mac_key = stringToMD5(stringToMD5(macStr + secret));
-
- String versionString = "HDL_V1.0.1";
+ String versionString = "HDL_V1.0.1";//
String time = String.valueOf(System.currentTimeMillis());
//1.璁剧疆璁よ瘉淇℃伅
@@ -196,7 +198,7 @@
requestBean.setFirmwareVersion(versionString);
requestBean.setHardwareModel("1956F");
AuthenticateRequest.AuthBean authbean = new AuthenticateRequest.AuthBean();
- authbean.setSpk("ir.module");
+ authbean.setSpk(spkStr);
authbean.setMACKey(mac_key);
authbean.setRequest(requestBean);
@@ -204,11 +206,11 @@
AuthenticateRequest.AuthenticateDeviceInfoBean infoBean = new AuthenticateRequest.AuthenticateDeviceInfoBean();
infoBean.setDeviceMAC(macStr);
infoBean.setIPMAC(macStr);
- infoBean.setDeviceName("HDL闈㈡澘");
- infoBean.setDeviceModel("HDL");
+ infoBean.setDeviceName("绾㈠瀹�");//璁惧鍚嶅瓧
+ infoBean.setDeviceModel("HDL");//
infoBean.setAccessMode("WIFI");
+ infoBean.setIPGateway("192.168.10.1");
infoBean.setIPAddress(IpUtils.getIP(this));
-
infoBean.setOID("010105000000FE08");
infoBean.setSid("010105000000FE08110100000000");
@@ -216,16 +218,12 @@
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);
-
- String ip = IpUtils.getBroadcastAddress();
-// ip = "192.168.10.102";
-
HDLLink.getInstance().startAuthenticateRequest(request, new HDLLinkCallBack() {
@Override
public void onError(HDLLinkException e) {
tv.setText("璁よ瘉澶辫触");
responseTv.setText(e.getMsg());
-// Log.i("TAG", "onError: 璁よ瘉澶辫触");
+ Log.i("TAG", "onError: 璁よ瘉澶辫触");
}
@Override
@@ -284,8 +282,7 @@
void getFunctionList(){
tv.setText("鑾峰彇鍔熻兘鍒楄〃涓�...");
responseTv.setText("");
- HDLSocket.getInstance().getFunctionList(new HDLLinkCallBack() {
-
+ HDLLink.getInstance().getFunctionList(new HDLLinkCallBack() {
@Override
public void onError(HDLLinkException error) {
tv.setText(error.getMsg());
@@ -307,7 +304,7 @@
tv.setText("鍔熻兘灞炴�ц鍙�");
List<String> sids = new ArrayList<>();
sids.add(testLightSid);
- HDLSocket.getInstance().getFunctionAttribute(sids, new HDLLinkCallBack() {
+ HDLLink.getInstance().getFunctionAttribute(sids, new HDLLinkCallBack() {
@Override
public void onSuccess(String msg) {
responseTv.setText(msg);
@@ -328,7 +325,7 @@
tv.setText("璇诲彇鐘舵�佷腑...");
List<String> list = new ArrayList<>();
list.add(testLightSid);//瑕佽鍙栬澶囩殑sid
- HDLSocket.getInstance().propertyRead(list, new HDLLinkCallBack() {
+ HDLLink.getInstance().propertyRead(list, new HDLLinkCallBack() {
@Override
public void onSuccess(String data) {
tv.setText("璇诲彇鎴愬姛");
--
Gitblit v1.8.0