Skip to content

Commit 8f9ff20

Browse files
committed
Partially revert #e80400b7ddbbc2e8f34f1e6701b55102c3a99289
1 parent 2d78733 commit 8f9ff20

6 files changed

+2
-20
lines changed

bufferflow.go

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type Bufferflow interface {
1919
Init()
2020
BlockUntilReady(cmd string, id string) (bool, bool) // implement this method
2121
//JustQueue(cmd string, id string) bool // implement this method
22-
OnIncomingDataBinary(data []byte)
2322
OnIncomingData(data string) // implement this method
2423
ClearOutSemaphore() // implement this method
2524
BreakApartCommands(cmd string) []string // implement this method

bufferflow_default.go

-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ func (b *BufferflowDefault) BlockUntilReady(cmd string, id string) (bool, bool)
2020
return true, false
2121
}
2222

23-
// not implemented, we are gonna use OnIncomingData
24-
func (b *BufferflowDefault) OnIncomingDataBinary(data []byte) {
25-
}
26-
2723
func (b *BufferflowDefault) OnIncomingData(data string) {
2824
//log.Printf("OnIncomingData() start. data:%v\n", data)
2925
}

bufferflow_timed.go

-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ func (b *BufferflowTimed) BlockUntilReady(cmd string, id string) (bool, bool) {
6161
return true, false
6262
}
6363

64-
// not implemented, we are gonna use OnIncomingData
65-
func (b *BufferflowTimed) OnIncomingDataBinary(data []byte) {
66-
}
67-
6864
func (b *BufferflowTimed) OnIncomingData(data string) {
6965
b.Input <- data
7066
}

bufferflow_timedbinary.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ func (b *BufferflowTimedBinary) BlockUntilReady(cmd string, id string) (bool, bo
5757
return true, false
5858
}
5959

60-
func (b *BufferflowTimedBinary) OnIncomingDataBinary(data []byte) {
61-
b.Input <- data
62-
}
63-
6460
// not implemented, we are gonna use OnIncomingDataBinary
6561
func (b *BufferflowTimedBinary) OnIncomingData(data string) {
62+
b.Input <- []byte(data)
6663
}
6764

6865
// Clean out b.sem so it can truly block

bufferflow_timedraw.go

-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ func (b *BufferflowTimedRaw) BlockUntilReady(cmd string, id string) (bool, bool)
5959
return true, false
6060
}
6161

62-
// not implemented, we are gonna use OnIncomingData
63-
func (b *BufferflowTimedRaw) OnIncomingDataBinary(data []byte) {
64-
}
65-
6662
func (b *BufferflowTimedRaw) OnIncomingData(data string) {
6763
b.Input <- data
6864
}

serialport.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,9 @@ func (p *serport) reader(buftype string) {
118118

119119
data := ""
120120
switch buftype {
121-
case "timedraw", "timed": // data is handled differently inside BufferFlowTimed (bufferedOutput is string) and BufferFlowTimedRaw (bufferedOutputRaw is []byte)
121+
case "timedraw", "timed", "timedbinary":
122122
data = string(ch[:n])
123123
p.bufferwatcher.OnIncomingData(data)
124-
case "timedbinary":
125-
p.bufferwatcher.OnIncomingDataBinary(ch[:n])
126124
case "default": // the bufferbuftype is actually called default 🤷‍♂️
127125
// save the left out bytes for the next iteration due to UTF-8 encoding
128126
ch = append(buffered_ch.Bytes(), ch[:n]...) // TODO ch is not handled correctly: doing this way its length is messed up. Use ch2

0 commit comments

Comments
 (0)