forked from johnlauer/serial-port-json-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bufferflow.go
51 lines (44 loc) · 1.94 KB
/
bufferflow.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
//"log"
//"time"
var availableBufferAlgorithms = []string{"default", "timed", "nodemcu", "tinyg", "tinyg_old", "tinyg_linemode", "tinyg_tidmode", "tinygg2", "grbl", "marlin"}
//var availableBufferAlgorithms = []string{"default", "tinyg", "tinygg2", "dummypause", "grbl"}
type BufferMsg struct {
Cmd string
Port string
TriggeringResponse string
//Desc string
//Desc string
}
type Bufferflow interface {
BlockUntilReady(cmd string, id string) (bool, bool, string) // implement this method
//JustQueue(cmd string, id string) bool // implement this method
OnIncomingData(data string) // implement this method
ClearOutSemaphore() // implement this method
BreakApartCommands(cmd string) []string // implement this method
Pause() // implement this method
Unpause() // implement this method
GetManualPaused() bool
SetManualPaused(isPaused bool)
SeeIfSpecificCommandsShouldSkipBuffer(cmd string) bool // implement this method
SeeIfSpecificCommandsShouldPauseBuffer(cmd string) bool // implement this method
SeeIfSpecificCommandsShouldUnpauseBuffer(cmd string) bool // implement this method
SeeIfSpecificCommandsShouldWipeBuffer(cmd string) bool // implement this method
SeeIfSpecificCommandsReturnNoResponse(cmd string) bool // implement this method
ReleaseLock() // implement this method
IsBufferGloballySendingBackIncomingData() bool // implement this method
Close() // implement this method
RewriteSerialData(cmd string, id string) string // implement this method
}
/*data packets returned to client*/
type DataCmdComplete struct {
Cmd string
Id string
P string
BufSize int `json:"-"`
D string `json:"-"`
}
type DataPerLine struct {
P string
D string
}