562935844@qq.com
2024-06-28 6d908915d558ec457db8a50b03ed8746f4e73a48
HDLSDK/app/src/main/java/com/hdl/hdlsdk/MainActivity.java
@@ -41,6 +41,7 @@
import com.hdl.sdk.connect.bean.request.ListSidRequest;
import com.hdl.sdk.connect.bean.request.ListUploadRequest;
import com.hdl.sdk.connect.bean.response.BaseLocalResponse;
import com.hdl.sdk.connect.bean.response.DeviceInfoResponse;
import com.hdl.sdk.connect.bean.response.GatewaySearchBean;
import com.hdl.sdk.connect.bean.response.UpdateInfo;
import com.hdl.sdk.connect.callback.HDLLinkCallBack;
@@ -71,12 +72,6 @@
    private EventListener allTopicsListener;
    private String testLightSid = "02010131D9C03D01020300010107";
    private String secret = "";
    @Override
    protected void onDestroy() {
        super.onDestroy();
        removeAllTopicsListener();
    }
    void applyDeviceSecret() {
        tv.setText("开始申请设备密钥...");
@@ -335,8 +330,10 @@
            @Override
            public void onMessage(Object msg) {
                LinkResponse response = (LinkResponse) msg;
                Log.i("onMessage", "response.getTopic():" + response.getTopic());
                if ("/user/all/custom/gateway/broadcast_reply".equals(response.getTopic())) {
                    localSecret.setText("密钥:" + HDLLinkConfig.getInstance().getLocalSecret());
                }
            }
        };
@@ -386,22 +383,23 @@
        HDLLink.getInstance().removeAllTopicsListener(allTopicsListener);
    }
    void initDeviceInfo()
    {
    void initDeviceInfo() {
        AuthenticateRequest.AuthenticateDeviceInfoBean infoBean = new AuthenticateRequest.AuthenticateDeviceInfoBean();
        infoBean.setDeviceMAC("AA00000000000100");
        infoBean.setIPMAC("AA00000000000100");
        infoBean.setDeviceName("音乐播放器");//设备名字
        infoBean.setDeviceModel("MCLog.431");//设备型号
        infoBean.setDeviceMAC("f2c5d8bad48f");
        infoBean.setIPMAC("f2c5d8bad48f");
        infoBean.setDeviceName("魔镜");//设备名字
        infoBean.setDeviceModel("HDLSDK");//设备型号
        infoBean.setAccessMode("WIFI");
        infoBean.setIPGateway("192.168.1.1");
        infoBean.setIPAddress("192.168.1.116");
        infoBean.setGateway_type("music.standard");
        infoBean.setIPAddress("192.168.1.103");
        infoBean.setGateway_type("screen.touch");
        infoBean.setHw_version("HW2.0");
        infoBean.setFw_version("Fw1.0");
        infoBean.setOID("010105000000FE11");//每个设备oid都要不一样
        infoBean.setSid("110105000000FE08110100000011");//每个设备的sid都要不一样
        infoBean.setSupplier("JINMAOYUN");
        HDLLinkConfig.getInstance().setDeviceInfoBean(infoBean);
    }
    /**
@@ -418,8 +416,8 @@
//        正式服务器
        String spkStr = "screen.mirror";//产品spk
        String macStr = "AA00000000000100";//设备唯一MAC地址
        String secret = "e186beeb7974998e";//通过spk和mac提交云端认证后分配的secret
        String macStr = "f2c5d8bad48f";//设备唯一MAC地址
//        String secret = "e186beeb7974998e";//通过spk和mac提交云端认证后分配的secret
        String mac_key = stringToMD5(stringToMD5(macStr + secret));
        String versionString = "HDL_V1.0.1";//
@@ -429,7 +427,7 @@
        //1.设置认证信息
        AuthenticateRequest.RequestBean requestBean = new AuthenticateRequest.RequestBean();
        requestBean.setMAC(macStr);
        requestBean.setSupplier("WISE");
        requestBean.setSupplier("JINMAOYUN");
        requestBean.setFirmwareVersion(versionString);
        requestBean.setHardwareModel("1956F");
        AuthenticateRequest.AuthBean authbean = new AuthenticateRequest.AuthBean();
@@ -583,6 +581,7 @@
        statusBeanList.add(bean);
        request.setStatus(statusBeanList);
        requestList.add(request);
        HDLLink.getInstance().propertyDown(requestList, new HDLLinkCallBack() {
            @Override
            public void onSuccess(String data) {
@@ -833,7 +832,7 @@
        AttributesRequest attributes = new AttributesRequest();
        attributes.setKey("on_off");
        attributes.setData_type("string");
        List<Object> valueList=new ArrayList<>();
        List<Object> valueList = new ArrayList<>();
        valueList.add("on");
        valueList.add("off");
        attributes.setValue(valueList);
@@ -877,4 +876,10 @@
        return versionName;
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        removeAllTopicsListener();
    }
}