| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | return newList; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前住宅的【主】逆变器列表 |
| | | */ |
| | | public GatewayBean getCurrentHomeMainGateway() { |
| | | List<GatewayBean> list = HDLLinkLocalGateway.getInstance().getGatewayList(); |
| | | if (list.size() > 0) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | GatewayBean gatewayBean = list.get(i); |
| | | if (TextUtils.isEmpty(gatewayBean.getDevice_mac())) { |
| | | continue; |
| | | } |
| | | if (gatewayBean.getMaster().equals(GatewayMasterType.MasterTrue) && gatewayBean.getHomeId().equals(UserConfigManage.getInstance().getHomeId())) { |
| | | //找到返回 |
| | | return gatewayBean; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 逆变器上传数据到云端(包括:sid,oid) |
| | |
| | | |
| | | /** |
| | | * 获取逆变器列表 |
| | | * 注意:有外网以云端设备为准,本地存在,云端没有则删除;内网以本地为主,搜索多少个设备就显示多少个; |
| | | * 注意:有外网以云端设备为准;本地存在,云端没有则删除;内网以本地为主,搜索多少个设备就显示多少个; |
| | | * |
| | | * @param cloudCallBeak 返回逆变器列表 |
| | | */ |
| | |
| | | * @param spk spk |
| | | * @param mac 设备mac |
| | | * @param cloudCallBeak 回调 |
| | | * @return - |
| | | */ |
| | | public void getDeviceRemoteInfo(String homeId, String spk, String mac, CloudCallBeak<DeviceRemoteInfo> cloudCallBeak) { |
| | | String requestUrl = HttpApi.POST_Device_RemoteInfo; |
| | |
| | | * @param deviceRemoteInfo 设备远程通讯信息 |
| | | * @param cloudInverterDeviceBean 逆变器 |
| | | */ |
| | | private static void refreshGatewayCacheData(boolean isLocal, CloudInverterDeviceBean cloudInverterDeviceBean, DeviceRemoteInfo deviceRemoteInfo) { |
| | | private void refreshGatewayCacheData(boolean isLocal, CloudInverterDeviceBean cloudInverterDeviceBean, DeviceRemoteInfo deviceRemoteInfo) { |
| | | //本地查找逆变器 |
| | | GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(cloudInverterDeviceBean.getOsn()); |
| | | if (gatewayBean == null) { |
| | |
| | | if (deviceRemoteInfo != null) { |
| | | gatewayBean.setAesKey(deviceRemoteInfo.getSecret());//设置mqtt通讯秘钥 |
| | | gatewayBean.setGatewayId(deviceRemoteInfo.getGatewayId());//设置gatewayId |
| | | //用之前的库,底层mqtt订阅,加解密会用到该参数; |
| | | //todo 设置到【库】里面,底层mqtt订阅,加解密会用到该参数; |
| | | HDLLinkConfig.getInstance().setAesKey(deviceRemoteInfo.getSecret());//设置mqtt通讯秘钥库 |
| | | HDLLinkConfig.getInstance().setGatewayId(deviceRemoteInfo.getGatewayId());//设置gatewayId |
| | | |