Skip to content

Commit ba0f0d8

Browse files
author
Stefania
committed
updated readme
1 parent ea682df commit ba0f0d8

File tree

3 files changed

+244
-4
lines changed

3 files changed

+244
-4
lines changed

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,44 @@
11
# create-plugin-communication
22
JS module providing discovery of the Arduino Create Plugin and communication with it
33

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+
// Ask for agent connection
16+
Daemon.findAgent()
17+
18+
Daemon.agentDiscoveryStatus.subscribe(status => {
19+
// AGENT_FOUND / AGENT_NOT_FOUND
20+
});
21+
22+
Daemon.wsConnectionStatus.subscribe(status => {
23+
// WS_CONNECTED / WS_DISCONNECTED
24+
});
25+
26+
Daemon.wsError.subscribe(err => {
27+
// handle err
28+
});
29+
30+
Daemon.readerWriter.messageSubject.subscribe(() => {
31+
const serialDevices = Daemon.readerWriter.devicesList.serial;
32+
const networkDevices = Daemon.readerWriter.devicesList.network;
33+
});
34+
```
435
## Development
5-
Just run `npm run dev` and open your browser on http://local.arduino.cc:8000
36+
Just run `npm run dev` and open your browser on http://localhost:8000
637

738
## Agent communication
839

9-
To enable communication between your [local installation](http://local.arduino.cc:8000/) and the [Arduino Create Agent](https://github.com/arduino/arduino-create-agent)
10-
add `origins = http://local.arduino.cc:8000` on your agent config.ini file (if you are using https, add `origins = https://local.arduino.cc:8000`).
40+
To enable communication between your [local installation](http://localhost:8000/) and the [Arduino Create Agent](https://github.com/arduino/arduino-create-agent)
41+
add `origins = http://localhost:8000` on your agent config.ini file (if you are using https, add `origins = https://localhost:8000`).
1142

1243
- On macOs ~/Applications/ArduinoCreateAgent-1.1/ArduinoCreateAgent.app/Contents/MacOS/config.ini
1344
- On Linux ~/ArduinoCreateAgent-1.1/config.ini

package-lock.json

Lines changed: 209 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/app.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class App extends React.Component {
5858

5959
return (
6060
<div>
61-
<h1>Test Daemon</h1>
61+
<h1>Test Arduino Create Plugin</h1>
6262
<p>Agent status: <span id="agent-status" className={ this.state.agentStatus === AGENT_STATUS_FOUND ? 'found' : 'not-found' }>
6363
{ this.state.agentStatus }
6464
</span></p>

0 commit comments

Comments
 (0)