| | |
| | | /// <param name="FinishEvent">搜索结束的事件</param> |
| | | public void ScanBluetooth(int waitTime, Action<List<BluetoothInfo>> FinishEvent) |
| | | { |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //再次检测是否能够搜索蓝牙 |
| | | this.CheckCanScanBluetooth((result) => |
| | | { |
| | |
| | | this.DoScanBluetooth(waitTime, FinishEvent); |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | |
| | |
| | | /// <param name="connectEvent">因为需要对方反馈,所以使用回调(链接结果 false:连接失败 true:连接成功)</param> |
| | | public void ContectBluetooth(BluetoothInfo bluetooth, Action<bool> connectEvent) |
| | | { |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | try |
| | | { |
| | | //添加事件 |
| | |
| | | connectEvent?.Invoke(false); |
| | | connectEvent = null; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | try |
| | | { |
| | | this.sendStatuValue = -1; |
| | | if (waiTime == 0) |
| | | { |
| | | //发送数据 |
| | | var data = new Foundation.NSData(); |
| | | data = i_data; |
| | | blufiClient.PostCustomData(data); |
| | | //直接返回成功 |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //或许他用的是线程来调用 |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //发送数据 |
| | |
| | | blufiClient.PostCustomData(data); |
| | | |
| | | }, ShowErrorMode.NO); |
| | | } |
| | | |
| | | if (waiTime == 0) { return true; } |
| | | |
| | | waiTime *= 5; |
| | | while (this.sendStatuValue == -1 && waiTime > 0) |
| | | { |