How to use the react-native-ble-manager.startNotification function in react-native-ble-manager

To help you get started, we’ve selected a few react-native-ble-manager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zhanguangao / react-native-ble-manager-demo / src / BleModule.js View on Github external
return new Promise( (resolve, reject) =>{
            BleManager.startNotification(this.peripheralId, this.nofityServiceUUID[index], this.nofityCharacteristicUUID[index])
                .then(() => {
                    console.log('Notification started');
                    resolve();
                })
                .catch((error) => {
                    console.log('Notification error:',error);
                    reject(error);
                });
        });
    }
github innoveit / react-native-ble-manager / example / App.js View on Github external
setTimeout(() => {
                BleManager.startNotification(peripheral.id, service, bakeCharacteristic).then(() => {
                  console.log('Started notification on ' + peripheral.id);
                  setTimeout(() => {
                    BleManager.write(peripheral.id, service, crustCharacteristic, [0]).then(() => {
                      console.log('Writed NORMAL crust');
                      BleManager.write(peripheral.id, service, bakeCharacteristic, [1,95]).then(() => {
                        console.log('Writed 351 temperature, the pizza should be BAKED');
                        /*
                        var PizzaBakeResult = {
                          HALF_BAKED: 0,
                          BAKED:      1,
                          CRISPY:     2,
                          BURNT:      3,
                          ON_FIRE:    4
                        };*/
                      });
                    });
github zhanguangao / react-native-ble-manager-demo / demo for v3.2.1 deprecated / app / BleManager.js View on Github external
return new Promise( (resolve, reject) =>{
            BleManager.startNotification(this.peripheralId, this.nofityServiceUUID, this.nofityCharacteristicUUID)
                .then(() => {
                    console.log('Notification started');
                    resolve();
                })
                .catch((error) => {
                    console.log('Notification error:',error);
                    reject(error);
                });
        });
    }
github CalPlug / Espressif_ESP32-Scale / React Native / BLE Demo / src / ble_manager / DevicePg.js View on Github external
setTimeout(() => {
            BleManager.startNotification(id, service, loadCellCharacteristic).then(() => {
              console.log('Started sensing/notification on ' + id);
            }).catch((error) => {
              console.log('Notification error', error);
            });
          }, 200);
        });
github zhanguangao / react-native-ble-manager-demo / demo for v3.2.1 deprecated / app / BleManager.js View on Github external
}).then( (peripheralInfo)=>{
                    console.log('Connected peripheralInfo: ', peripheralInfo);                    
                    this.peripheralId = peripheralInfo.id;
                    this.getUUID(peripheralInfo);                   
                    if(this.nofityServiceUUID.length == 4 || this.nofityServiceUUID.length != 36 ||
                        this.nofityServiceUUID == '' || this.nofityCharacteristicUUID == '' || 
                        this.writeServiceUUID == '' ||this.writeCharacteristicUUID == ''){
                            return 'invalid';
                    }
                    return BleManager.startNotification(this.peripheralId, this.nofityServiceUUID, this.nofityCharacteristicUUID)

                }).then((status) => {
                    this.isConnecting = false;   //当前蓝牙连接结束    
github adafruit / glider / App.js View on Github external
setTimeout(() => {
              BleManager.startNotification(peripheral.id, service, contentsCharacteristic).then(() => {
                console.log('Started notification on ' + peripheral.id);
                setTimeout(() => {
                  BleManager.write(peripheral.id, service, filenameCharacteristic, stringToBytes("/code.py")).then(() => {
                    console.log('Wrote filename');
                    setFileState("nameSet");
                  });

                }, 500);
              }).catch((error) => {
                console.log('Notification error', error);
              });
            }, 200);
          });