ble.startNotification not working

Hi, any help would be greatly appreciated. I am also willing to pay for a screen share session with someone who is familiar with this bluetooth library.

ble.startNotification not working for me :frowning:

I am using this library: import { BLE } from ‘@awesome-cordova-plugins/ble/ngx’;

I am able to connect to my bluetooth remote and to get back device info. But the startNotification call never seems to run. I am using current angular and ionic versions. I am trying to listen to button clicks on the remote. I am not sure what values to use for the service and characteristic that would correspond to one of the buttons on my bluetooth remote, the two values listed in the startNotification call are my best guess.

this.ble.connect(this.deviceId).subscribe(results => {

this.tempOutput = ‘connected to remote’; // this works

this.ble.startNotification(this.deviceId, ‘1812’, ‘2a4e’).subscribe(buffer => {
this.tempOutput = ‘subscribe’; // this does NOT work
});

});

I have tried various methods of formatting what startNotification returns but nothing comes back:
// this.tempOutput = String.fromCharCode.apply(null, new Uint8Array(buffer));

Here is the device output from the connect function:

{
“name”: “AB Shutter3”,
“id”: “2A:07:98:10:40:05”,
“services”: [
“1801”,
“1800”,
“180a”,
“1812”,
“180f”
],
“characteristics”: [
{
“service”: “1801”,
“characteristic”: “2a05”,
“properties”: [
“Indicate”
],
“descriptors”: [
{
“uuid”: “2902”
}
]
},
{
“service”: “1800”,
“characteristic”: “2a00”,
“properties”: [
“Read”
]
},
{
“service”: “1800”,
“characteristic”: “2a01”,
“properties”: [
“Read”
]
},
{
“service”: “1800”,
“characteristic”: “2a04”,
“properties”: [
“Read”
]
},
{
“service”: “180a”,
“characteristic”: “2a50”,
“properties”: [
“Read”
]
},
{
“service”: “1812”,
“characteristic”: “2a4e”,
“properties”: [
“Read”,
“WriteWithoutResponse”
]
},
{
“service”: “1812”,
“characteristic”: “2a4d”,
“properties”: [
“Read”,
“Notify”
],
“descriptors”: [
{
“uuid”: “2902”
},
{
“uuid”: “2908”
}
]
},
{
“service”: “1812”,
“characteristic”: “2a4d”,
“properties”: [
“Read”,
“Notify”
],
“descriptors”: [
{
“uuid”: “2902”
},
{
“uuid”: “2908”
}
]
},
{
“service”: “1812”,
“characteristic”: “2a4b”,
“properties”: [
“Read”
]
},
{
“service”: “1812”,
“characteristic”: “2a4a”,
“properties”: [
“Read”
]
},
{
“service”: “1812”,
“characteristic”: “2a4c”,
“properties”: [
“WriteWithoutResponse”
]
},
{
“service”: “180f”,
“characteristic”: “2a19”,
“properties”: [
“Read”,
“Notify”
],
“descriptors”: [
{
“uuid”: “2902”
}
]
}
]
}

From your output, it looks like the characteristic 2a4e does not support notifications. You can only use notifications for characteristics that support it.

Thank you very much, so you are saying I can only listen for changes on a characteristic that is listed as ‘Notify’ which means only these two characteristics: 2a4d and 2a19?

on the output I get ‘connected to remote’ but still nothing from the startNotification. I would expect to see ‘subscribed’ or ‘error’.

this.ble.connect(this.deviceId).subscribe(results => {

      this.tempOutput = 'connected to remote';

      this.ble.startNotification(this.deviceId, '1812', '2a4d').subscribe(buffer => {
        this.tempOutput = 'subscribed';
      }), (error: any) => {
        this.tempOutput = 'error';
      };
});