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
Copy file name to clipboardExpand all lines: RFCs/0004-pluggable-monitor.md
+18-18
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This document describes how the Pluggable Monitor works and how it should integr
6
6
7
7
## Problem
8
8
9
-
With the introduction of Pluggable Discovery the Arduino platforms are now allowed to seamlessy add support for new type of communication "ports" that can be used to upload new sketches or communicate with the board. In particular the communication with the board until now has been done using the Serial Monitor of the Arduino IDE but, with the new kind of communication protocols enabled by the Pluggable Discovery, this is no more sufficient.
9
+
With the introduction of Pluggable Discovery the Arduino platforms are now allowed to seamlessly add support for new types of communication "ports" that can be used to upload new sketches or communicate with the board. In particular the communication with the board until now has been done using the Serial Monitor of the Arduino IDE but, with the new kind of communication protocols enabled by the Pluggable Discovery, this is no more sufficient.
10
10
11
11
The Pluggable Monitor aims to allow platforms to provide the missing piece to allow the user to communicate with any kind of port through, virtually, any protocol, not only serial.
12
12
@@ -22,7 +22,7 @@ The Pluggable Monitor aims to allow platforms to provide the missing piece to al
22
22
23
23
## Proposed Solution
24
24
25
-
Each platforms should provide a tool that can open a connection to a port through a **single specific port protocol**. There will be a tool for each supported protocol so, in the end, we will have a "Serial ports monitor", a "Network port monitor", and so on.
25
+
Each platform should provide a tool that can open a connection to a port through a **single specific port protocol**. There will be a tool for each supported protocol so, in the end, we will have a "Serial port monitor", a "Network port monitor", and so on.
26
26
27
27
These tools must be in the form of command line executables that can be launched as a subprocess. They will communicate to the parent process via stdin/stdout, in particular a monitor will accept commands as plain text strings from stdin and will send answers back in JSON format on stdout. Each tool will implement the commands to open and control communication ports for a specific protocol as specified in this document. The actual I/O data stream from the communication port will be transferred to the parent process through a separate channel via TCP/IP.
28
28
@@ -32,7 +32,7 @@ All the commands listed in this specification must be implemented in the monitor
32
32
33
33
After startup, the tool will just stay idle waiting for commands. The available commands are: `HELLO`, `DESCRIBE`, `CONFIGURE`, `OPEN`, `CLOSE` and `QUIT`.
34
34
35
-
After each command the client always expect a response from the monitor. The monitor must not introduce any delay and must respond to all commands as fast as possible.
35
+
After each command the client always expects a response from the monitor. The monitor must not introduce any delay and must respond to all commands as fast as possible.
36
36
37
37
#### HELLO command
38
38
@@ -145,7 +145,7 @@ or if there is an error:
145
145
}
146
146
```
147
147
148
-
The currently selected parameters may be get using the `DESCRIBE` command.
148
+
The currently selected parameters may be obtained using the `DESCRIBE` command.
149
149
150
150
#### OPEN command
151
151
@@ -157,7 +157,7 @@ The Client/IDE must first TCP-Listen to a randomly selected port and send it to
157
157
158
158
For example, let's suppose that the Client/IDE wants to communicate with the serial port `/dev/ttyACM0` then the sequence of actions to perform will be the following:
159
159
160
-
1. the Client/IDE must first listen to a random TCP port (let's suppose it choose`32123`)
160
+
1. the Client/IDE must first listen to a random TCP port (let's suppose it chose`32123`)
161
161
1. the Client/IDE sends the command `OPEN 127.0.0.1:32123 /dev/ttyACM0` to the monitor tool
162
162
1. the monitor tool opens `/dev/ttyACM0`
163
163
1. the monitor tool connects via TCP/IP to `127.0.0.1:32123` and start streaming data back and forth
@@ -251,18 +251,18 @@ If the client sends an invalid or malformed command, the monitor should answer w
251
251
252
252
TODO...
253
253
254
-
### Integration with `arduino-cli` and core platforms
254
+
### Integration with Arduino CLI and core platforms
255
255
256
256
In this section we will see how monitors are distributed and integrated with Arduino platforms.
257
257
258
258
#### Monitor tool distribution
259
259
260
260
The monitor tools must be built natively for each OS and the CLI should run the correct tool for the running OS.
261
261
262
-
The distribution infrastracture is already available for platform tools, like compilers and uploaders, through `package_index.json` so, the most natural way forward is to distribute also the monitor tools in the same way.
263
-
3rd party developers should provide their monitor tools by adding them as resources in the `tools` section of `package_index.json` (at the `packages` level).
262
+
The distribution infrastructure is already available for platform tools, like compilers and uploaders, through [the Arduino package index](https://arduino.github.io/arduino-cli/latest/package_index_json-specification) so, the most natural way forward is to distribute also the monitor tools in the same way.
263
+
3rd party developers should provide their monitor tools by adding them as resources in the `tools` section of their package index (at the `packages` level).
264
264
265
-
Let's see how this looks into a `package_index.json` example:
265
+
Let's see an example of adding a monitor tool to a package index:
266
266
267
267
```diff
268
268
{
@@ -294,7 +294,7 @@ Let's see how this looks into a `package_index.json` example:
@@ -306,13 +306,13 @@ Let's see how this looks into a `package_index.json` example:
306
306
}
307
307
```
308
308
309
-
In this case we are adding an hypotetical`ble-monitor` version `1.0.0` to the toolset of the vendor `arduino`. From now on, we can uniquely refer to this monitor with the pair `PACKAGER` and `MONITOR_NAME`, in this case `arduino` and `ble-monitor` respectively.
309
+
In this case we are adding an hypothetical`ble-monitor` version `1.0.0` to the toolset of the vendor `arduino`. From now on, we can uniquely refer to this monitor with the pair `PACKAGER` and `MONITOR_NAME`, in this case `arduino` and `ble-monitor` respectively.
310
310
311
311
The compressed archive of the monitor must contain only a single executable file (the monitor itself) inside a single root folder. This is mandatory since the CLI will run this file automatically when a monitor instance is requested.
312
312
313
313
#### Monitor tools integration
314
314
315
-
Each core platform must refer to the specific monitor tools they need by adding them (together with the pluggable discoveries...) inside the `discoveryDependencies` field of the `package_index.json`:
315
+
Each core platform must refer to the specific monitor tools they need by adding them (together with the pluggable discoveries...) inside the `discoveryDependencies` field of the Arduino package index:
316
316
317
317
```diff
318
318
{
@@ -386,7 +386,7 @@ Each core platform must refer to the specific monitor tools they need by adding
386
386
}
387
387
```
388
388
389
-
Adding the needed monitor tools in the `discoveryDependencies` allows the CLI to install them together with the platform. Also, differently from the other `toolsDependencies`, the version is not required since it will always be used the latest version available.
389
+
Adding the needed monitor tools in the `discoveryDependencies` allows the CLI to install them together with the platform. Also, differently from the other `toolsDependencies`, the version is not required since the latest version available will always be used.
390
390
391
391
Finally, to bind a monitor to a protocol, we must also declare in the `platform.txt` that we want to use that specific monitor tool for that specific protocol with the direcive:
392
392
@@ -412,13 +412,13 @@ where `ble` is the port protocol identification returned by the matching pluggab
412
412
413
413
#### Using a monitor tool made by a 3rd party
414
414
415
-
A platform developer may opt to depend on a monitor tool developed by a 3rd party instead of writing and maintaining his own.
415
+
A platform developer may opt to depend on a monitor tool developed by a 3rd party instead of writing and maintaining their own.
416
416
417
417
Since writing a good-quality cross-platform monitor tool is very hard and time consuming, we expect this option to be the one used by the majority of the developers.
418
418
419
419
#### Direct monitor tool integration (not recommended)
420
420
421
-
A monitor tool may be directly added to a platform, without passing through the `discoveryDependencies` in `package_index.json`, using the following directive in the `platform.txt`:
421
+
A monitor tool may be directly added to a platform, without passing through the `discoveryDependencies` in the Arduino package index, using the following directive in the `platform.txt`:
422
422
423
423
```
424
424
monitor.pattern.PROTOCOL=MONITOR_RECIPE
@@ -434,8 +434,8 @@ in this case the platform provides a new `custom-ble` protocol monitor tool and
434
434
435
435
This kind of integration may turn out useful:
436
436
437
-
- during the development of a platform (because providing a full `package_index.json` may be cumbersome)
438
-
- if the monitor tool is specific for a platform and can not be used by 3rd party
437
+
- during the development of a platform (because providing a full package index may be cumbersome)
438
+
- if the monitor tool is specific to a platform and can not be used by 3rd party
439
439
440
440
Anyway, since this kind of integration does not allow reusing a monitor tool between different platforms, we do not recommend its use.
For backward compatibility, if a platform does not declare any discovery or monitor tool (using the `discovery.*` or `monitor.*` properties in `platform.txt` respectively) it will automatically inherits`builtin:serial-monitor` and `builtin:network-monitor` (but not other `builtin` monitor tools that may be possibly added in the future). This will allow all legacy non-pluggable platforms to migrate to pluggable monitor without disruption.
453
+
For backward compatibility, if a platform does not declare any discovery or monitor tool (using the `discovery.*` or `monitor.*` properties in `platform.txt` respectively) it will automatically inherit`builtin:serial-monitor` and `builtin:network-monitor` (but not other `builtin` monitor tools that may be possibly added in the future). This will allow all legacy non-pluggable platforms to migrate to pluggable monitor without disruption.
0 commit comments