mac
2023-09-23 116def783f85af5896fc4500bc8a690d8b1eb5f3
app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -9,6 +9,7 @@
import com.hdl.hdlhttp.HxHttp;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.photovoltaic.bean.HttpResponsePack;
import com.hdl.photovoltaic.bean.LocalResponse;
import com.hdl.photovoltaic.config.AppConfigManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.internet.HttpClient;
@@ -27,6 +28,8 @@
import com.hdl.sdk.link.common.exception.HDLLinkCode;
import com.hdl.sdk.link.common.exception.HDLLinkException;
import com.hdl.sdk.link.core.bean.gateway.GatewayBean;
import com.hdl.sdk.link.core.bean.request.BaseLocalRequest;
import com.hdl.sdk.link.core.bean.response.BaseLocalResponse;
import com.hdl.sdk.link.core.callback.GatewayCallBack;
import com.hdl.sdk.link.core.callback.HDLLinkCallBack;
import com.hdl.sdk.link.gateway.HDLLinkLocalGateway;
@@ -38,7 +41,7 @@
import io.reactivex.rxjava3.disposables.Disposable;
/**
 * 设备逻辑的界面
 * 设备逻辑
 */
public class HdlDeviceLogic {
    private static volatile HdlDeviceLogic sHdlDeviceLogic;
@@ -52,15 +55,15 @@
        if (list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                GatewayBean gatewayBean = list.get(i);
                if (!TextUtils.isEmpty(gatewayBean.getHomeId())
                if (gatewayBean.getMaster().equals("true")
                        && gatewayBean.getHomeId().equals(UserConfigManage.getInstance().getHomeId())) {
                    if("0101050217BBC400".equals(gatewayBean.getOid()))//测试时过滤掉无效的,后面这加代码要删除
                        continue;
                    newList.add(gatewayBean);
                }
            }
        }
        return newList;
    }
    /**
@@ -395,11 +398,17 @@
                    return;
                }
                Gson gson = new Gson();
                Type typeOfT = new TypeToken<List<OidBean>>() {
                Type typeOfT = new TypeToken<BaseLocalResponse<List<OidBean>>>() {
                }.getType();
                List<OidBean> list = gson.fromJson(json, typeOfT);
                if (linkCallBack != null) {
                    linkCallBack.onSuccess(list);
                BaseLocalResponse<List<OidBean>> baseLocalResponse = gson.fromJson(json, typeOfT);
                if (linkCallBack == null) {
                    return;
                }
                if (baseLocalResponse == null || baseLocalResponse.getObjects() == null) {
                    linkCallBack.onSuccess(new ArrayList<>());
                } else {
                    linkCallBack.onSuccess(baseLocalResponse.getObjects());
                }
            }