How to use the react-native-ble-manager.retrieveServices 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 innoveit / react-native-ble-manager / example / App.js View on Github external
setTimeout(() => {

            /* Test read current RSSI value
            BleManager.retrieveServices(peripheral.id).then((peripheralData) => {
              console.log('Retrieved peripheral services', peripheralData);

              BleManager.readRSSI(peripheral.id).then((rssi) => {
                console.log('Retrieved actual RSSI value', rssi);
              });
            });*/

            // Test using bleno's pizza example
            // https://github.com/sandeepmistry/bleno/tree/master/examples/pizza
            BleManager.retrieveServices(peripheral.id).then((peripheralInfo) => {
              console.log(peripheralInfo);
              var service = '13333333-3333-3333-3333-333333333337';
              var bakeCharacteristic = '13333333-3333-3333-3333-333333330003';
              var crustCharacteristic = '13333333-3333-3333-3333-333333330001';

              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,
github anchetaWern / RNFaceAttendance / App.js View on Github external
console.log('Cancel Pressed')
              }
            },
            {
              text: 'OK',
              onPress: (fullname) => {
                this.enterRoom(fullname);
              }
            }
          ],
          {
            placeholder: 'John Wick'
          }
        );

        BleManager.retrieveServices(peripheral_id)
          .then((peripheralInfo) => {
            console.log('Peripheral info:', peripheralInfo);
          }
        );
      })
      .catch((error) => {
github zhanguangao / react-native-ble-manager-demo / demo for v3.2.1 deprecated / app / BleManager.js View on Github external
.then( () => {
                    console.log('Connected');
                    return BleManager.retrieveServices(id)                  
                }).then( (peripheralInfo)=>{
                    console.log('Connected peripheralInfo: ', peripheralInfo);
github CalPlug / Espressif_ESP32-Scale / React Native / BLE Demo / src / ble_manager / DevicePg.js View on Github external
setTimeout(() => {
        BleManager.retrieveServices(id).then((peripheralInfo) => {
          console.log(peripheralInfo);
          var service = '4fafc201-1fb5-459e-8fcc-c5c9c331914b';
          var tareCharacteristic = 'beb5483e-36e1-4688-b7f5-ea07361b26a8';
          var loadCellCharacteristic = '4a78b8dd-a43d-46cf-9270-f6b750a717c8'; //calibrate as well
          
          setTimeout(() => {
            BleManager.startNotification(id, service, loadCellCharacteristic).then(() => {
              console.log('Started sensing/notification on ' + id);
            }).catch((error) => {
              console.log('Notification error', error);
            });
          }, 200);
        });

      }, 900);
    }).catch((error) => {
github zhanguangao / react-native-ble-manager-demo / src / BleModule.js View on Github external
.then(() => {
                    console.log('Connected success.');
                    return BleManager.retrieveServices(id);                    
                })
                .then((peripheralInfo)=>{
github adafruit / glider / App.js View on Github external
BleManager.connect(p.id).then(() => {
                BleManager.retrieveServices(p.id).then((peripheralInfo) => {
                  console.log(peripheralInfo);
                  p.advertising.serviceUUIDs = [peripheralInfo.services[2].uuid];
                  changePeripherals({"action": "add", "peripheral": p});
                });
              });
              }