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

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. PRML-Chapter3 Linear Models for Regression

    Example: Polynomial Curve Fitting The goal of regression is to predict the value of one or more cont ...

  2. ZOJ3551Bloodsucker (数学期望)

    In 0th day, there are n-1 people and 1 bloodsucker. Every day, two and only two of them meet. Nothin ...

  3. for循环使用append问题

    append添加到元素的时候,已存在的元素是移动而不是复制,使用了遍历,所以第一次是新增,后面都是移动前面新增的,最后当然就出现了只有最后一项有东西.解决办法:1.不要遍历,使用jQuery的类选择器 ...

  4. Java并发--阻塞队列

    在前面几篇文章中,我们讨论了同步容器(Hashtable.Vector),也讨论了并发容器(ConcurrentHashMap.CopyOnWriteArrayList),这些工具都为我们编写多线程程 ...

  5. Java调用函数传递参数到底是值传递还是引用传递

    今天翻看微信上有关Java技术的公众号时,看到了一篇关于Java中值传递的问题,文章讨论了在Java中调用函数进行传参的时候到底是值传递还是引用传递这个面试时会问到的问题.之前也接触过类似的问题,但只 ...

  6. Python: 为对象动态添加函数,且函数定义来自一个str

    转自:http://blog.sina.com.cn/s/blog_55a11f330100ab1x.html 在Python中,通常情况下,你只能为对象添加一个已经写好的方法 需求:传入一个str类 ...

  7. VS 2013 简体中文 专业版 下载地址。

    官方原始链接:http://download.microsoft.com/download/7/A/C/7AC27F37-FDFE-4991-B18A-962E26E31BD1/VS2013_RTM_ ...

  8. docker windows 2016 安装测试

    1. 安装方式      powershell Install-Module-NameDockerMsftProvider-RepositoryPSGallery-Force Install-Pack ...

  9. 读懂IL代码就这么简单 ---- IL系列文章

    读懂IL代码就这么简单 (一) 读懂IL代码就这么简单(二) 读懂IL代码就这么简单(三)完结篇 出处:http://www.cnblogs.com/zery/tag/IL%20%E7%B3%BB%E ...

  10. 在 CentOS 7.2 上安装 ODOO 10 (2018-10-09 持续更新)

    在 CentOS 7.2 上安装 ODOO 10 更新系统 yum update 安装 EPEL 源 1 yum install -y epel-release 安装依赖组件 yum install ...