mac
2024-10-24 15c2fc33ef1023a045a76ae594b3da76a281ea20
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -29,6 +29,7 @@
import com.hdl.linkpm.sdk.utils.HDLMD5Utils;
import com.hdl.photovoltaic.HDLApp;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.bean.LocalResponse;
import com.hdl.photovoltaic.bean.ModBusBean;
import com.hdl.photovoltaic.bean.PageNumberObject;
import com.hdl.photovoltaic.config.AppConfigManage;
@@ -180,10 +181,7 @@
                    case HDLUniMP.UNI_EVENT_REPLY_HOME_ADD: {
                        String url = getKeyValue("url", getKeyValue("data", data));
                        //EventBus事件分发
                        HdlCommonLogic.getInstance().postEventBusSticky(
                                HDLUniMP.UNI_EVENT_REPLY_HOME_ADD,
                                HDLUniMP.UNI_EVENT_REPLY_HOME_ADD,
                                url);
                        HdlCommonLogic.getInstance().postEventBusSticky(HDLUniMP.UNI_EVENT_REPLY_HOME_ADD, HDLUniMP.UNI_EVENT_REPLY_HOME_ADD, url);
                        if (callback != null) {
                            uniSuccessCallback(type, null, callback);
@@ -200,10 +198,7 @@
                    //创建电站
                    case HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION: {
                        //EventBus事件分发
                        HdlCommonLogic.getInstance().postEventBus(
                                HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL,
                                HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION,
                                getKeyValue("data", data));
                        HdlCommonLogic.getInstance().postEventBus(HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL, HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION, getKeyValue("data", data));
                        if (callback != null) {
                            uniSuccessCallback(type, null, callback);
                        }
@@ -238,10 +233,7 @@
                    //住宅【电站】编辑
                    case HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT: {
                        //EventBus事件分发
                        HdlCommonLogic.getInstance().postEventBus(
                                HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL,
                                HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT,
                                getKeyValue("data", data));
                        HdlCommonLogic.getInstance().postEventBus(HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL, HDLUniMP.UNI_EVENT_REPLY_HOME_EDIT, getKeyValue("data", data));
                        if (callback != null) {
                            uniSuccessCallback(type, null, callback);
                        }
@@ -687,13 +679,19 @@
                    //本地密钥设置
                    case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOCAL_ENCRYPT_SET: {
                        String local_encrypt = getKeyValue("local_encrypt", getKeyValue("data", data));
                        //重新设置本地通讯秘钥
                        UserConfigManage.getInstance().setLocalSecret(local_encrypt);
                        UserConfigManage.getInstance().Save();
                        //配置本地通信的信息
                        HDLLinkConfig.getInstance().setLocalSecret(local_encrypt);
                        HdlLogLogic.print("uni---log---" + local_encrypt, true);
                        if (!TextUtils.isEmpty(local_encrypt)) {
                            //重新设置本地通讯秘钥
                            UserConfigManage.getInstance().setLocalSecret(local_encrypt);
                            UserConfigManage.getInstance().Save();
                            //配置本地通信的信息
                            HDLLinkConfig.getInstance().setLocalSecret(local_encrypt);
                            HdlLogLogic.print("uni---log---" + local_encrypt, true);
                        }
                    }
                    break;
                    //link进行密码验证
                    case HDLUniMP.UNI_EVENT_REPLY_OTHER_Password_verifiy: {
                        uniCheckPasswordVerification(mode_type, data, callback);
                    }
                    break;
                }
@@ -744,6 +742,29 @@
    //region ******uni接口方法******
    /**
     * link进行密码验证
     */
    private void uniCheckPasswordVerification(String type, Object data, DCUniMPJSCallback callback) {
        String password = getKeyValue("password", getKeyValue("data", data));
        String mac = getKeyValue("mac", getKeyValue("data", data));
        HdlDeviceLogic.getInstance().getPasswordVerification(mac, password, new LinkCallBack<LocalResponse>() {
            @Override
            public void onSuccess(LocalResponse obj) {
                if (callback != null) {
                    uniCallbackData(type, obj.getObjects(), obj.getCode(), obj.getMsg(), callback);
                }
            }
            @Override
            public void onError(HDLLinkException e) {
                if (callback != null) {
                    uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
                }
            }
        });
    }
    /**
     * 电站删除
     */
    private void uniGetDelResidence(String type, Object data, DCUniMPJSCallback callback) {