| | |
| | | if (mInfoMap != null) { |
| | | mInfoMap.clear(); |
| | | } |
| | | |
| | | //断开mqtt连接 |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().disConnect(); |
| | | } |
| | | // //断开mqtt连接 |
| | | // if (MqttRecvClient.getInstance() != null) { |
| | | // MqttRecvClient.getInstance().disConnect(); |
| | | // } |
| | | //断开所有tcp连接且清空连接缓存 |
| | | // TODO: 10/10/23 |
| | | // TcpSocketBoot.stopAllConnectLinkGateway(); |
| | |
| | | */ |
| | | public void initializeGateway(String mac, LinkCallBack<Boolean> linkCallBack) { |
| | | String requestUrl = TopicApi.GATEWAY_INITIALIZE_REMOTE; |
| | | JsonObject sendJsonObj = new JsonObject(); |
| | | JsonObject jObject = new JsonObject(); |
| | | jObject.addProperty("device_mac", mac); |
| | | jObject.addProperty("reset_factory", "true");//为false或无此字段,则为"清除数据" |
| | | sendJsonObj.add("objects", jObject); |
| | | TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, sendJsonObj, "", new HDLLinkCallBack() { |
| | | TcpClient.getInstance().sendDataToLinkGateway(mac, requestUrl, jObject, "", new HDLLinkCallBack() { |
| | | @Override |
| | | public void onSuccess(String json) { |
| | | if (linkCallBack != null) { |
| | |
| | | houseListAdapter.setMoveOnclickListener(new HouseListAdapter.OnMoveClickListener() { |
| | | @Override |
| | | public void onMoveClick(int position, HouseIdBean houseIdBean) { |
| | | |
| | | if (position == 0) { |
| | | return; |
| | | } |
| | | String frontHomeId = ""; |
| | | if (position > 0) { |
| | | if (position > 1) { |
| | | frontHomeId = houseListBeanIDList.get(position - 1).getHomeId(); |
| | | } |
| | | HdlResidenceLogic.getInstance().moveResidence(houseIdBean.getHomeId(), frontHomeId, new CloudCallBeak<Boolean>() { |
| | |
| | | for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).size(); i++) { |
| | | String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId()).get(i).getGatewayId(); |
| | | //字符串是自己按规则拼接的,里面注册主题时会解析字符串,只拿getGatewayId()值; |
| | | String topic = "/user/" + gatewayId + "/1"; |
| | | String topic = "/user/" + gatewayId + "/#"; |
| | | //进去住宅详情开始订阅主题 |
| | | MqttRecvClient.getInstance().checkAndsubscribeAllTopics(topic); |
| | | } |