码迷,mamicode.com
首页 > 移动开发 > 详细

iOS Bluetooth Reconnect

时间:2014-08-28 20:58:46      阅读:467      评论:0      收藏:0      [点我收藏+]

标签:blog   http   os   使用   io   ar   for   2014   cti   

  蓝牙的重连主要分为以下两种:

1、恢复一些已知的设备,已知的设备就是在此次操作之前你扫描到的或者已经连接过的设备。用retrievePeripheralsWithIdentifiers:函数去完成回复操作。

2、恢复已连接的设备,这里要和上面已知的设备区别开。这里的设备指的是此时设备与手机保持着连接状态。什么时候会出现这种情况呢?就是在这个设备可以被多个应用程序使用,也是这个设备功能很强,有多个Service供他人使用。现在其他应用程序正在使用这个设备,所以设备与系统保持连接。这是就可以用retrieveConnectedPeripheralsWithServices: 去恢复这样的已连接设备。

  Retrieve a list of peripheral devices that are currently connected to the system using the retrieveConnectedPeripheralsWithServices: method. If the peripheral you’re looking for

 

以上两个函数都已经不需要回调函数返回恢复结果了,函数的返回值就是可以恢复设备的列表了。

 

下面介绍下常规的恢复与连接设备的流程,这里就引用苹果官方的流程:

 

 

bubuko.com,布布扣

Step1:进行恢复已知设备的操作

Step2:进行恢复已连接设备的操作

Step3:进行扫描连接的操作

这三步下来,应该把能连接到的设备都连接了。

关于更详细的Apple的Core Bluetooth框架的学习,可以去看官方的Guide,非常的好。

https://developer.apple.com/Library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/AboutCoreBluetooth/Introduction.html#//apple_ref/doc/uid/TP40013257-CH1-SW1

本人属于入门,有什么错误或者不足之处可以联系我,谢谢!

iOS Bluetooth Reconnect

标签:blog   http   os   使用   io   ar   for   2014   cti   

原文地址:http://www.cnblogs.com/scaptain/p/3942276.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!