| | |
| | | }else {
|
| | | notifyFailure(ErrorUtils.getByCode(code));
|
| | | }
|
| | | }
|
| | | else if (msg instanceof ZigbeeResponse) {
|
| | | } else if (msg instanceof ZigbeeResponse) {
|
| | | ZigbeeResponse linkResponse = (ZigbeeResponse) msg;
|
| | | //TODO 如果配置从网关的信息,通过主网关转达,这里oid要判断下
|
| | | if (replyTopic.equals(linkResponse.getTopic())) {
|
| | | notifySucceed(linkResponse.getData());
|
| | | }
|
| | | else{
|
| | | } else {
|
| | | notifyFailure(HDLLinkCode.HDL_TOPIC_NOT_RIGHT);
|
| | | }
|
| | | }else if(msg instanceof ModbusResponse){
|
| | | ModbusResponse response = (ModbusResponse) msg;
|
| | | if (replyTopic.equals(response.getTopic())) {
|
| | | notifySucceed(response.getData());
|
| | | }
|
| | | else{
|
| | | } else {
|
| | | notifyFailure(HDLLinkCode.HDL_TOPIC_NOT_RIGHT);
|
| | | }
|
| | | }
|
| | | else{
|
| | | } else {
|
| | | notifyFailure(new HDLLinkCode(HDLLinkCode.HDL_OBJECT_NOT_SUPPORT.getCode(), "Object Name:" + msg));
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 发送一次
|
| | | *
|
| | |
| | | public HDLConnectHelper(Long timeout,String ipAddress, LinkRequest linkRequest, boolean isTcp) {
|
| | | this(timeout, DEF_SEND_ONE, ipAddress, isTcp ? TCP_PORT : UDP_PORT, linkRequest, null, isTcp);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | byte[] encryBytes = null;
|
| | | GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(mac);
|
| | | if (gatewayBean != null && getGatewayTypeList().contains(gatewayBean.getGatewayType())) {
|
| | | //毫米波远程mqtt秘钥不一样
|
| | | //逆变器远程mqtt秘钥不一样
|
| | | encryBytes = EncryptUtil.encryBytes(linkRequest.getCloudSendBytes(), gatewayBean.getAesKey());
|
| | | } else {
|
| | | encryBytes = EncryptUtil.encryBytes(linkRequest.getCloudSendBytes(), HDLLinkConfig.getInstance().getAesKey());
|