Skip to content

Commit 8315848

Browse files
cmaglieper1234
andauthored
Apply suggestions from code review
Co-authored-by: per1234 <[email protected]>
1 parent 70ac9f9 commit 8315848

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

RFCs/0004-pluggable-monitor.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document describes how the Pluggable Monitor works and how it should integr
66

77
## Problem
88

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.
1010

1111
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.
1212

@@ -22,7 +22,7 @@ The Pluggable Monitor aims to allow platforms to provide the missing piece to al
2222

2323
## Proposed Solution
2424

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.
2626

2727
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.
2828

@@ -32,7 +32,7 @@ All the commands listed in this specification must be implemented in the monitor
3232

3333
After startup, the tool will just stay idle waiting for commands. The available commands are: `HELLO`, `DESCRIBE`, `CONFIGURE`, `OPEN`, `CLOSE` and `QUIT`.
3434

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.
3636

3737
#### HELLO command
3838

@@ -145,7 +145,7 @@ or if there is an error:
145145
}
146146
```
147147

148-
The currently selected parameters may be get using the `DESCRIBE` command.
148+
The currently selected parameters may be obtained using the `DESCRIBE` command.
149149

150150
#### OPEN command
151151

@@ -157,7 +157,7 @@ The Client/IDE must first TCP-Listen to a randomly selected port and send it to
157157

158158
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:
159159

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`)
161161
1. the Client/IDE sends the command `OPEN 127.0.0.1:32123 /dev/ttyACM0` to the monitor tool
162162
1. the monitor tool opens `/dev/ttyACM0`
163163
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
251251

252252
TODO...
253253

254-
### Integration with `arduino-cli` and core platforms
254+
### Integration with Arduino CLI and core platforms
255255

256256
In this section we will see how monitors are distributed and integrated with Arduino platforms.
257257

258258
#### Monitor tool distribution
259259

260260
The monitor tools must be built natively for each OS and the CLI should run the correct tool for the running OS.
261261

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).
264264

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:
266266

267267
```diff
268268
{
@@ -294,7 +294,7 @@ Let's see how this looks into a `package_index.json` example:
294294
+ "host": "x86_64-pc-linux-gnu",
295295
+ "url": "http://example.com/ble-mon-1.0.0-linux64.tar.gz",
296296
+ "archiveFileName": "ble-mon-1.0.0-linux64.tar.gz",
297-
+ "checksum": +SHA-256:0123456789abcdef0123456789abcdef0123456789abcdef",
297+
+ "checksum": "SHA-256:0123456789abcdef0123456789abcdef0123456789abcdef",
298298
+ "size": "12345678"
299299
+ },
300300
+ ...
@@ -306,13 +306,13 @@ Let's see how this looks into a `package_index.json` example:
306306
}
307307
```
308308

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.
310310

311311
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.
312312

313313
#### Monitor tools integration
314314

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:
316316

317317
```diff
318318
{
@@ -386,7 +386,7 @@ Each core platform must refer to the specific monitor tools they need by adding
386386
}
387387
```
388388

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.
390390

391391
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:
392392

@@ -412,13 +412,13 @@ where `ble` is the port protocol identification returned by the matching pluggab
412412

413413
#### Using a monitor tool made by a 3rd party
414414

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.
416416

417417
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.
418418

419419
#### Direct monitor tool integration (not recommended)
420420

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`:
422422

423423
```
424424
monitor.pattern.PROTOCOL=MONITOR_RECIPE
@@ -434,8 +434,8 @@ in this case the platform provides a new `custom-ble` protocol monitor tool and
434434

435435
This kind of integration may turn out useful:
436436

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
439439

440440
Anyway, since this kind of integration does not allow reusing a monitor tool between different platforms, we do not recommend its use.
441441

@@ -450,4 +450,4 @@ monitor.required.serial=builtin:serial-monitor
450450
monitor.required.network=builtin:network-monitor
451451
```
452452

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 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

Comments
 (0)