| | |
| | | import com.hdl.sdk.link.gateway.HDLLinkLocalGateway;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | | import java.util.concurrent.ScheduledExecutorService;
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
| | | String requestTopic = linkRequest.getCloudTopic();
|
| | | byte[] encryBytes = null;
|
| | | GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(mac);
|
| | | if (gatewayBean != null && getGatewayTypeList().contains(gatewayBean.getGatewayType())) {
|
| | | //逆变器远程mqtt秘钥不一样
|
| | | if (gatewayBean != null && getMillimeterTypeList().contains(gatewayBean.getGatewayType())) {
|
| | | /**
|
| | | * 毫米波这边获取数据的时候 已经设置了主从密钥进去了 这边不作处理
|
| | | */
|
| | | encryBytes = EncryptUtil.encryBytes(linkRequest.getCloudSendBytes(), gatewayBean.getAesKey());
|
| | | } else {
|
| | | encryBytes = EncryptUtil.encryBytes(linkRequest.getCloudSendBytes(), HDLLinkConfig.getInstance().getAesKey());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 支持毫米类型
|
| | | *
|
| | |
| | | // typeList.add("sensor.mmv_sleep");//睡眠毫米波spk
|
| | | // typeList.add("sensor.mmv_pose");//姿态毫米波spk
|
| | | typeList.add("energy.hdl_inverter");//逆变器spk
|
| | | typeList.add("sensor.mmv_sleep");//睡眠毫米波spk
|
| | | typeList.add("sensor.mmv_pose");//姿态毫米波spk
|
| | | typeList.add("sensor.hdl_mmw_pose");//Wi-Fi毫米波ZT版本
|
| | | return typeList;
|
| | | }
|
| | |
|
| | | public static List<String> getMillimeterTypeList() {
|
| | | List<String> typeList = new ArrayList<>();
|
| | | // typeList.add("AGATEWAY");//网关
|
| | | typeList.add("sensor.mmv_sleep");//睡眠毫米波spk
|
| | | typeList.add("sensor.mmv_pose");//姿态毫米波spk
|
| | | typeList.add("sensor.hdl_mmw_pose");//Wi-Fi毫米波ZT版本
|
| | | return typeList;
|
| | | }
|
| | |
|
| | | public static List<String> getNewMillimeterTypeList() {
|
| | | List<String> typeList = new ArrayList<>();
|
| | | typeList.add("sensor.hdl_mmw_pose");//Wi-Fi毫米波ZT版本
|
| | | return typeList;
|
| | | }
|
| | |
|
| | |
| | | listener = null;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public static boolean isInverterTopic(String topic) {
|
| | | if (TextUtils.isEmpty(topic)) {
|
| | | return false;
|
| | | }
|
| | | return topic.endsWith("custom/native/inverter/down_reply")
|
| | | || topic.endsWith("custom/native/inverter/down")
|
| | | || topic.endsWith("custom/native/inverter/up");
|
| | | }
|
| | |
|
| | | /**
|
| | | * byte数组转换成int数组(为了打印出无符号的btye数组数据)
|
| | | *
|
| | | * @param bytes 数组
|
| | | * @return
|
| | | */
|
| | | public static Integer[] byteArrayConvertIntArray(byte[] bytes) {
|
| | | if (bytes == null || bytes.length == 0) {
|
| | | return new Integer[]{};
|
| | | }
|
| | | Integer[] arr = new Integer[bytes.length];
|
| | | for (int i = 0; i < bytes.length; i++) {
|
| | | arr[i] = bytes[i] & 0xff;
|
| | | }
|
| | | return arr;
|
| | | }
|
| | | }
|