feat: 添加串口连接类型参数。

main v1.1.3
NoahLan 1 year ago
parent ba3df17bc4
commit 3bc9c095df

@ -34,8 +34,9 @@ const (
type ConnType int
const (
ConnTypeTCP ConnType = iota // TCP connection
ConnTypeWS // Websocket connection
ConnTypeTCP ConnType = iota // TCP connection
ConnTypeWS // Websocket connection
ConnTypeSerial // Websocket connection
)
type (
@ -102,9 +103,13 @@ func NewConnection(
chSend: make(chan PendingMessage, 128),
chWrite: make(chan []byte, 128),
}
_, ok := conn.(*WSConn)
if ok {
if _, ok := conn.(*WSConn); ok {
r.typ = ConnTypeWS
return r
}
if _, ok := conn.(*SerialConn); ok {
r.typ = ConnTypeSerial
return r
}
return r
}

Loading…
Cancel
Save