找不到离子本机串行返回设备

时间:2018-12-16 20:33:31

标签: android ionic-framework native device communication

问题是:  我想在台式机和android智能设备之间建立通信。

我正在尝试一个简单的步骤,但是我得到“找不到设备”作为回报

这是我编写代码的基础: https://ionicframework.com/docs/native/serial/

这是代码:

  

从'@ angular / core'导入{Component,OnInit};导入{   NavController}来自“离子角”;从导入{Serial}   '@ ionic-native / serial';

     

@Component({选择器:'page-home',templateUrl:'home.html'})   导出类HomePage实现OnInit {公共状态:字符串;
  构造函数(公共navCtrl:NavController,公共序列:Serial){

     

}

     

ngOnInit(){
  this.serial.requestPermission({vid:“ 04e8”,pid:“ 6860”,驱动程序:“ FtdiSerialDriver”})// I   已经尝试省略请求选项,但出现相同的错误   .then(()=> {        this.status =“已请求权限”; //这将是成功的结果})。catch(error => {        this.status = error.toString(); //返回“找不到设备”}); }

网络上有关此功能的内容很少。

0 个答案:

没有答案