Skip to content

jeffer80/react-native-usbserial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-usbserial

This wrapper implementation is totally based on usb-serial-for-android. Thanks mik3y for the awesome project.

Installation

npm install react-native-usbserial-cvk --save

Integrate module

To integrate react-native-usbserial with the rest of your react app just execute:

react-native link react-native-usbserial-cvk

Android

To integrate it with your android application you also need to add these following lines on your android/app/build.gradle:

repositories {
        maven { url 'https://jitpack.io' }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

Usage

import { UsbSerial} from 'react-native-usbserial-cvk';

let usb = new UsbSerial();

// get usb device list
usb.getDeviceListAsync()
   .then(data => {
      console.log(data);
     });
   });
   
// write data to usb device
usb.openDeviceAsync(this.state.usbDeviceList[0])
   .then(usbDevice => {
     usbDevice.writeAsync(this.plt);
   });

About

A USB serial React Native bridge

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 91.1%
  • JavaScript 8.9%