mirror of
https://github.com/jwetzell/osc-go.git
synced 2026-08-06 15:53:38 +00:00
implement slip encoding
This commit is contained in:
+19
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user