1.5.0 • Published 2 years ago

react-native-serial-port-api v1.5.0

Weekly downloads
7
License
MIT
Repository
github
Last release
2 years ago

react-native-serial-port-api

Only for android platform based on Android-SerialPort-API.

Getting started

$ npm install react-native-serial-port-api --save

(Optional) React Native < 0.60

Run this command if use React Native before version 0.60.

$ npx react-native link react-native-serial-port-api

Autolinking will works for 0.60 or above.

Usage

import SerialPortAPI from 'react-native-serial-port-api';

async function example() {
  const serialPort = await SerialPortAPI.open("/dev/ttyS4", { baudRate: 38400 });

  // subscribe received data
  const sub = serialPort.onReceived(buff => {
    console.log(buff.toString('hex').toUpperCase());
  })

  // unsubscribe
  // sub.remove();

  // send data with hex format
  await serialPort.send('00FF');

  // close
  serialPort.close();
}

See documentation for details.

Development

Generate API docs.

npm install -g jsdoc
jsdoc src -r -R README.md -t node_modules/docdash -d ./docs/
1.5.0

2 years ago

1.4.0

2 years ago

1.4.0-rc.2

2 years ago

1.4.0-rc.3

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.4.0-rc.1

2 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago