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

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;

TBluetoothLE.OnDisconnectDevice的更多相关文章

  1. delphi 蓝牙 TBluetoothLE

    delphi 蓝牙 TBluetoothLE.TBluetoothLEManager BLE http://docwiki.embarcadero.com/RADStudio/Seattle/en/U ...

  2. TBluetoothLE

    delphi 蓝牙技术 D:\Users\Public\Documents\Embarcadero\Studio\17.0\Samples\Object Pascal\Multi-Device Sam ...

  3. RAD Studio 10 自带Demo代码汇总说明

    大家好,好多朋友来信咨询Delphi和C++Builder的移动开发.DataSnap架构等问题,希望能有Demo代码学习.其实Delphi和C++Builder本身自带有很多示例代码,已经覆盖了大部 ...

  4. delphi 演示数据路径

    链接里默认的--------------------------- Error --------------------------- I/O error for file "C:\Prog ...

  5. delphi BLE 学习

    TBluetoothLE 控件 TBluetoothLE.FManager: TBluetoothLEManager; class constructor TBluetoothLEManager.Cr ...

  6. Delphi IOS 蓝牙锁屏后台运行

    Delphi IOS 后台运行 同样的程序,编译成android,锁屏后继续运行正常,蓝牙通讯正常,但在IOS下锁屏后程序的蓝牙就中断通讯了? IOS的机制就是这样,锁屏就关闭了. 音乐播放器是怎么做 ...

  7. RAD 10 蓝牙

    http://docwiki.embarcadero.com/Libraries/Seattle/en/System.Bluetooth.TBluetoothLEManager.StartDiscov ...

随机推荐

  1. test20190308

    测试 晚上考试,是 \(SCOI\ 2016\ Day\ 2\) 的题目. 妖怪 由于之前在洛谷上用三分水过去了,就很 \(naive\) 地打了一个三分就跑了.获得 \(10\) 分好成绩. 记 \ ...

  2. mysql 关联左表不存在数据 并 根据身份证计算查找大于65岁以上老人

    --- //查找左边不存在数据,不能用 = '' SELECT m.uid FROM es_members m LEFT JOIN es_user_self_care_assessment u ON ...

  3. python string 之 format, join, split

    功能太强大. 经常看到很多简洁, 高级的用法. 但是基本思路是{}代替了以前的%. In [1]: '{0},{1}'.format('kzc',18) Out[1]: 'kzc,18' In [2] ...

  4. WPF 使用MahApps.Metro UI库

    在WPF中要想使用Metro风格是很简单的,可以自己画嘛.. 但是为了节省时间,哈,今天给大家推荐一款国外Metro风格的控件库. 本文只起到抛砖引玉的作用,有兴趣还是推荐大家上官网,Thanks,官 ...

  5. Apache Tez 了解

    你可能听说过Apache Tez,它是一个针对Hadoop数据处理应用程序的新分布式执行框架.但是它到底是什么呢?它的工作原理是什么?哪些人应该使用它,为什么?如果你有这些疑问,那么可以看一下Bika ...

  6. Junit+ant+JaCoCo集成使用

    接上文,本文主要介绍Junit+ant+JaCoCo集成使用 1.工具的下载上传 需要的工具有: apache-ant-1.10.5-bin.tarapache-tomcat-8.0.50.tarja ...

  7. bzoj 1257 [CQOI2007]余数之和——数论分块

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1257 \( n\%i = n - \left \lfloor n/i \right \rfl ...

  8. 5.Python使用最新爬虫工具requests-html

    1.安装,在命令行输入:pip install requests-html,安装成功后,在Pycharm引入即可. 2.代码如下所示: from requests_html import HTMLSe ...

  9. nginx学习与配置-安装与启动关闭管理

    nginx服务器的安装 安装准备: nginx依赖于pcre库,要先安装pcre yum install pcre pcre-devel cd /usr/local/src/ wget wget ht ...

  10. 常见企业IT支撑【1、办公网络IP地址规划】

    规划思路如下,可灵活变化