don't default framing method

This commit is contained in:
Joel Wetzell
2026-02-03 22:26:16 -06:00
parent 7e0c2b2560
commit b6ee3c68f1
2 changed files with 20 additions and 22 deletions

View File

@@ -43,20 +43,19 @@ func init() {
return nil, errors.New("serial.client port must be a string")
}
framingMethod := "RAW"
framingMethod, ok := params["framing"]
framingMethodRaw, ok := params["framing"]
if ok {
framingMethodString, ok := framingMethodRaw.(string)
if !ok {
return nil, errors.New("serial.client framing method must be a string")
}
framingMethod = framingMethodString
if !ok {
return nil, errors.New("serial.client requires a framing parameter")
}
framer := framer.GetFramer(framingMethod)
framingMethodString, ok := framingMethod.(string)
if !ok {
return nil, errors.New("serial.client framing method must be a string")
}
framer := framer.GetFramer(framingMethodString)
if framer == nil {
return nil, fmt.Errorf("serial.client unknown framing method: %s", framingMethod)

View File

@@ -45,20 +45,19 @@ func init() {
return nil, errors.New("net.tcp.server port must be a number")
}
framingMethod := "RAW"
framingMethod, ok := params["framing"]
framingMethodRaw, ok := params["framing"]
if ok {
framingMethodString, ok := framingMethodRaw.(string)
if !ok {
return nil, errors.New("net.tcp.server framing method must be a string")
}
framingMethod = framingMethodString
if !ok {
return nil, errors.New("net.tcp.server requires a framing parameter")
}
framer := framer.GetFramer(framingMethod)
framingMethodString, ok := framingMethod.(string)
if !ok {
return nil, errors.New("net.tcp.server framing method must be a string")
}
framer := framer.GetFramer(framingMethodString)
if framer == nil {
return nil, fmt.Errorf("net.tcp.server unknown framing method: %s", framingMethod)