public class Bx5GServer extends Object
Bx5GServer server = new Bx5GServer("TEST", 8001);
server.addListener(new AppListener());
server.start();
public class AppListener implements Bx5GServerListener {
public void connected(String socketId, String netId, Bx5GScreen screen) {
// 设备连线,相关资讯包括:
// socketId: Socket 编号。
// netId: 控制器 Net 编号,唯一識別碼。
// screen: 屏幕控制程式。
}
public void disconnected(String socketId, String netId, Bx5GScreen screen) {
// 设备断线,相关资讯包括:
// socketId: Socket 编号。
// netId: 控制器 Net 编号,唯一識別碼。
// screen: 屏幕控制程式。
}
}
Constructor and Description |
---|
Bx5GServer(String aliasName,
int port)
建构子。
|
Bx5GServer(String aliasName,
int port,
Bx5G bx5g)
建构子。
|
Bx5GServer(String aliasName,
int port,
Bx5G bx5g,
int idleTime)
建构子。
|
Bx5GServer(String aliasName,
int port,
Bx5G bx5g,
int idleTime,
uia.comm.SocketServer.ConnectionStyle cs)
建构子。
|
Bx5GServer(String aliasName,
int port,
Bx5G bx5g,
uia.comm.SocketServer.ConnectionStyle cs)
建构子。
|
Bx5GServer(String aliasName,
int port,
uia.comm.SocketServer.ConnectionStyle cs)
建构子。
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(Bx5GServerListener listener)
增加监听器。
|
void |
clearListeners()
清除所有监听器。
|
void |
disconnect(String socketId) |
Set<String> |
getOnlineNetIds()
取得目前上线控制器 Net 编号清单, GPRS 設備的的 Net 编号等於 DTU 编号。
|
Bx5GScreen |
getOnlineScreenByNetId(String netId)
根據 Net 编号或是 GPRS 的 DTU 编号取得上线包括還未收到心跳包的的屏幕控制程式。
|
Bx5GScreen |
getOnlineScreenBySocketId(String socketId)
取得上线包括還未收到心跳包的屏幕控制程式。
|
Collection<Bx5GScreen> |
getOnlineScreens()
取得上线包括還未收到心跳包的所有屏幕控制程式。
|
Set<String> |
getOnlineSocketIds()
取得目前上线包括還未收到心跳包的屏幕的 Socket 编号 (识别编号)。
|
Set<String> |
getReadyNetIds()
取得目前上线且有效的屏幕 Net 编号清单, GPRS 設備的的 Net 编号等於 DTU 编号。
|
Collection<Bx5GScreen> |
getReadyScreens()
取得上线且有效的所有屏幕控制程式。
|
Set<String> |
getReadySocketIds()
取得目前上线且有效的屏幕 Socket 编号 (识别编号)。
|
boolean |
isIgnoreConnectedEvent()
取得是否忽略上線通知。
|
boolean |
isIgnoreDisconnectedEvent()
取得是否忽略上線通知。
|
void |
removeListener(Bx5GServerListener listener)
移除监听器。
|
void |
setIgnoreConnectedEvent(boolean ignoreConnectedEvent)
設定是否忽略上線通知。
|
void |
setIgnoreDisconnectedEvent(boolean ignoreDisconnectedEvent)
設定是否忽略斷線通知。
|
boolean |
start()
启动服务。
|
void |
stop()
停止服务。
|
public Bx5GServer(String aliasName, int port) throws Exception
aliasName
- 名稱port
- 通訊埠。Exception
- 發生錯誤。public Bx5GServer(String aliasName, int port, uia.comm.SocketServer.ConnectionStyle cs) throws Exception
aliasName
- 名稱port
- 通訊埠。cs
- 連線模式。Exception
- 發生錯誤。public Bx5GServer(String aliasName, int port, Bx5G bx5g) throws Exception
aliasName
- 名稱port
- 通訊埠。bx5g
- 控制器類型。Exception
- 發生錯誤。public Bx5GServer(String aliasName, int port, Bx5G bx5g, uia.comm.SocketServer.ConnectionStyle cs) throws Exception
aliasName
- 名稱port
- 通訊埠。bx5g
- 控制器類型。cs
- 連線模式。Exception
- 發生錯誤。public Bx5GServer(String aliasName, int port, Bx5G bx5g, int idleTime) throws Exception
aliasName
- 名稱port
- 通訊埠。bx5g
- 控制器類型。idleTime
- 檢查週期。Exception
- 發生錯誤。public boolean isIgnoreConnectedEvent()
public void setIgnoreConnectedEvent(boolean ignoreConnectedEvent)
ignoreConnectedEvent
- 是否忽略上線通知。public boolean isIgnoreDisconnectedEvent()
public void setIgnoreDisconnectedEvent(boolean ignoreDisconnectedEvent)
ignoreDisconnectedEvent
- 是否忽略斷線通知。public boolean start()
public void stop()
public void addListener(Bx5GServerListener listener)
listener
- 监听器。public void removeListener(Bx5GServerListener listener)
listener
- 监听器。public void clearListeners()
public Collection<Bx5GScreen> getOnlineScreens()
public Bx5GScreen getOnlineScreenBySocketId(String socketId)
socketId
- Socket 编号 (识别编号)。public Bx5GScreen getOnlineScreenByNetId(String netId)
netId
- 控制器 Net 编号或是 GPRS 的 DTU 编号。public Set<String> getOnlineSocketIds()
public Set<String> getOnlineNetIds()
public Collection<Bx5GScreen> getReadyScreens()
public Set<String> getReadySocketIds()
public Set<String> getReadyNetIds()
public void disconnect(String socketId)
Copyright © 2020 onbon4j. All rights reserved.