@@ -70,58 +70,3 @@ func (sh *serialhub) FindPortByName(portname string) (*serport, bool) {
70
70
}
71
71
return nil , false
72
72
}
73
-
74
- func (h * hub ) spErr (err string ) {
75
- //log.Println("Sending err back: ", err)
76
- //sh.hub.broadcastSys <- []byte(err)
77
- h .broadcastSys <- []byte ("{\" Error\" : \" " + err + "\" }" )
78
- }
79
-
80
- func (h * hub ) spClose (portname string ) {
81
- if myport , ok := h .serialHub .FindPortByName (portname ); ok {
82
- h .broadcastSys <- []byte ("Closing serial port " + portname )
83
- myport .Close ()
84
- } else {
85
- h .spErr ("We could not find the serial port " + portname + " that you were trying to close." )
86
- }
87
- }
88
-
89
- func (h * hub ) spWrite (arg string ) {
90
- // we will get a string of comXX asdf asdf asdf
91
- //log.Println("Inside spWrite arg: " + arg)
92
- arg = strings .TrimPrefix (arg , " " )
93
- //log.Println("arg after trim: " + arg)
94
- args := strings .SplitN (arg , " " , 3 )
95
- if len (args ) != 3 {
96
- errstr := "Could not parse send command: " + arg
97
- //log.Println(errstr)
98
- h .spErr (errstr )
99
- return
100
- }
101
- bufferingMode := args [0 ]
102
- portname := strings .Trim (args [1 ], " " )
103
- data := args [2 ]
104
-
105
- //log.Println("The port to write to is:" + portname + "---")
106
- //log.Println("The data is:" + data + "---")
107
-
108
- // See if we have this port open
109
- port , ok := h .serialHub .FindPortByName (portname )
110
- if ! ok {
111
- // we couldn't find the port, so send err
112
- h .spErr ("We could not find the serial port " + portname + " that you were trying to write to." )
113
- return
114
- }
115
-
116
- // see if bufferingMode is valid
117
- switch bufferingMode {
118
- case "send" , "sendnobuf" , "sendraw" :
119
- // valid buffering mode, go ahead
120
- default :
121
- h .spErr ("Unsupported send command:" + args [0 ] + ". Please specify a valid one" )
122
- return
123
- }
124
-
125
- // send it to the write channel
126
- port .Write (data , bufferingMode )
127
- }
0 commit comments