博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
TBluetoothLE.OnDisconnectDevice
阅读量:5994 次
发布时间:2019-06-20

本文共 2088 字,大约阅读时间需要 6 分钟。

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

TBluetoothLE.OnDisconnectDevice

 TBluetoothLEDevice

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

 BluetoothLE1.DiscoveredDevices[0].OnConnect;

 BluetoothLE1.DiscoveredDevices[0].OnDisconnect;

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

 

 

和下面这个是相反的。

System.Mac.Bluetooth.pas{
TInternalBluetoothLEManager }procedure TInternalBluetoothLEManager.centralManagerDidConnectPeripheral(central: CBCentralManager; peripheral: CBPeripheral);begin FLastError := 0; 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;

 

转载地址:http://fvqlx.baihongyu.com/

你可能感兴趣的文章
网络编程bio流程Java demo
查看>>
Gym - 100269F Flight Boarding Optimization(dp+树状数组)
查看>>
Codeforces Global Round 1
查看>>
EXPORT Man Information for Linux use COMMAND col
查看>>
css+div水平居中
查看>>
1137 Final Grading
查看>>
20145213《Java程序设计》实验五Java网络编程及安全
查看>>
网络编程-第三节
查看>>
关于link标签的用法, 不声明rel=stylesheet则无效? 在ff中必须声明rel属性!
查看>>
Infer - 文件说明
查看>>
Linux shell编程与实践(十一)之shell与Java的组合
查看>>
第 8 章 容器网络 - 048 - 跨主机网络概述
查看>>
个人总结
查看>>
manecher_回文串;
查看>>
第九周项目6-穷举法之百钱百鸡
查看>>
PHP SOAP 发送XML
查看>>
来自风湿病研究院RA患者队列研究显示, RA日常诊治时特别是早期RA患者成功维持新ACR/EULAR缓解标准能获...
查看>>
JavaEE(22) - JAX-WS Web Service
查看>>
php函数
查看>>
PHP如何根据数组中的键值进行排序
查看>>