Skip to content

Commit 14bc0af

Browse files
committed
Add package index and update README
Change-Id: I1b4f6b336b8a48c126aafda19ba905b5748c3a6e
1 parent aca8807 commit 14bc0af

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
@fitbit/pulse
22
===============
33

4-
TODO!
4+
PULSE is a layered protocol stack. The link layer provides integrity-assured delivery of packet data. On top of the link layer is a suite of transport protocols which provide multiprotocol delivery of application datagrams with or without guaranteed reliable in-order delivery. Application protocols use one or more of the available transports to exchange datagrams between the firmware running on a board and a host workstation.
5+
6+
This repo provides a TypeScript implementation of the protocol stack with minimal dependencies.
7+
8+
Example usage:
9+
--------------
10+
11+
```
12+
import SerialPort from 'serialport';
13+
14+
const port = new SerialPort('/dev/cu.usbmodem01013');
15+
const intf = Interface.create(port); // Port can be any duplex stream
16+
17+
intf.getLink(async link => {
18+
const transportType = 'reliable'; // reliable or bestEffort
19+
const port = 0x3e20; // Port number specific to your usage, must be <= 65535
20+
21+
const socket = await link.openSocket(transportType, port);
22+
23+
socket.on('data', msg => console.log(`RX data: ${msg}`));
24+
socket.send(Buffer.from('Hello world!'));
25+
});
26+
```

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { default as Link } from './Link';
2+
export { default as Interface } from './Interface';
3+
export { default as Socket } from './Socket';

0 commit comments

Comments
 (0)