app/src/main/java/com/hdl/photovoltaic/enums/DeviceType.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/bean/LinkAttributeBean.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/bean/LinkBean.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/bean/MessageBean.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/MessageCenterListAdapter.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/com/hdl/photovoltaic/enums/DeviceType.java
New file @@ -0,0 +1,9 @@ package com.hdl.photovoltaic.enums; public @interface DeviceType { String inv = "INV";//逆变器 String bms = "BMS";//BMS控制盒 String battery = "BATTERY";//电池单元 } app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -43,6 +43,7 @@ import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean; import com.hdl.photovoltaic.ui.bean.DeviceTimeBean; import com.hdl.photovoltaic.ui.bean.Geolocation; import com.hdl.photovoltaic.ui.bean.LinkBean; import com.hdl.photovoltaic.ui.bean.OidBean; import com.hdl.photovoltaic.ui.me.AsRegardsActivity; import com.hdl.photovoltaic.ui.me.PersonalDataActivity; @@ -58,6 +59,7 @@ import com.hdl.sdk.link.common.exception.HDLLinkException; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; import com.hdl.sdk.link.core.bean.gateway.GatewayBean; 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.core.callback.ModbusCallBack; @@ -1587,7 +1589,6 @@ String mac = getKeyValue("mac", getKeyValue("data", data)); String attribute_data = getKeyValue("attribute_data", getKeyValue("data", data)); JsonArray jay = new JsonArray(); //{"id":"c2d8b26b-3371-4fed-a190-78da31b454cf","time_stamp":"1711531144489","objects":[{"sid":"010126005C000251333036333237"}]} if (!TextUtils.isEmpty(attribute_data)) { try { Gson gson = new Gson(); @@ -1601,7 +1602,15 @@ TcpClient.getInstance().sendDataToLinkGateway(mac, TopicApi.PROPERTY_READ, jay, "", new HDLLinkCallBack() { @Override public void onSuccess(String msg) { uniCallbackData(type, msg, callback); try { Gson gson = new Gson(); Type typeOfT = new TypeToken<BaseLocalResponse<List<LinkBean>>>() { }.getType(); BaseLocalResponse<List<LinkBean>> baseLocalResponse = gson.fromJson(msg, typeOfT); uniCallbackData(type, baseLocalResponse, callback); } catch (Exception e) { uniCallbackData(type, msg, -2, "", callback); } } @Override app/src/main/java/com/hdl/photovoltaic/ui/bean/LinkAttributeBean.java
New file @@ -0,0 +1,30 @@ package com.hdl.photovoltaic.ui.bean; import java.io.Serializable; public class LinkAttributeBean implements Serializable { /** * key : generator_power * value : 0.0 */ private String key; private String value; public String getKey() { return key == null ? "" : key; } public void setKey(String key) { this.key = key; } public String getValue() { return value == null ? "" : value; } public void setValue(String value) { this.value = value; } } app/src/main/java/com/hdl/photovoltaic/ui/bean/LinkBean.java
New file @@ -0,0 +1,65 @@ package com.hdl.photovoltaic.ui.bean; import java.io.Serializable; import java.util.ArrayList; import java.util.List; public class LinkBean implements Serializable { /** * sid : 010126005C000251333036333237 * name : ECU * spk : energy.hdl_inverter * online : true */ private String sid; private String name; private String spk; private String online; private List<LinkAttributeBean> status; public String getSid() { return sid == null ? "" : sid; } public void setSid(String sid) { this.sid = sid; } public String getName() { return name == null ? "" : name; } public void setName(String name) { this.name = name; } public String getSpk() { return spk == null ? "" : spk; } public void setSpk(String spk) { this.spk = spk; } public String getOnline() { return online == null ? "" : online; } public void setOnline(String online) { this.online = online; } public List<LinkAttributeBean> getStatus() { return status == null ? new ArrayList<>() : status; } public void setStatus(List<LinkAttributeBean> status) { this.status = status; } } app/src/main/java/com/hdl/photovoltaic/ui/bean/MessageBean.java
@@ -19,6 +19,11 @@ private String deviceOid;//设备oid private String deviceDesc;//设备备注 private String deviceType;//设备类型(INV : 逆变器, BMS : BMS控制盒, BATTERY : 电池单元) private String deviceTypeDesc;//设备类型描述 private String typeDesc;//类型描述 private String effectScope;//影响范围 NO_EFFECT : 无影响范围报警 private String effectScopeDesc;//影响范围描述 @@ -30,6 +35,22 @@ private HouseInfoBean.Location location = new HouseInfoBean.Location();//电站地址 public String getDeviceType() { return deviceType == null ? "" : deviceType; } public void setDeviceType(String deviceType) { this.deviceType = deviceType; } public String getDeviceTypeDesc() { return deviceTypeDesc == null ? "" : deviceTypeDesc; } public void setDeviceTypeDesc(String deviceTypeDesc) { this.deviceTypeDesc = deviceTypeDesc; } public String getDeviceOidId() { return deviceOidId == null ? "" : deviceOidId; } app/src/main/java/com/hdl/photovoltaic/ui/newC/adapter/MessageCenterListAdapter.java
@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.enums.DeviceType; import com.hdl.photovoltaic.enums.MessageAlarmStateType; import com.hdl.photovoltaic.ui.bean.MessageBean; import com.hdl.photovoltaic.utils.TimeUtils; @@ -43,9 +44,9 @@ @Override public void onBindViewHolder(@NonNull MessageCenterListAdapter.MyViewHolder holder, int position) { MessageBean messageBean = this.mList.get(position); holder.item_home_name_tv.setText(messageBean.getTitle()); String strName = messageBean.getType() + "(" + messageBean.getDeviceDesc() + ")"; holder.item_content_tv.setText(strName); holder.item_content_tv.setText(messageBean.getTitle()); String strName = getDeviceTypeStr(messageBean.getDeviceType()) + "(" + messageBean.getDeviceDesc() + ")"; holder.item_home_name_tv.setText(strName); String date = TimeUtils.getTimeFromTimestamp(messageBean.getCreateTime()); holder.item_time_tv.setText(date); String type = "";//FAULT:故障,WARN:告警,EVENT:事件 @@ -99,6 +100,25 @@ notifyDataSetChanged(); } /** * 通过枚举转换设备类型的字符 * * @param deviceType //设备类型(INV : 逆变器, BMS : BMS控制盒, BATTERY : 电池单元) * @return 设备类型 */ private String getDeviceTypeStr(String deviceType) { switch (deviceType) { case DeviceType.inv: return mContext.getString(R.string.alarm_all_device_inverter); case DeviceType.bms: return mContext.getString(R.string.alarm_all_device_bms); case DeviceType.battery: return mContext.getString(R.string.alarm_all_device_battery_cell); default: return ""; } } public void setNoOnclickListener(OnclickListener onClickListener) { this.mOnClickListener = onClickListener; @@ -124,4 +144,6 @@ public interface OnclickListener { void onClick(int position, MessageBean messageBean); } }