| | |
| | | import com.hdl.sdk.link.common.utils.gson.GsonConvert; |
| | | import com.hdl.sdk.link.core.config.HDLLinkConfig; |
| | | import com.hdl.sdk.link.core.protocol.LinkMessageDecoder; |
| | | import com.hdl.sdk.link.core.protocol.LinkMessageDecoderUdp; |
| | | import com.hdl.sdk.link.core.protocol.LinkMessageEncoder; |
| | | import com.hdl.sdk.link.socket.client.UdpClient; |
| | | import com.hdl.sdk.link.socket.codec.MessagePipeLine; |
| | |
| | | .getSystemService(Context.WIFI_SERVICE); |
| | | options.setWifiManager(manager); |
| | | final MessagePipeLine pipeLine = new MessagePipeLine(); |
| | | pipeLine.add(new LinkMessageDecoder()); |
| | | pipeLine.add(new LinkMessageEncoder()); |
| | | pipeLine.add(new LinkMessageDecoderUdp()); |
| | | // pipeLine.add(new LinkMessageEncoder()); |
| | | options.setHandleMessage(pipeLine); |
| | | return options; |
| | | } |
| | |
| | | }.getType()); |
| | | GatewayBean gateway = response.getObjects(); |
| | | if (gateway != null) { |
| | | if (!TextUtils.isEmpty(HDLLinkConfig.getInstance().getGatewayId()) |
| | | && !TextUtils.isEmpty(HDLLinkConfig.getInstance().getHomeId())) { |
| | | // if (!TextUtils.isEmpty(HDLLinkConfig.getInstance().getGatewayId()) |
| | | // && !TextUtils.isEmpty(HDLLinkConfig.getInstance().getHomeId())) { |
| | | // //主网关并且是当前绑定的网关 |
| | | // if ("true".equals(gateway.getMaster().toLowerCase())) { |
| | | // if (gateway.getGatewayId().equals(HDLLinkConfig.getInstance().getGatewayId()) |
| | | // || gateway.getDevice_mac().equals(HDLLinkConfig.getInstance().getGatewayId()) |
| | | // || gateway.getOid().equals(HDLLinkConfig.getInstance().getGatewayId()) |
| | | // || gateway.getHomeId().equals(HDLLinkConfig.getInstance().getHomeId())) { |
| | | // HDLLinkConfig.getInstance().setLocalEncrypt(gateway.getIsLocalEncrypt());//设置是否加密 |
| | | // HDLLinkConfig.getInstance().setIpAddress(gateway.getIp_address()); |
| | | // //更新当前网关的信息 |
| | | // HDLLinkConfig.getInstance().reSaveConfig(); |
| | | // } |
| | | // } |
| | | if (!TextUtils.isEmpty(gateway.getHomeId())) { |
| | | //主网关并且是当前绑定的网关 |
| | | if ("true".equals(gateway.getMaster().toLowerCase())) { |
| | | if (gateway.getGatewayId().equals(HDLLinkConfig.getInstance().getGatewayId()) |
| | | || gateway.getDevice_mac().equals(HDLLinkConfig.getInstance().getGatewayId()) |
| | | || gateway.getOid().equals(HDLLinkConfig.getInstance().getGatewayId()) |
| | | || gateway.getHomeId().equals(HDLLinkConfig.getInstance().getHomeId())) { |
| | | if (gateway.getHomeId().equals(HDLLinkConfig.getInstance().getHomeId())) { |
| | | HDLLinkConfig.getInstance().setLocalEncrypt(gateway.getIsLocalEncrypt());//设置是否加密 |
| | | HDLLinkConfig.getInstance().setIpAddress(gateway.getIp_address()); |
| | | //更新当前网关的信息 |