码迷,mamicode.com
首页 > 其他好文 > 详细

TBluetoothLE.OnDisconnectDevice

时间:2016-01-22 21:23:22      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

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

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;

 

TBluetoothLE.OnDisconnectDevice

标签:

原文地址:http://www.cnblogs.com/cb168/p/5151867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!