首页 > 其他 > 详细

TBluetoothLE

时间:2015-09-06 15:50:44      阅读:648      评论:0      收藏:0      [点我收藏+]

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);

配对

FAdapter.Pair(FDiscoverDevices[ComboboxDevices.ItemIndex])

取消配对

FAdapter.UnPair(FPairedDevices[ComboboxPaired.ItemIndex])

 

TBluetoothManager.CurrentAdapter
FSocket: TBluetoothSocket;
ToSend: TBytes;

ToSend := TEncoding.UTF8.GetBytes(Edit1.Text);
FSocket.SendData(ToSend);

 

procedure TfrmHeartMonitor.BluetoothLE1EndDiscoverDevices(const Sender: TObject;
  const ADeviceList: TBluetoothLEDeviceList);
var
  I: Integer;
begin
  // log
  Memo1.Lines.Add(ADeviceList.Count.ToString +   devices discovered:);
  for I := 0 to ADeviceList.Count - 1 do Memo1.Lines.Add(ADeviceList[I].DeviceName);

  if BluetoothLE1.DiscoveredDevices.Count > 0 then
  begin
    FBLEDevice := BluetoothLE1.DiscoveredDevices.First;
    lblDevice.Text := HRDeviceName;
    if BluetoothLE1.GetServices(FBLEDevice).Count = 0 then
    begin
      Memo1.Lines.Add(No services found!);
      lblBPM.Font.Size := 26;
      lblBPM.Text := No services found!;
    end
    else
      GetServiceAndCharacteristics;
  end
  else
    lblDevice.Text := Device not found;
end;

 

TBluetoothLE

原文:http://www.cnblogs.com/cb168/p/4785575.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!