我正在尝试学习蓝牙信标与拉德包西雅图。所以我尝试了所有的信标样本,但似乎都不起作用。我在三款不同的Pc (2台Windows 7和1台Server 2012)上试了这6款手机,并在4款不同的android智能手机(LG和诺基亚)上运行了代码。我在所有的Pc上安装了西雅图的新版本,大多数样本在几秒钟内就失败了。有时它们会结冰,有时它们会崩溃,其中一个似乎在运行,但它就是看不到我把它指向的信标(而且我知道它能工作,因为我有一些已经完成的程序,可以找到我想要的信标)等等。其中一个,我认为最简单的一个(它只有12行),没有收到一条关于“重复记录”的信息。
所以我开始认为西雅图的Rad Pack有问题。但那不可能是真的,所以我想一定是我在做什么。但是什么呢?不幸的是,很少有人提出这个问题。
如果我问错了地方,请指出正确的方向。
任何暗示都会被感激的-非常感谢。;-)
PoulK
这是简单灯塔演示
区块报价
Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Beacon, FMX.Layouts, FMX.Memo,
System.Beacon.Components, FMX.StdCtrls, FMX.Controls.Presentation, FMX.ScrollBox;
type
TForm1 = class(TForm)
Beacon1: TBeacon;
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Beacon1BeaconEnter(const Sender: TObject; const ABeacon: IBeacon; const CurrentBeaconList: TBeaconList);
procedure Beacon1BeaconExit(const Sender: TObject; const ABeacon: IBeacon; const CurrentBeaconList: TBeaconList);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Beacon1BeaconEnter(const Sender: TObject; const ABeacon: IBeacon;
const CurrentBeaconList: TBeaconList);
begin
Memo1.Lines.Add('New Beacon');
Memo1.Lines.Add(Format( 'UUID: %s Major: %d Minor: %d',[ABeacon.GUID.ToString, ABeacon.Major, ABeacon.Minor]));
Memo1.Lines.Add('Current Beacons count :' + Length(CurrentBeaconList).toString);
end;
procedure TForm1.Beacon1BeaconExit(const Sender: TObject; const ABeacon: IBeacon; const CurrentBeaconList: TBeaconList);
begin
Memo1.Lines.Add('Beacon exited');
Memo1.Lines.Add(Format( 'UUID: %s Major: %d Minor: %d',[ABeacon.GUID.ToString, ABeacon.Major, ABeacon.Minor]));
Memo1.Lines.Add('Current Beacons count :' + Length(CurrentBeaconList).toString);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Beacon1.Enabled := True;
end;
end.发布于 2020-08-07 16:20:16
根据Embarcadero的文档(下面),蓝牙信标似乎只支持从Windows 10开始。
http://docwiki.embarcadero.com/RADStudio/Rio/en/Using_Beacons
这解释了Windows 7的情况(也发生在我身上;然后我在Windows 10上尝试了几个,发现它们可以工作,检测到信标)。不幸的是,似乎没有关于Windows最低版本的信息。
看看微软文档(下面)表中写着10.0*的版本号,也许它需要最低限度的Windows 2016。
https://learn.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version
要了解更多信息(如果可以帮助的话),我在64位Windows 10上使用Delphi10.2(东京)。
我尝试过的示例项目是“AllBeaconsScanner”。在使用64位Windows操作系统构建目标平台之后,它运行良好。
在我的机器上,示例项目的路径如下所示。C:\Users\Public\Documents\Embarcadero\Studio\19.0\Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\Bluetooth\Beacons\ExtendedBeaconScanner
https://stackoverflow.com/questions/63294227
复制相似问题