mac
2024-07-16 3ec7de773bff5582411c6f1f659d35cf8fb1734a
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -2030,6 +2030,22 @@
                                        @Override
                                        public void onFailure(HDLException e) {
                                            //添加逆变器失败后初始化逆变器
                                            HdlLogLogic.print("添加逆变器失败后开始初始化逆变器-->", true);
                                            for (int i = 0; i < list.size(); i++) {
                                                GatewayBean gatewayBean = list.get(i);
                                                HdlDeviceLogic.getInstance().initializeInverter(gatewayBean.getDevice_mac(), new LinkCallBack<Boolean>() {
                                                    @Override
                                                    public void onSuccess(Boolean obj) {
                                                        HdlLogLogic.print("初始化逆变器成功-->mac:" + gatewayBean.getDevice_mac(), true);
                                                    }
                                                    @Override
                                                    public void onError(HDLLinkException e) {
                                                        HdlLogLogic.print("初始化逆变器失败-->mac:" + gatewayBean.getDevice_mac(), true);
                                                    }
                                                });
                                            }
                                            uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
                                        }
                                    });
@@ -2082,7 +2098,25 @@
            @Override
            public void onFailure(HDLException e) {
                uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
                if (e.getCode() == 121005) {
                    //设备不存在(121005)状态码
                    //初始化逆变器设备
                    HdlDeviceLogic.getInstance().initializeInverter(mac, new LinkCallBack<Boolean>() {
                        @Override
                        public void onSuccess(Boolean obj) {
                            //移除本地缓存
                            HdlDeviceLogic.getInstance().removeLocalCacheMemoryGatewayToDeviceId(homeId, deviceId);
                            uniSuccessCallback(type, null, callback);
                        }
                        @Override
                        public void onError(HDLLinkException e) {
                            uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
                        }
                    });
                } else {
                    uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
                }
            }
        });
    }
@@ -2122,19 +2156,14 @@
        HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(homeId, new CloudCallBeak<List<GatewayBean>>() {
            @Override
            public void onSuccess(List<GatewayBean> list) {
                if (list == null || list.size() == 0) {
                    if (callback != null) {
                        uniSuccessCallback(type, list, callback);
                    }
                    return;
                }
                if (callback != null) {
                    uniSuccessCallback(type, list, callback);
                }
                //EventBus事件分发,进入住宅开始订阅主题
                BaseEventBus baseEventBus = new BaseEventBus();
                baseEventBus.setTopic(HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST);
                baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST);
                baseEventBus.setData(list);
                baseEventBus.setData(homeId);
                EventBus.getDefault().post(baseEventBus);
                //进来住宅详情都要上传一次oid列表到云端;
                HdlDeviceLogic.getInstance().uploadOidDataToCloud(homeId, list, false, null);