From 4598b51c90c695c9ccbe5350a84e4a46b9d8e587 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期三, 22 五月 2024 20:19:02 +0800 Subject: [PATCH] 2024年05月22日20:18:54 --- app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java | 59 +++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 37 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java index 0563f1e..effb37d 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java @@ -1,6 +1,5 @@ package com.hdl.photovoltaic.ui.powerstation; -import android.app.job.JobInfo; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; @@ -38,7 +37,7 @@ import com.hdl.photovoltaic.other.HdlUniLogic; import com.hdl.photovoltaic.ui.adapter.DeviceInfoAdapter; import com.hdl.photovoltaic.ui.adapter.HouseInfoAdapter; -import com.hdl.photovoltaic.ui.bean.DeviceBean; +import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean; import com.hdl.photovoltaic.ui.bean.HouseIdBean; import com.hdl.photovoltaic.ui.bean.StatusOverviewBean; import com.hdl.photovoltaic.uni.HDLUniMP; @@ -50,6 +49,7 @@ import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; import com.hdl.sdk.link.core.bean.gateway.GatewayBean; import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient; +import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -70,7 +70,7 @@ private DeviceInfoAdapter deviceInfoAdapter; private List<HouseIdBean> houseListBeanIDList; - private List<DeviceBean> deviceInfoList; + private List<CloudInverterDeviceBean> deviceInfoList; private int currentHouseListPage = 0; // 褰撳墠鐢电珯鍒楄〃椤电爜 private int currentHouseListTotal = 0; // 鐢电珯鍒楄〃鎬婚〉鐮� private boolean isHouseLoadingMore = false; // 鏍囪鐢电珯鍒楄〃姝e湪鍔犺浇鏇村鏁版嵁 @@ -411,23 +411,38 @@ //璁惧鐐瑰嚮 deviceInfoAdapter.setOnclickListener(new DeviceInfoAdapter.OnClickListener() { @Override - public void onClick(int position, DeviceBean deviceBean) { - GatewayBean gatewayBean = new GatewayBean(); - gatewayBean.setCategorySecondName(deviceBean.getCategorySecondName()); - gatewayBean.setDevice_mac(deviceBean.getOsn()); - gatewayBean.setDevice_model(deviceBean.getOmodel()); - gatewayBean.setOid(deviceBean.getOid()); - gatewayBean.setGatewayId(deviceBean.getGatewayId()); - gatewayBean.setAddresses(deviceBean.getAddresses()); - gatewayBean.setSid(deviceBean.getSid()); - gatewayBean.setDeviceId(deviceBean.getDeviceId()); - gatewayBean.setDevice_name(deviceBean.getName()); - gatewayBean.setDeviceStatus(deviceBean.getDeviceStatus()); - gatewayBean.setHomeId(deviceBean.getHomeId()); - gatewayBean.setDeviceType(deviceBean.getDeviceType()); - String jsonEncryption = URLEncodingUtils.encodeURIComponent(new Gson().toJson(gatewayBean)); - String path = HDLUniMP.UNI_EVENT_OPEN_DEVICE_DETAILS + "?inverterInfo=" + jsonEncryption; - HdlUniLogic.getInstance().openUniMP(path, null); + public void onClick(int position, CloudInverterDeviceBean deviceBean) { +// GatewayBean gatewayBean = new GatewayBean(); +// gatewayBean.setCategorySecondName(deviceBean.getCategorySecondName()); +// gatewayBean.setDevice_mac(deviceBean.getOsn()); +// gatewayBean.setDevice_model(deviceBean.getOmodel()); +// gatewayBean.setOid(deviceBean.getOid()); +// gatewayBean.setGatewayId(deviceBean.getGatewayId()); +// gatewayBean.setAddresses(deviceBean.getAddresses()); +// gatewayBean.setSid(deviceBean.getSid()); +// gatewayBean.setDeviceId(deviceBean.getDeviceId()); +// gatewayBean.setDevice_name(deviceBean.getName()); +// gatewayBean.setDeviceStatus(deviceBean.getDeviceStatus()); +// gatewayBean.setHomeId(deviceBean.getHomeId()); +// gatewayBean.setSpk(deviceBean.getSpk()); +// gatewayBean.setDeviceType(deviceBean.getDeviceType()); + List<CloudInverterDeviceBean> newList = new ArrayList<>(); + newList.add(deviceBean); + // //鐩殑鏄负浜嗚幏鍙栨嬁鍒扮綉鍏矷D锛宮qtt閫氳绉橀挜绛変俊鎭紝缂撳瓨鏈湴閫嗗彉鍣ㄥ垪琛ㄩ噷闈紝鍙戦�佹暟鎹暟鎹椂鑷姩鍘荤紦瀛樺垪琛ㄩ噷闈㈠幓鏌ユ壘锛� + HdlDeviceLogic.getInstance().setDeviceRemoteInfo(newList, deviceBean.getHomeId(), new CloudCallBeak<List<GatewayBean>>() { + @Override + public void onSuccess(List<GatewayBean> obj) { + GatewayBean newGatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(deviceBean.getOsn()); + String jsonEncryption = URLEncodingUtils.encodeURIComponent(new Gson().toJson(newGatewayBean)); + String path = HDLUniMP.UNI_EVENT_OPEN_DEVICE_DETAILS + "?inverterInfo=" + jsonEncryption; + HdlUniLogic.getInstance().openUniMP(path, null); + } + + @Override + public void onFailure(HDLException e) { + + } + }); } }); //璁惧璁剧疆涓嬫媺绠ご棰滆壊 @@ -779,9 +794,9 @@ showLoading(); } //鑾峰彇浣忓畢(鐢电珯)ID鍒楄〃 - HdlDeviceLogic.getInstance().getPowerStationDeviceList("", pageNo, pageSize, new CloudCallBeak<PageNumberObject<DeviceBean>>() { + HdlDeviceLogic.getInstance().getPowerStationDeviceList("", pageNo, pageSize, new CloudCallBeak<PageNumberObject<CloudInverterDeviceBean>>() { @Override - public void onSuccess(PageNumberObject<DeviceBean> pageNumberObject) { + public void onSuccess(PageNumberObject<CloudInverterDeviceBean> pageNumberObject) { HdlThreadLogic.runMainThread(new Runnable() { @Override public void run() { -- Gitblit v1.8.0