| | |
| | | LinkRequest linkRequest, HdlSocketListener listener, boolean isTcp) {
|
| | | this(sendAwaitTime,maxRetry,ipAddress,port,linkRequest,listener,isTcp,false);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 发送UDP或者TCP数据
|
| | | *
|
| | |
| | | } else if(object instanceof RealLinkResponse){
|
| | | //真实的link数据,不包含透传的原生数据
|
| | | notifySucceed(object);
|
| | | }
|
| | | else {
|
| | | } else {
|
| | | notifyFailure(new HDLLinkCode(HDLLinkCode.HDL_OBJECT_NOT_SUPPORT.getCode(), "Object Name:" + object));
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
| | | if (!TextUtils.isEmpty(replyTopic) && null != listener) {
|
| | | if(useSubThread){//使用子线程回调
|
| | | EventDispatcher.getInstance().asyncRegister(replyTopic, eventListener);
|
| | | }
|
| | | else {
|
| | | } else {
|
| | | //默认用主线程
|
| | | EventDispatcher.getInstance().register(replyTopic, eventListener);
|
| | | }
|
| | |
| | |
|
| | | //如是tcp或者mqtt
|
| | | if (isTcp) {
|
| | | //BMS设备支持远程发送命令,不支持本地命令,听说后面会调整也是本地发送
|
| | | GatewayBean gateway = HDLLinkLocalGateway.getInstance().getLocalGateway(mac);
|
| | | boolean isSupportLocalSendCommands = gateway != null && gateway.isSupportLocalSendCommands();
|
| | | //mqtt
|
| | | if (TextUtils.isEmpty(ipAddress) || !HDLTcpConnect.getTcpSocketBoot(ipAddress).isConnected()) {
|
| | | if (TextUtils.isEmpty(ipAddress) || !HDLTcpConnect.getTcpSocketBoot(ipAddress).isConnected() || !isSupportLocalSendCommands) {
|
| | | if (!linkRequest.getTopic().endsWith("heartbeat")) {//心跳主题数据过多,过滤下
|
| | | //LogUtils.i("心跳包发送数据:\r\n" + new String(linkRequest.getCloudSendBytes()));
|
| | | } else {
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | // /**
|
| | | // * 支持毫米类型
|
| | | // *
|
| | |
| | | // */
|
| | | // public static List<String> getGatewayTypeList() {
|
| | | // List<String> typeList = new ArrayList<>();
|
| | |
|
| | | //// typeList.add("sensor.mmv_sleep");//睡眠毫米波spk
|
| | | //// typeList.add("sensor.mmv_pose");//姿态毫米波spk
|
| | | // typeList.add("energy.hdl_inverter");//逆变器spk
|
| | |
| | |
|
| | | /**
|
| | | * 获取除了网关的其它网络设备,上面写的那两个方法不一致getGatewayTypeList,getMillimeterTypeList,统一了下,以免后期出问题
|
| | | *
|
| | | * @return
|
| | | */
|
| | | public static List<String> getNotGatewayTypeList(){
|
| | |
| | | listener = null;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public static boolean isInverterTopic(String topic) {
|