I am using my own npm package that I developed to read BLE data. The package depends on
@abandonware/noble.. I am using node-red as a platform.
My package is available in GitHub. Also you can install via npm as well.
Based on @Danois90 comment as well, it is better If I post more complete code I guess:
My code in Arduino (only related parts):
#define BLE_UUID_ACCELEROMETER_SERVICE "1101"
#define BLE_UUID_ACCELEROMETER_X "2101"
#define BLE_DEVICE_NAME "Nano"
#define BLE_LOCAL_NAME "Nano"
BLEShortCharacteristic accelerometerCharacteristic_X( BLE_UUID_ACCELEROMETER_X, BLERead | BLENotify );
BLEDescriptor accelerationXDescriptor("2901", "AccelerationX");
// set advertised local name and service UUID
BLE.setDeviceName( BLE_DEVICE_NAME );
BLE.setLocalName( BLE_LOCAL_NAME );
BLE.setAdvertisedService( accelerometerService );
//Add Descriptors
accelerometerCharacteristic_X.addDescriptor(accelerationXDescriptor)
// BLE add characteristics
accelerometerService.addCharacteristic( accelerometerCharacteristic_X );
// add service
BLE.addService( accelerometerService );
The function I use to discover services and characteristics:
const ALL = await peripheralArray[index].discoverSomeServicesAndCharacteristicsAsync(serviceValues, characteristicValues).catch(e => send(e));
The one you linked is deprecated, has many issues etc. I use @abandonware/noble.