自己作为广播方,连接我的设备断开收到的事件。

TBluetoothLE.OnDisconnectDevice

TBluetoothLEDevice

BluetoothLE1->DiscoveredDevices->Items[i]->DisposeOf();

BluetoothLE1.DiscoveredDevices[0].OnConnect;

BluetoothLE1.DiscoveredDevices[0].OnDisconnect;

procedure TForm7.myDisConnect( Sender : TObject );
begin end; procedure TForm7.FormCreate( Sender : TObject );
begin
BluetoothLE1.DiscoveredDevices[ ].OnDisconnect := myDisConnect;
end;

和下面这个是相反的。

System.Mac.Bluetooth.pas

{ TInternalBluetoothLEManager }

procedure TInternalBluetoothLEManager.centralManagerDidConnectPeripheral(central: CBCentralManager; peripheral: CBPeripheral);
begin
FLastError := ;
FConnected := True;
if Assigned(FOnDeviceConnect) then
FOnDeviceConnect(Self, peripheral);
end; procedure TInternalBluetoothLEManager.centralManagerdidDisconnectPeripheral(central: CBCentralManager; peripheral: CBPeripheral;
error: NSError);
begin
FLastError := error.code;
FConnected := True;
if Assigned(FOnDeviceDisconnect) then
FOnDeviceDisconnect(Self, peripheral);
end;

property OnDeviceDisconnect: TDeviceConnectionChangeEvent read FOnDeviceDisconnect write FOnDeviceDisconnect;
property OnDeviceConnect: TDeviceConnectionChangeEvent read FOnDeviceConnect write FOnDeviceConnect;

FOnConnect: TNotifyEvent;
    FOnDisconnect: TNotifyEvent;

所以可以用TNotifyEvent自定义通知事件来解决。

TNotifyEvent is used for events that do not require parameters.

The TNotifyEvent type is the type for events that have no event-specific parameters. These events simply notify the component that a specific event occurred. For example, OnClick, which is of type TNotifyEvent, notifies the control that a click event occurred on the control.

The Sender parameter is the object whose event handler is called. For example, with the OnClick event of a button, the Sender parameter is the button component that is clicked.

property OnDisconnect: TNotifyEvent read FOnDisconnect write FOnDisconnect;
// will be invoked once disconnected

-(void)centralManager:(CBCentralManager *)central
didDisconnectPeripheral:(CBPeripheral *)peripheral
error:(NSError *)error;

最新文章

  1. JavaScript的基本语法
  2. 19.Java 注解
  3. asp.net mvc4 Html.BeginForm表单提交
  4. NAT原理与NAT穿越
  5. 使用NPOI随意创建Excel(含下拉列表)
  6. POJ 2114 - Boatherds
  7. 用static关键字修饰类
  8. Java [Leetcode 217]Contains Duplicate
  9. iOS开发笔记系列-基础3(多态、动态类型和动态绑定)
  10. [HTML5 Canvas学习]绘制矩形
  11. PHP弱类型:WordPress Cookie伪造
  12. Centos 搭建LAMP环境
  13. lodash源码分析之自减的两种形式
  14. 详解Ajax请求(一)前言——同步请求的原理
  15. thinkpad x260在ubuntu 14.04lts wifi驱动安装 ( ubuntu iwlwifi驱动 都可行 )
  16. Win10U盘启动盘制作及Win10系统安装
  17. java基础知识点罗列
  18. EXSI6.5复制文件太慢的解决方法
  19. 树莓派UFW防火墙简单设置
  20. C中结构体的存储分配

热门文章

  1. CentOS跨网段访问
  2. C语言变量、函数的作用域及变量的存储方式
  3. 新的开源java反汇编程序Procyon
  4. Eclipse自动补全设置与Eclipse源代码下载
  5. bzoj 4811 由乃的OJ
  6. BZOJ1096 ZJOI2007 仓库建设 【斜率优化DP】
  7. python笔记-13 mysql与sqlalchemy
  8. kong nginx 配置文件说明&&借鉴
  9. 中兴G718C开发者模式开启
  10. 使用RawComparator加速Hadoop程序