Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   BluetoothLe unter DElphi 12 CE (https://www.delphipraxis.net/216548-bluetoothle-unter-delphi-12-ce.html)

MomoNoWhere 16. Jan 2025 08:40

BluetoothLe unter DElphi 12 CE
 
Ich habe ein Problem, weiss aber nicht, ob es hier richtig ist:

Ich habe Delphi 12 CE. Seit dem geht das BluetoothLe nicht mehr. Das Programm bleibt immer bei BluetoothLEEndDiscoverServices hängen und geht nicht mehr weiter.

Zitat:

const
xServiceUuid: TGuid = '{0000180F-0000-1000-8000-00805F9B34FB}';
xBatteryUuid: TGuid = '{00001001-0000-1000-8000-00805F9B34FB}';
xTemperaturUuid: TGuid = '{00001002-0000-1000-8000-00805F9B34FB}';
xFallUuid: TGuid = '{00001003-0000-1000-8000-00805F9B34FB}';
xEpilepsyUuid: TGuid = '{00001004-0000-1000-8000-00805F9B34FB}';
xInstheightUuid: TGuid = '{00001005-0000-1000-8000-00805F9B34FB}';
xSensitivityUuid: TGuid = '{00001006-0000-1000-8000-00805F9B34FB}';
xThresholdUuid: TGuid = '{00001007-0000-1000-8000-00805F9B34FB}';
xDistanceUuid: TGuid = '{00001008-0000-1000-8000-00805F9B34FB}';
xBreathrateUuid: TGuid = '{00001009-0000-1000-8000-00805F9B34FB}';
xHeartrateUuid: TGuid = '{00001010-0000-1000-8000-00805F9B34FB}';

var
FormMain: TFormMain;

implementation

{$R *.fmx}

procedure TFormMain.BluetoothLECharacteristicRead(const Sender: TObject;
const ACharacteristic: TBluetoothGattCharacteristic;
AGattStatus: TBluetoothGattStatus);
var s: String;
begin
s:= ACharacteristic.GetValueAsString();
showmessage(s);
end;

procedure TFormMain.BluetoothLEDiscoverLEDevice(const Sender: TObject;
const ADevice: TBluetoothLEDevice; Rssi: Integer;
const ScanResponse: TScanResponse);
var aService: TBluetoothGattService;
aCharacteristic: TBluetoothGattCharacteristic;
begin
if ADevice.DeviceName.StartsWith('FS') then begin
aDevice.DiscoverServices;


end;
end;

procedure TFormMain.BluetoothLEEndDiscoverServices(const Sender: TObject;
const AServiceList: TBluetoothGattServiceList);
var aService: TBluetoothGattService;
aCharacteristic: TBluetoothGattCharacteristic;
begin
for aService in aservicelist do begin
aService.Characteristics;
aService.GetCharacteristic(xBatteryUuid);
end;
end;
Kann mir Jemand helfen?

L.G.
Axel

TurboMagic 18. Jan 2025 10:09

AW: BluetoothLe unter DElphi 12 CE
 
Was macht denn die Schleife da eigentlich genau?
Soll die alle Characteristics abfragen und dann einen spezifischen davon rauspicken?
Würde letzteres nicht hinter die Schleife gehören?

MomoNoWhere 18. Jan 2025 15:36

AW: BluetoothLe unter DElphi 12 CE
 
Welche Schleife?

1. unter "BluetoothLEDiscoverLEDevice"
werden die Services des Devices abgerufen, dort bleibt das Programm stehen

2. unter "BluetoothLEEndDiscoverServices"
sollen dann die Characteristics abgerufen werden, wird aber nicht erreicht

3. unter "BluetoothLECharacteristicRead"
sollen die Characteristics des jeweiligen Services gelesen werden, wird aber erst recht nicht erreicht

TurboMagic 18. Jan 2025 18:22

AW: BluetoothLe unter DElphi 12 CE
 
Ah! Sorry! Hab' mich in deinem Code verlesen.
Tipp: wenn du statt eines Zertifikates den Delphi-Helm im Forum anklickst und den Code dann dort rein schreibst
wird er vernünftig als Delphi Code formatiert angezeigt.

Das hilft uns und dir. :-)

philipp.hofmann 20. Jan 2025 19:03

AW: BluetoothLe unter DElphi 12 CE
 
Du musst dies in einem Thread ausführen, dann blockiert es nicht.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:07 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz