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

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. 【javascript】如何延迟加载JavaScript(Google推荐的代码)

    下面是Google推荐的代码.这些代码应被放置在</body>标签前(接近HTML文件底部)<script type="text/javascript">f ...

  2. 快速排序的partition版本实现

    int partition(int arr[], int low, int high) { int pivot = arr[high]; int i = low-1; for (int j = low ...

  3. BZOJ1260 CQOI2007 涂色paint 【区间DP】

    BZOJ1260 CQOI2007 涂色paint Description 假设你有一条长度为5的木版,初始时没有涂过任何颜色.你希望把它的5个单位长度分别涂上红.绿.蓝.绿.红色,用一个长度为5的字 ...

  4. Atocder ARC082 F-Sandglass 【思维题】*

    Atocder ARC082 F-Sandglass Problem Statement We have a sandglass consisting of two bulbs, bulb A and ...

  5. iOS Webview打开不受信的URL

    在我们开发过程中经常会碰到直接访问开发人员的私有地址, 这样在app 上是无法打开指定的网页的. 在iOS中需要对WKWebView 进行如下设置: 1.在工程的Plist 文件中添加一下选项 App ...

  6. 《DSP using MATLAB》示例9.3

    增采样操作是时变的.

  7. 【spring源码学习】spring集成orm数据框架

    [一]简易的数据源配置 (1)配置文件 <!--springJdbcTemplemate数据操作配置信息 --> <bean id="driver" class= ...

  8. Oracle之 等待事件log file sync + log file parallel write (awr优化)

    这是3月份某客户的情况,原因是server硬件故障后进行更换之后,业务翻译偶尔出现提交缓慢的情况.我们先来看下awr的情况. 我们能够看到,该系统的load profile信息事实上并不高,每秒才21 ...

  9. sqlite3添加、修改列名(转)

    sqlite3添加.修改列名http://blog.163.com/yi_xiaoluo@126/blog/static/72090439201161533941528/SQLite如何删除,修改.重 ...

  10. windows + python3.5.2 + anaconda3 + dlib 安装配置

    首先下载boost库,根据提示:1)运行 bootstrap.bat.  生成三个文件,其中包括b2  --  bootstrap.bat2)运行b2  --     b2 install3) 利用b ...