implement slip encoding

This commit is contained in:
2024-09-29 14:36:36 -05:00
parent 43637248b7
commit decf191e3f
+19 -2
View File
@@ -202,8 +202,25 @@ func argToTypedArg(rawArg string, oscType string) OSCArg {
}
func slipEncode(bytes []byte) []byte {
//TODO(jwetzell): implement slip encoding
return bytes
END := byte(0xc0)
ESC := byte(0xdb)
ESC_END := byte(0xdc)
ESC_ESC := byte(0xdd)
var encodedBytes = []byte{}
for _, byteToEncode := range bytes {
if byteToEncode == END {
encodedBytes = append(encodedBytes, ESC_END)
} else if byteToEncode == ESC {
encodedBytes = append(encodedBytes, ESC_ESC)
} else {
encodedBytes = append(encodedBytes, byteToEncode)
}
}
encodedBytes = append(encodedBytes, END)
return encodedBytes
}
func send(host string, port int32, address string, args []string, types []string, protocol string, slip bool) {