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
The arduino create agent is a single binary that reads from a configuration file. Upon launching it will sit on the traybar and work in the background.
24
+
25
+
It will listen to http and websocket connections on a range of ports from `8990` to `9000`.
26
+
27
+
### Discover the port
28
+
You should make GET request to the `/info` endpoint on the possible ports, until you find a reply:
29
+
30
+
$ curl http://localhost:8990/info
31
+
curl: (7) Failed to connect to localhost port 8990: Connection refused
The reply will contain a json with info about the version and the http and https endpoints to use
38
+
39
+
### Open a websocket
40
+
Most of the commands can be performed with websocket instructions. We use a library called [socket.io](https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.5/socket.io.min.js) to handle the messages.
41
+
Once you have the websocket endpoint you need you can:
42
+
43
+
```javascript
44
+
var socket =io(endpoint);
45
+
socket.on('connect', function () {
46
+
socket.emit('message', yourCommand);
47
+
48
+
socket.on('message', function () {
49
+
// Your code to handle messages
50
+
})
51
+
}
52
+
```
53
+
54
+
### Use the debug console
55
+
By clicking on the tray icon and going to the debug console you can try most of the websocket commands. The first command you should type in is:
56
+
57
+
log on
58
+
59
+
### List the boards
60
+
To get a json list of the connected boards you can issue the command list:
61
+
62
+
```javascript
63
+
socket.emit('command', 'list');
64
+
```
65
+
66
+
You will receive an object of all the boards connected with USB or over the network:
- commandline is the command to execute to perform the upload. This is for example avrdude on a leonardo.
225
+
226
+
- hex contains the sketch hex encoded in base64
227
+
228
+
- signature is the signature of the commandline signed with the private key that matches the public key contained in the config.iniof the arduino-create-agent
229
+
230
+
The results of the upload will be delivered via websocket with messages that looks like:
0 commit comments