mac
2023-12-21 f9956641e92cce3ece4cdff523a6e453f159d268
app/src/main/java/com/hdl/photovoltaic/other/HdlDeviceLogic.java
@@ -6,22 +6,7 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.hdl.hdlhttp.HxHttp;
import com.hdl.linkpm.sdk.core.api.HDLCloudHomeApi;
import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack;
import com.hdl.linkpm.sdk.core.callback.IResponseCallBack;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.linkpm.sdk.core.response.HDLResponse;
import com.hdl.linkpm.sdk.device.bean.DeviceOidInfoBean;
import com.hdl.linkpm.sdk.device.bean.GatewayCloudBean;
import com.hdl.linkpm.sdk.ota.HDLLinkPMOta;
import com.hdl.linkpm.sdk.ota.bean.CloudDeviceFirmwaresBean;
import com.hdl.linkpm.sdk.ota.bean.CloudGatewayDriversBean;
import com.hdl.linkpm.sdk.ota.bean.DeviceFirmwareBean;
import com.hdl.linkpm.sdk.ota.bean.DownloadUrlBean;
import com.hdl.linkpm.sdk.ota.bean.GatewayDriverBean;
import com.hdl.linkpm.sdk.project.HDLLinkPMProject;
import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils;
import com.hdl.photovoltaic.config.AppConfigManage;
import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.internet.HttpClient;
@@ -45,15 +30,11 @@
import com.hdl.sdk.link.gateway.HDLLinkLocalGateway;
import com.hdl.sdk.link.gateway.type.GatewayMasterType;
import org.json.JSONException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import io.dcloud.feature.unimp.DCUniMPJSCallback;
import io.reactivex.rxjava3.disposables.Disposable;
/**
@@ -685,7 +666,7 @@
                                //云端也没有逆变器列表,返回空列表回去
                                cloudCallBeak.onSuccess(new ArrayList<>());
                            }
                            HdlLogLogic.print("在只有【外网】情况下获取云端逆变器列表返回空列表",true);
                            HdlLogLogic.print("在只有【外网】情况下获取云端逆变器列表返回空列表", true);
                            return;
                        }
                        //记录条数
@@ -846,14 +827,43 @@
    }
    /**
     * 判断是本地连接
     * 检测本地连接状态
     *
     * @param deviceMac 设备mac
     * @return true=本地连接
     * @param deviceMac 设备mac,
     * @param callBeak  返回 true=本地连接;false=远程;
     */
    public boolean isLocalConnect(String deviceMac) {
        GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(deviceMac);
        return gatewayBean == null;
    public void isLocalConnect(String deviceMac, CloudCallBeak<Boolean> callBeak) {
        searchCurrentHomeGateway(new GatewayCallBack() {
            @Override
            public void onSuccess(List<GatewayBean> gatewayBeanList) {
                if (gatewayBeanList == null || gatewayBeanList.size() == 0) {
                    if (callBeak != null) {
                        callBeak.onSuccess(false);
                    }
                    return;
                }
                boolean is_find = false;
                for (int i = 0; i < gatewayBeanList.size(); i++) {
                    GatewayBean gatewayBean = gatewayBeanList.get(i);
                    if (gatewayBean.getDevice_mac().equals(deviceMac)) {
                        is_find = true;
                        break;
                    }
                }
                if (callBeak != null) {
                    callBeak.onSuccess(is_find);
                }
            }
            @Override
            public void onError(HDLLinkException e) {
                if (callBeak != null) {
                    callBeak.onSuccess(false);
                }
            }
        });
    }
    /**
@@ -929,7 +939,7 @@
        gatewayBean.setSystemStatusDesc(cloudInverterDeviceBean.getSystemStatusDesc());//设备状态
        gatewayBean.setHwVersion(cloudInverterDeviceBean.getHwVersion());//软件版本号
        gatewayBean.setCategorySecondName(cloudInverterDeviceBean.getCategorySecondName());//设备类型(产品二级分类名称
        gatewayBean.setAddresses(cloudInverterDeviceBean.getAddresses());//子网号/设备号
        gatewayBean.setAddresses(cloudInverterDeviceBean.getAddresses());//子网号/设备号,逆变器地址
        gatewayBean.setPowerPvNow(cloudInverterDeviceBean.getPowerPvNow());//发电功率
        gatewayBean.setTotalElectricityPvToday(cloudInverterDeviceBean.getTotalElectricityPvToday());//今日发电量
        gatewayBean.setDevice_model(cloudInverterDeviceBean.getOmodel());//设备型号