[change] 连接工控机配置添加 注册取消注册数据回调接口参数
This commit is contained in:
@@ -37,6 +37,7 @@ import com.zhidao.support.adas.high.queue.WSByteQueueManager;
|
||||
import com.zhidao.support.adas.high.queue.WebSocketQueueManager;
|
||||
import com.zhidao.support.adas.high.socket.FpgaSocket;
|
||||
import com.zhidao.support.adas.high.subscribe.SubscribeInterface;
|
||||
import com.zhidao.support.adas.high.subscribe.SubscribeInterfaceOptions;
|
||||
import com.zhidao.support.adas.high.thread.DispatchHandler;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
@@ -406,6 +407,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
ipcConnectedPort = port;
|
||||
subscribeInterface = new SubscribeInterface(this);
|
||||
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.CONNECTED, "已连接");
|
||||
//根据连接配置 进行接口订阅或取消订阅配置
|
||||
if (adasOptions != null) {
|
||||
SubscribeInterfaceOptions options = adasOptions.getSubscribeInterfaceOptions();
|
||||
if (options != null && options.getMessageTypes() != null && !options.getMessageTypes().isEmpty()) {
|
||||
subscribeInterface.subscribeInterface(options.getRole(), options.getType(), options.getMessageTypes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zhidao.support.adas.high;
|
||||
|
||||
import com.zhidao.support.adas.high.subscribe.SubscribeInterfaceOptions;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
@@ -43,6 +45,11 @@ public class AdasOptions {
|
||||
*/
|
||||
private HashSet<String> ipcFixationIP;
|
||||
|
||||
/**
|
||||
* 订阅相关配置
|
||||
*/
|
||||
private SubscribeInterfaceOptions subscribeInterfaceOptions;
|
||||
|
||||
private AdasOptions() {
|
||||
}
|
||||
|
||||
@@ -72,6 +79,17 @@ public class AdasOptions {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置连接方式
|
||||
*
|
||||
* @param ipcConnectionMode
|
||||
* @return
|
||||
*/
|
||||
public Builder setIpcConnectionMode(int ipcConnectionMode) {
|
||||
options.ipcConnectionMode = ipcConnectionMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置IPC主机地址
|
||||
*
|
||||
@@ -96,13 +114,13 @@ public class AdasOptions {
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置连接方式
|
||||
* 接口注册参数
|
||||
*
|
||||
* @param ipcConnectionMode
|
||||
* @param subscribeInterfaceOptions
|
||||
* @return
|
||||
*/
|
||||
public Builder setIpcConnectionMode(int ipcConnectionMode) {
|
||||
options.ipcConnectionMode = ipcConnectionMode;
|
||||
public Builder setSubscribeInterfaceOptions(SubscribeInterfaceOptions subscribeInterfaceOptions) {
|
||||
options.subscribeInterfaceOptions = subscribeInterfaceOptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -122,6 +140,7 @@ public class AdasOptions {
|
||||
options.isClient = true;
|
||||
options.ipcAssignIP = null;
|
||||
options.ipcFixationIP = null;
|
||||
options.subscribeInterfaceOptions = null;
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -141,6 +160,10 @@ public class AdasOptions {
|
||||
return ipcFixationIP;
|
||||
}
|
||||
|
||||
public SubscribeInterfaceOptions getSubscribeInterfaceOptions() {
|
||||
return subscribeInterfaceOptions;
|
||||
}
|
||||
|
||||
public void setIpcAssignIP(String ipcAssignIP) {
|
||||
this.ipcAssignIP = ipcAssignIP;
|
||||
}
|
||||
@@ -156,4 +179,8 @@ public class AdasOptions {
|
||||
public void setIpcFixationIP(HashSet<String> ipcFixationIP) {
|
||||
this.ipcFixationIP = ipcFixationIP;
|
||||
}
|
||||
|
||||
public void setSubscribeInterfaceOptions(SubscribeInterfaceOptions subscribeInterfaceOptions) {
|
||||
this.subscribeInterfaceOptions = subscribeInterfaceOptions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.zhidao.support.adas.high.subscribe;
|
||||
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.Define;
|
||||
import com.zhidao.support.adas.high.common.MessageType;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 订阅参数
|
||||
*/
|
||||
public class SubscribeInterfaceOptions {
|
||||
@Define.TerminalRole
|
||||
private int role = Constants.TERMINAL_ROLE.DRIVER;
|
||||
@Define.SubscribeType
|
||||
private int type = Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE;
|
||||
private Set<MessageType> messageTypes;
|
||||
|
||||
private SubscribeInterfaceOptions() {
|
||||
}
|
||||
|
||||
public int getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Set<MessageType> getMessageTypes() {
|
||||
return messageTypes;
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
@Define.TerminalRole
|
||||
private int role;
|
||||
@Define.SubscribeType
|
||||
private int type;
|
||||
private Set<MessageType> messageTypes;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder setRole(@Define.TerminalRole int role) {
|
||||
this.role = role;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setType(@Define.SubscribeType int type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMessageTypes(Set<MessageType> messageTypes) {
|
||||
this.messageTypes = messageTypes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SubscribeInterfaceOptions build() {
|
||||
SubscribeInterfaceOptions options = new SubscribeInterfaceOptions();
|
||||
options.role = role;
|
||||
options.type = type;
|
||||
options.messageTypes = messageTypes;
|
||||
return options;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user