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

TBluetoothLE

时间:2015-09-06 15:51:03      阅读:455      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!