@novastar/serial
TypeScript icon, indicating that this package has built-in type declarations

2.0.0-alpha.11 • Public • Published

@novastar/serial

Serial binding for @novastar/codec.

Go to API documentation.

Installation

Using npm:

$ npm install --save @novastar/serial@next

or yarn:

$ yarn add @novastar/serial@next

Usage:

import { Request } from '@novastar/codec';
import serial, { findSendingCards } from '@novastar/serial';

const [port] = await findSendingCards();
const session = await serial.open(port.path);
const readReq = new Request(1);
readReq.deviceType = DeviceType.ReceivingCard;
readReq.address = 0x02000001;
readReq.port = 0;
const { data: [value] } = await session.connection.send(readReq);

// Close all serial sessions
serial.release();

The search for connected devices is carried out by the VID/PID pair. At the initial stage, it contains a pair for MCTRL300: ['10c4', 'ea60']. Using the API, you can change the list of known devices.

Package Sidebar

Install

npm i @novastar/serial

Weekly Downloads

38

Version

2.0.0-alpha.11

License

MIT

Unpacked Size

51 kB

Total Files

20

Last publish

Collaborators

  • sarakusha