TBluetoothLE 控件 TBluetoothLE.FManager: TBluetoothLEManager; class constructor TBluetoothLEManager.Create; begin FBluetoothManagerClass := TPlatformBluetoothLEManager; end; FManager: TBluetoothLEManager; FManager.StartDiscovery(10000); BluetoothLE1.CurrentManager. () 有3个例子,没有用控件,用的是创建的方式 Bluetooth\Beacons\BLE_BeaconScanner Bluetooth\ExploreDevicesLE Bluetooth\ProximityClientServer FBLEManager: TBluetoothLEManager; procedure TfrmProximityForm.FormShow(Sender: TObject); begin FBLEManager := TBluetoothLEManager.Current; FBLEManager.OnDiscoveryEnd := DoDiscoveryEndEvent; FCurrentPosition := poUnknown; DoScan; end; procedure TInternalBluetoothLEManager.CreateTimer(Interval: Integer); var LInterval: NSTimeInterval; begin if (Interval > 0) then begin FTimer := TInternalTimer.Create; try LInterval := Interval/1000; FTimer.SetNotifyEvent(OnDiscoveryTimeout); FTimer.FTimer := TNSTimer.Wrap(TNSTimer.OCClass.scheduledTimerWithTimeInterval(LInterval, FTimer.GetObjectID, sel_getUid('timerEvent'), FTimer.GetObjectID, False)); // Do not translate finally {user is retained (twice, because it's target), by the timer and } {released (twice) on timer invalidation} NSObject(FTimer.Super).release; end; end; end;