Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Promise rejection: No Services matching UUID 0000ffe0-0000-1000-8000-00805f9b34fb found in Device. #332

Open
shantanukiwitech17 opened this issue Mar 29, 2024 · 0 comments

Comments

@shantanukiwitech17
Copy link

shantanukiwitech17 commented Mar 29, 2024

I am trying to integrate this library to connect a weight scale with angular electron project and facing an error.

Dependencies:

"@angular-devkit/build-angular": "~12.2.18",
"@angular/cli": "^12.2.18",
"@angular/compiler-cli": "~12.2.0",
"@abandonware/noble": "^1.9.2-23",

node version - 14.15.0
npm version - 6.14.8

I think the problem is in the last line of the below code because it is getting service but not characteristics

module.exports = {
init: function (event) {
noble.on('stateChange', (state) => {
if (state === 'poweredOn') {
console.log('Scanning');
noble.startScanning([ECHO_SERVICE_UUID], false);
} else {
noble.stopScanning();
}
});

noble.on('discover', (peripheral) => {
  // connect to the first peripheral that is scanned
  noble.stopScanning();
  const name = peripheral.advertisement.localName;
  console.log(`Connecting to '${name}' ${peripheral.id}`);
  connectAndSetUp(peripheral);
});

}
}

function connectAndSetUp(peripheral) {
peripheral.connect((error) => {
if (error) {
console.error(error);
return;
}

console.log('Connected to', peripheral.id);

// specify the services and characteristics to discover
const serviceUUIDs = [ECHO_SERVICE_UUID];
const characteristicUUIDs = [ECHO_CHARACTERISTIC_UUID];

console.log(serviceUUIDs, characteristicUUIDs);

peripheral.discoverAllServicesAndCharacteristics(
  onAllServicesAndCharacteristicsDiscovered
);

Capture2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant