TBluetoothLE.OnDisconnectDevice

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

BluetoothLE1.DiscoveredDevices[0].OnConnect;

BluetoothLE1.DiscoveredDevices[0].OnDisconnect;

procedure TForm7.myDisConnect( Sender : TObject );
begin

end;

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;

// will be invoked once disconnected

-(void)centralManager:(CBCentralManager *)central
  didDisconnectPeripheral:(CBPeripheral *)peripheral
                         error:(NSError *)error;
时间: 2024-10-15 22:29:00

TBluetoothLE.OnDisconnectDevice的相关文章

delphi TBluetoothLE

delphi TBluetoothLE.TBluetoothLEManager 1.搜索设备 BluetoothLE1.DiscoverDevices(4000); 触发事件 BluetoothLE1EndDiscoverDevices 发现蓝牙设备 2.搜索服务 BluetoothLE1.DiscoverServices(FCurrentDevice) BluetoothLE1EndDiscoverServices  发现蓝牙设备的服务 3.发送数据 BluetoothLE1.WriteCha

TBluetoothLE

D:\Users\Public\Documents\Embarcadero\Studio\17.0\Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\Bluetooth\Classic Bluetooth Basic app 搜索蓝牙设备 FBluetoothManager.StartDiscovery(1000); or BluetoothLE1.DiscoverDevices(ScanningTime

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

大家好,好多朋友来信咨询Delphi和C++Builder的移动开发.DataSnap架构等问题,希望能有Demo代码学习.其实Delphi和C++Builder本身自带有很多示例代码,已经覆盖了大部分Delphi和C++Builder开发工具的特性和技术.对于开发各种特定的应用,还是需要去在特定方向钻研该方面的技术的,不要指望一套Demo代码就可以代替自己的学习. 为了方便各位 Delphi 和 C++Builder开发者,有针对性的查找RAD Studio自带的示例代码,从而更快更有针对性的