java 蓝牙指定连接失败_vue app混合开发蓝牙串口连接(报错java.io.IOException: read failed, socket might closed or timeout, ...

我使用的uni-app

发送

已搜索的蓝牙:

蓝牙名称:{ {item.name}}

SN:{ {item.SN}}

已匹配的蓝牙:

蓝牙名称:{ {item.name}}

SN:{ {item.SN}}

打开蓝牙

关闭蓝牙

搜索蓝牙

varmain, Context, BluetoothManager, BluetoothAdapter, BManager, BAdapter,BluetoothDevice,IntentFilter,bluetoothSocket,device;

exportdefault{

data() {return{

bArray:[],//用于搜索蓝牙去重用的

no_match_list:[],//没有配对的蓝牙列表

match_list:[],//已配对的蓝牙列表

send_data_onoff:false,

send_data_list:'',//要发送的数据

};

},

onShow() {//获取android应用Activity对象

main =plus.android.runtimeMainActivity();

Context= plus.android.importClass("android.content.Context");

BManager=main.getSystemService(Context.BLUETOOTH_SERVICE);//蓝牙适配器

BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");//蓝牙本地适配器

BAdapter =BluetoothAdapter.getDefaultAdapter();//蓝牙设备

BluetoothDevice = plus.android.importClass('android.bluetooth.BluetoothDevice');//过滤器

IntentFilter = plus.android.importClass('android.content.IntentFilter');

},

methods:{/**

* 根据蓝牙地址,连接设备

* @param {O

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值