react-native-bt-telink

1.3.3 • Public • Published

React Native Bluetooth Telink

npm version npm downloads npm licence Platform

Component implementation for Bluetooth Mesh SDK of Telink.

Install

For RN >= 0.60 and Android SDK >= 29

npm i --save react-native-bt-telink

For RN >= 0.60 and Android SDK < 29

npm i --save react-native-bt-telink@1.2.x

For RN < 0.60

npm i --save react-native-bt-telink@1.0.x

Android

For RN < 0.60, need files edited below:

In android/app/build.gradle

dependencies {
    implementation project(':react-native-bt-telink')
}

In android/app/src/main/java/com/YourProject/MainApplication.java

import com.telink.TelinkBtPackage;
...
    new TelinkBtPackage(),

In android/settings.gradle

include ':react-native-bt-telink'
project(':react-native-bt-telink').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bt-telink/android')

iOS

For RN < 0.60, in ios/Podfile

  pod 'RNBtTelink', :path => '../node_modules/react-native-bt-telink'

For RN < 0.60 and RN >= 0.60

cd ios
pod install

Usage

import React from 'react';
import { View } from 'react-native';
import meshModule from 'react-native-bt-telink';

export default class MeshModuleExample extends React.Component {
    constructor(props) {
        super(props);
        meshModule.passthroughMode = {
            silan: [
                1,
                7,
            ],
            sllc: [
                30848,
            ],
        };
    }

    componentDidMount() {
        meshModule.addListener('leScan', this.onLeScan);
        meshModule.doInit();
    }

    onLeScan = data => console.warn(data)

    render() {
        return (
            <View/>
        );
    }
}

Donate

To support my work, please consider donate.

  • ETH: 0xd02fa2738dcbba988904b5a9ef123f7a957dbb3e

Package Sidebar

Install

npm i react-native-bt-telink

Weekly Downloads

8

Version

1.3.3

License

MIT

Unpacked Size

745 kB

Total Files

106

Last publish

Collaborators

  • flyskywhy