This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

get notification failed on noridc uart service with Ionic2 Ble

i try to connect and read and write on my device with ionic2 BLE plugin , i can connect and also write on the device but when i try to read a data from device and use startNotification i get error that say can't start Notification this is my code :

 ble.connect(navParams.get("device")["id"]).subscribe((p) => {
    this.d = "Success";
    this.connected = "connected"
    zone.run(() => {
      this.status = "Connected"
    })
    this.data = JSON.stringify(p);
    let lastChar = p.characteristics[p.characteristics.length - 1];
    let serviceId = lastChar.service;
    let chUUID = lastChar.characteristic;

    let lastChar2 = p.characteristics[p.characteristics.length - 2];
    let serviceId2 = lastChar2.service;
    let chUUID2 = lastChar2.characteristic;
    this.ble.write(navParams.get("device")["id"], serviceId, chUUID, this.stringToBytes("HOPE AGAIN")).then(() => {
      //      zone.run(()=>{
      //   this.status="Writing"
      // })
    })
    this.ble.startNotification(navParams.get("device")["id"], serviceId, chUUID).subscribe(m => {
      zone.run(() => {
        this.status = "Notification"
      })
      // this.cdata = typeof p;
      this.ble.read(navParams.get("device")["id"], serviceId2, chUUID2).then(s => {
        zone.run(() => {
          this.status = "Read"
        })
      })
    },f=>{
      zone.run(()=>{this.status=f})
    })
    //this.data = JSON.stringify(p);
  })

and this is the home page of ble plugin and this is startNotification but i get error that cant start notifictaion on device with service id

Parents Reply Children
No Data
Related