You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
);
The text was updated successfully, but these errors were encountered:
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();
}
});
}
}
function connectAndSetUp(peripheral) {
peripheral.connect((error) => {
if (error) {
console.error(error);
return;
}
The text was updated successfully, but these errors were encountered: