| | |
| | | import android.os.Process; |
| | | import android.os.SystemClock; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | |
| | | import com.google.gson.Gson; |
| | |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.ActivityCpowerStationBinding; |
| | | import com.hdl.photovoltaic.enums.LowerTagType; |
| | | import com.hdl.photovoltaic.enums.NetworkType; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlCommonLogic; |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlMqttLogic; |
| | |
| | | import com.hdl.sdk.link.core.config.HDLLinkConfig; |
| | | import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.greenrobot.eventbus.ThreadMode; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import cn.jpush.android.api.JPushInterface; |
| | |
| | | } else if (event.getTopic().contains(HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL) && event.getType().contains(HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK)) { |
| | | //物理按键返回事件(包括左滑移除事件) |
| | | killProcessApp(); |
| | | } else if (event.getTopic().contains(HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL) && event.getType().contains(HDLUniMP.UNI_EVENT_REPLY_HOME_DEl)) { |
| | | //C端电站详情里面删除后,会跑来这里; |
| | | startAppAutomaticallyOpenUni(false); |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST.equals(event.getType())) { |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().removeAllTopic(); |
| | | } |
| | | String homeId = event.getData().toString(); |
| | | //进去住宅详情uni读取逆变器列表成功后通知 |
| | | for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) { |
| | | String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId(); |
| | | //字符串是自己按规则拼接的,里面注册主题时会解析字符串,只拿getGatewayId()值; |
| | | String topic = "/user/" + gatewayId + "/#"; |
| | | //进去住宅详情开始订阅主题 |
| | | MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topic);//订阅【逆变器】消息 |
| | | |
| | | } |
| | | String topicHome = "/user/" + homeId + "/#"; |
| | | MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topicHome);//订阅【电站】消息 |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | List<HouseIdBean> HouseIdList = HdlResidenceLogic.getInstance().getHouseIdList(); |
| | | if (HouseIdList.size() == 0) { |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_Null_C; |
| | | if (delay) { |
| | | HdlUniLogic.getInstance().openUniMPDelay(path, null); |
| | | } else { |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | } |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | } else { |
| | | int select_home = 0; |
| | | for (int i = 0; i < HouseIdList.size(); i++) { |
| | |
| | | HouseIdBean houseIdBean = HouseIdList.get(select_home); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean); |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); |
| | | if (delay) { |
| | | HdlUniLogic.getInstance().openUniMPDelay(path, null); |
| | | } else { |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | } |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | } |
| | | } |
| | | |