cordova-plugin-ble-peripheral无法在离子上创建服务

时间:2018-08-11 14:31:05

标签: ionic3 bluetooth-lowenergy cordova-plugins

这里有一些介绍。我已经尝试了离子本机BLE,它可以工作并且能够扫描我的设备。因此,在那之后,我尝试创建其对应的外围设备。 但是,一旦单击运行creatUartService方法,就只会显示第一个吐司。所以我认为ble外围方法有问题

SERVICE_UUID:string = 'FF10';
  toastOnCreate(message:string){
    let toast = this.toastCtrl.create({
      message: message,
      duration: 3000,
      position: 'middle'
    });
    toast.present();
  }

  createUartService(){
    this.toastOnCreate("Start create");
    cordova.plugins.blePeripheral.createService(this.SERVICE_UUID);

     cordova.plugins.blePeripheral.publishService(this.SERVICE_UUID);
     cordova.plugins.blePeripheral.startAdvertising(this.SERVICE_UUID, 'UART');

    this.toastOnCreate("End");
  }

0 个答案:

没有答案