in my app i’m trying to connect to BLE and show status of connecting on {{status}}
variables. this is my code, this is scan()
method and called when user press a button :
scan() {
let that = this;
this.ble.scan([], 1).subscribe(d=> {
this.devices = d;
this.l = d.id.toString();
this.ble.connect(d.id).subscribe(p => {
that.status = "connected"
let lastChar = p.characteristics[p.characteristics.length - 1];
let serviceId = lastChar.service;
let chUUID = lastChar.characteristic;
// this.ble.write(d.id.toString(), serviceId, chUUID, this.stringToBytes("HOPE AGAIN")).then(() => {
// })
this.ble.startNotification(d.id, serviceId, chUUID).subscribe(p => {
that.status = "NOTI";
// this.cdata = typeof p;
this.ble.read(d.id, serviceId, chUUID).then(p => {
that.status = "CHANGEEED";
})
})
// this.connected = "SUCESSFULLY CONNECTED TO ";
// this.cdata = JSON.stringify(p);
})
})
in any state of promise like ble.connect,or ble.startNotification, or ble.write i change the status variable, but nothing change and the wonderfull thing is my app successfully connected to device and can write on device , so it means it successfully connected and must show connected
string. but nothing is show or changed.