You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Correct example commands and output in README to reflect actual behavior of tool
The readme content seems to be based on the "dummy-monitor" tool rather than on serial-monitor, and also outdated.
I have updated the commands and output to reflect the behavior of the tool from this repository.
Copy file name to clipboardExpand all lines: README.md
+154-57
Original file line number
Diff line number
Diff line change
@@ -31,8 +31,8 @@ The response to the command is:
31
31
```json
32
32
{
33
33
"eventType": "hello",
34
-
"protocolVersion": 1,
35
-
"message": "OK"
34
+
"message": "OK",
35
+
"protocolVersion": 1
36
36
}
37
37
```
38
38
@@ -42,17 +42,18 @@ The response to the command is:
42
42
43
43
The `DESCRIBE` command returns a description of the communication port. The description will have metadata about the port configuration, and which parameters are available:
44
44
45
+
<!-- prettier-ignore -->
45
46
```json
46
47
{
47
-
"event": "describe",
48
-
"message": "ok",
48
+
"eventType": "describe",
49
+
"message": "OK",
49
50
"port_description": {
50
51
"protocol": "serial",
51
52
"configuration_parameters": {
52
53
"baudrate": {
53
54
"label": "Baudrate",
54
55
"type": "enum",
55
-
"values": [
56
+
"value": [
56
57
"300",
57
58
"600",
58
59
"750",
@@ -73,22 +74,38 @@ The `DESCRIBE` command returns a description of the communication port. The desc
@@ -100,7 +117,7 @@ Each parameter has a unique name (`baudrate`, `parity`, etc...), a `type` (in th
100
117
101
118
The parameter name can not contain spaces, and the allowed characters in the name are alphanumerics, underscore `_`, dot `.`, and dash `-`.
102
119
103
-
The `enum` types must have a list of possible `values`.
120
+
The `enum` types must have a list of possible `value`.
104
121
105
122
The client/IDE may expose these configuration values to the user via a config file or a GUI, in this case the `label` field may be used for a user readable description of the parameter.
106
123
@@ -114,18 +131,18 @@ The response to the command is:
114
131
115
132
```JSON
116
133
{
117
-
"event": "configure",
118
-
"message": "ok",
134
+
"eventType": "configure",
135
+
"message": "OK"
119
136
}
120
137
```
121
138
122
139
or if there is an error:
123
140
124
141
```JSON
125
142
{
126
-
"event": "configure",
127
-
"error": true,
128
-
"message": "invalid value for parameter baudrate: 123456"
143
+
"eventType": "configure",
144
+
"message": "invalid value for parameter baudrate: 123456",
145
+
"error": true
129
146
}
130
147
```
131
148
@@ -150,16 +167,16 @@ The answer to the `OPEN` command is:
150
167
151
168
```JSON
152
169
{
153
-
"event": "open",
154
-
"message": "ok"
170
+
"eventType": "open",
171
+
"message": "OK"
155
172
}
156
173
```
157
174
158
175
If the monitor tool cannot communicate with the board, or if the tool can not connect back to the TCP port, or if any other error condition happens:
159
176
160
177
```JSON
161
178
{
162
-
"event": "open",
179
+
"eventType": "open",
163
180
"error": true,
164
181
"message": "unknown port /dev/ttyACM23"
165
182
}
@@ -171,17 +188,19 @@ Once the port is opened, it may be unexpectedly closed at any time due to hardwa
171
188
172
189
```JSON
173
190
{
174
-
"event": "port_closed",
175
-
"message": "serial port disappeared!"
191
+
"eventType": "port_closed",
192
+
"message": "serial port disappeared!",
193
+
"error": true
176
194
}
177
195
```
178
196
179
197
or
180
198
181
199
```JSON
182
200
{
183
-
"event": "port_closed",
184
-
"message": "lost TCP/IP connection with the client!"
201
+
"eventType": "port_closed",
202
+
"message": "lost TCP/IP connection with the client!",
203
+
"error": true
185
204
}
186
205
```
187
206
@@ -191,16 +210,16 @@ The `CLOSE` command will close the currently opened port and close the TCP/IP co
191
210
192
211
```JSON
193
212
{
194
-
"event": "close",
195
-
"message": "ok"
213
+
"eventType": "close",
214
+
"message": "OK"
196
215
}
197
216
```
198
217
199
218
or in case of error
200
219
201
220
```JSON
202
221
{
203
-
"event": "close",
222
+
"eventType": "close",
204
223
"error": true,
205
224
"message": "port already closed"
206
225
}
@@ -227,7 +246,7 @@ If the client sends an invalid or malformed command, the monitor should answer w
227
246
{
228
247
"eventType": "command_error",
229
248
"error": true,
230
-
"message": "Unknown command XXXX"
249
+
"message": "Command XXXX not supported"
231
250
}
232
251
```
233
252
@@ -247,33 +266,70 @@ DESCRIBE
247
266
"eventType": "describe",
248
267
"message": "OK",
249
268
"port_description": {
250
-
"protocol": "test",
269
+
"protocol": "serial",
251
270
"configuration_parameters": {
252
-
"echo": {
253
-
"label": "echo",
254
-
"type": "enum",
255
-
"value": [
256
-
"on",
257
-
"off"
258
-
],
259
-
"selected": "on"
260
-
},
261
-
"speed": {
271
+
"baudrate": {
262
272
"label": "Baudrate",
263
273
"type": "enum",
264
274
"value": [
275
+
"300",
276
+
"600",
277
+
"750",
278
+
"1200",
279
+
"2400",
280
+
"4800",
265
281
"9600",
266
282
"19200",
267
283
"38400",
268
284
"57600",
269
-
"115200"
285
+
"115200",
286
+
"230400",
287
+
"460800",
288
+
"500000",
289
+
"921600",
290
+
"1000000",
291
+
"2000000"
270
292
],
271
293
"selected": "9600"
294
+
},
295
+
"bits": {
296
+
"label": "Data bits",
297
+
"type": "enum",
298
+
"value": [
299
+
"5",
300
+
"6",
301
+
"7",
302
+
"8",
303
+
"9"
304
+
],
305
+
"selected": "8"
306
+
},
307
+
"parity": {
308
+
"label": "Parity",
309
+
"type": "enum",
310
+
"value": [
311
+
"None",
312
+
"Even",
313
+
"Odd",
314
+
"Mark",
315
+
"Space"
316
+
],
317
+
"selected": "None"
318
+
},
319
+
"stop_bits": {
320
+
"label": "Stop bits",
321
+
"type": "enum",
322
+
"value": [
323
+
"1",
324
+
"1.5",
325
+
"2"
326
+
],
327
+
"selected": "1"
272
328
}
273
329
}
274
330
}
275
331
}
276
-
CONFIGURE speed 19200
332
+
CONFIGURE baudrate 19200
277
333
{
278
334
"eventType": "configure",
279
335
"message": "OK"
@@ -283,33 +339,70 @@ DESCRIBE
283
339
"eventType": "describe",
284
340
"message": "OK",
285
341
"port_description": {
286
-
"protocol": "test",
342
+
"protocol": "serial",
287
343
"configuration_parameters": {
288
-
"echo": {
289
-
"label": "echo",
290
-
"type": "enum",
291
-
"value": [
292
-
"on",
293
-
"off"
294
-
],
295
-
"selected": "on"
296
-
},
297
-
"speed": {
344
+
"baudrate": {
298
345
"label": "Baudrate",
299
346
"type": "enum",
300
347
"value": [
348
+
"300",
349
+
"600",
350
+
"750",
351
+
"1200",
352
+
"2400",
353
+
"4800",
301
354
"9600",
302
355
"19200",
303
356
"38400",
304
357
"57600",
305
-
"115200"
358
+
"115200",
359
+
"230400",
360
+
"460800",
361
+
"500000",
362
+
"921600",
363
+
"1000000",
364
+
"2000000"
306
365
],
307
366
"selected": "19200"
367
+
},
368
+
"bits": {
369
+
"label": "Data bits",
370
+
"type": "enum",
371
+
"value": [
372
+
"5",
373
+
"6",
374
+
"7",
375
+
"8",
376
+
"9"
377
+
],
378
+
"selected": "8"
379
+
},
380
+
"parity": {
381
+
"label": "Parity",
382
+
"type": "enum",
383
+
"value": [
384
+
"None",
385
+
"Even",
386
+
"Odd",
387
+
"Mark",
388
+
"Space"
389
+
],
390
+
"selected": "None"
391
+
},
392
+
"stop_bits": {
393
+
"label": "Stop bits",
394
+
"type": "enum",
395
+
"value": [
396
+
"1",
397
+
"1.5",
398
+
"2"
399
+
],
400
+
"selected": "1"
308
401
}
309
402
}
310
403
}
311
404
}
312
-
OPEN 127.0.0.1:5678 "test"
405
+
OPEN 127.0.0.1:5678 /dev/ttyACM0
313
406
{
314
407
"eventType": "open",
315
408
"message": "OK"
@@ -320,10 +413,14 @@ CLOSE
320
413
"message": "OK"
321
414
}
322
415
QUIT
416
+
{
417
+
"eventType": "quit",
418
+
"message": "OK"
419
+
}
323
420
$
324
421
```
325
422
326
-
On another terminal tab to test it you can run `nc -l -p 5678` before running the `OPEN 127.0.0.1:5678 "test"` command. After that you can write messages in that terminal tab and see them being echoed.
423
+
On another terminal tab to test it you can run `nc -l -p 5678` before running the `OPEN 127.0.0.1:5678 /dev/ttyACM0` command. After that you can write messages in that terminal tab and see them being echoed.
0 commit comments