Skip to content

Commit 2e82937

Browse files
author
Stefania
authored
Merge pull request #8 from bcmi-labs/refactoring-rxjs
Refactoring rxjs
2 parents 9948691 + 9c3e15b commit 2e82937

19 files changed

+7222
-1097
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
lib
33
dist
44
es
5+
.tmp

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,76 @@
11
# create-plugin-communication
22
JS module providing discovery of the Arduino Create Plugin and communication with it
3+
4+
## Installation
5+
6+
```bash
7+
npm install create-plugin-communication --save
8+
```
9+
10+
## How to use
11+
12+
```js
13+
import Daemon from 'create-plugin-communication';
14+
15+
const daemon = new Daemon();
16+
17+
daemon.agentFound.subscribe(status => {
18+
// true / false
19+
});
20+
21+
daemon.channelOpen.subscribe(status => {
22+
// true / false
23+
});
24+
25+
daemon.error.subscribe(err => {
26+
// handle err
27+
});
28+
29+
// List available devices (serial/network)
30+
daemon.devicesList.subscribe(devices => {
31+
const serialDevices = devices.serial;
32+
const networkDevices = devices.network;
33+
});
34+
35+
// Open serial monitor
36+
daemon.openSerialMonitor('port-name');
37+
38+
// Read from serial monitor
39+
daemon.serialMonitorMessages.subscribe(message => {
40+
console.log(message);
41+
});
42+
43+
// Write to serial monitor
44+
daemon.writeSerial('port-name', 'message');
45+
46+
// Close serial monitor
47+
daemon.closeSerialMonitor('port-name');
48+
49+
// Upload hex
50+
daemon.upload(target, data);
51+
52+
// Upload progress
53+
daemon.uploading.subscribe(upload => {
54+
console.log(status);
55+
});
56+
57+
// Download tool
58+
daemon.downloadTool('toolname', 'toolversion' 'packageName', 'replacement');
59+
60+
// Download status
61+
daemon.downloading.subscribe(download => {
62+
console.log(download);
63+
});
64+
65+
```
66+
## Development and test features
67+
Just run `npm run dev` and open your browser on http://localhost:8000
68+
69+
## Agent communication
70+
71+
To enable communication between your [local installation](http://localhost:8000/) and the [Arduino Create Agent](https://github.com/arduino/arduino-create-agent)
72+
add `origins = http://localhost:8000` on your agent config.ini file
73+
(if you are using https, add `origins = https://localhost:8000`).
74+
75+
- On macOs ~/Applications/ArduinoCreateAgent-1.1/ArduinoCreateAgent.app/Contents/MacOS/config.ini
76+
- On Linux ~/ArduinoCreateAgent-1.1/config.ini

0 commit comments

Comments
 (0)