Commit d5876fc0 authored by 刘俊宏's avatar 刘俊宏

蓝牙补全

parent fb7b4689
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "lianjiezhong.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "lianjiezhong@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "lianjiezhong@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -63,6 +63,11 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT ...@@ -63,6 +63,11 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
} }
self.selectDataArray.insert(peripheral!, at: 0) self.selectDataArray.insert(peripheral!, at: 0)
self.tableView.reloadData() self.tableView.reloadData()
HUD.flash(.labeledSubSuccess(subtitle: "连接成功"),delay: 1.5)
})
baby?.setBlockOnFailToConnect({ (central, peripheral, error) in
HUD.flash(.labeledSubError(subtitle: "连接失败"),delay: 1.5)
}) })
...@@ -92,6 +97,7 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT ...@@ -92,6 +97,7 @@ class BluetoothConnectViewController: BaseViewController,UITableViewDelegate,UIT
self.baby?.cancelAllPeripheralsConnection() self.baby?.cancelAllPeripheralsConnection()
}else{ }else{
HUD.show(.labeledProgress(title: "", subtitle: "连接中"))
let currPeripheral:CBPeripheral = self.peripheralDataArray[indexPath.row] let currPeripheral:CBPeripheral = self.peripheralDataArray[indexPath.row]
print("准备连接的设备:\(currPeripheral.name)") print("准备连接的设备:\(currPeripheral.name)")
self.baby?.having(currPeripheral)?.and()?.channel("peripheralView")?.then()?.connectToPeripherals()?.begin() self.baby?.having(currPeripheral)?.and()?.channel("peripheralView")?.then()?.connectToPeripherals()?.begin()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment