noble/bleno

Cannot pair with phone

Ouverte

#256 ouverte le 8 janv. 2017

 (1 commentaire) (0 réaction) (0 personne assignée)JavaScript (465 forks)batch import
help wanted

Métriques du dépôt

Stars
 (2 083 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

This is my code, I am using an RPI3 I see my device in the bluetooth list but when I try to pair I get "Could not connect with My Device"

const bleno = require('bleno');

const PrimaryService = bleno.PrimaryService;
const Characteristic = bleno.Characteristic;

const SERVICEUUID = 'fffffffffffffffffffffffffffffff0';

const name = 'My Device';
const serviceUuids = [SERVICEUUID];

bleno.on('stateChange', (state) => {
  console.log('Change state -> ' + state);
  if (state === 'poweredOn') {
    bleno.startAdvertising(name, serviceUuids);
  } else {
    bleno.stopAdvertising();
  }
});

bleno.on('advertisingStart', (error) => {
  if (error) {
    console.log('Advertising error -> ' + error);
  } else {
    console.log('Advertising started -> name ' + name);
    console.log('Services running -> \n\t' + serviceUuids.join('\n\t'));
    bleno.setServices([
      new PrimaryService({
        uuid: SERVICEUUID,
        characteristics: [
          new Characteristic({
            uuid: 'fffffffffffffffffffffffffffffff1',
            properties: ['read', 'write'],
            secure: ['read', 'write'],
            value: null,
            descriptors: []
          })
        ]
      })
    ]);
  }
});

Guide contributeur