AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Windows 11 und Bluetooth LE

Ein Thema von Graw · begonnen am 12. Mär 2024 · letzter Beitrag vom 22. Mär 2024
 
philipp.hofmann

Registriert seit: 21. Mär 2012
Ort: Hannover
942 Beiträge
 
Delphi 10.4 Sydney
 
#6

AW: Windows 11 und Bluetooth LE

  Alt 15. Mär 2024, 12:31
Ja, beim Klick auf "Get services" hängt es sich nicht auf. Aber es kann gut sein, dass du einen Thread um die Funktion ServicesDiscovered bauen musst. Dies scheint mir in dem Beispiel falsch zu sein.

Probiere mal diese Anpassung:
Delphi-Quellcode:
procedure TFrDeviceExplorer.ServicesDiscovered(const Sender: TObject; const AServiceList: TBluetoothGattServiceList);
begin
  TThread.CreateAnonymousThread(
  procedure()
  var
  I: Integer;
  CharList: TBluetoothGattCharacteristicList;
  AChar: TBluetoothGattCharacteristic;
  J: Integer;
  CurrentRow: Integer;
  Options: string;
  ServiceItem, Characteristic, CharProps: TTreeViewItem;
  begin
    TvCharacteristics.Clear;
    for I := 0 to AServiceList.Count - 1 do
    begin
      ServiceItem := TTreeViewItem.Create(nil);
      ServiceItem.Parent := TvCharacteristics;
      ServiceItem.Tag := I;
      ServiceItem.IsExpanded := True;
      if AServiceList[I].UUIDName.IsEmpty then
        ServiceItem.Text := 'Unnamed'
      else
        ServiceItem.Text := AServiceList[I].UUIDName;
      CharList := AServiceList[I].Characteristics;
      for J := 0 to CharList.Count - 1 do
      begin
        AChar := CharList[J];
        TThread.Synchronize(nil, procedure begin
          Options := '';
          if TBluetoothProperty.Broadcast in AChar.Properties then Options := Options + 'Broadcast ';
          if TBluetoothProperty.ExtendedProps in AChar.Properties then Options := Options + 'ExtendedProps ';
          if TBluetoothProperty.Notify in AChar.Properties then Options := Options + 'Notify ';
          if TBluetoothProperty.Indicate in AChar.Properties then Options := Options + 'Indicate ';
          if TBluetoothProperty.Read in AChar.Properties then Options := Options + 'Read ';
          if TBluetoothProperty.Write in AChar.Properties then Options := Options + 'Write ';
          if TBluetoothProperty.WriteNoResponse in AChar.Properties then Options := Options + 'WriteNoResponse ';
          if TBluetoothProperty.SignedWrite in AChar.Properties then Options := Options + 'SignedWrite ';
          Characteristic := TTreeViewItem.Create(nil);
          Characteristic.Parent := ServiceItem;
          Characteristic.IsExpanded := False;
          if AChar.UUIDName.IsEmpty then
            Characteristic.Text := 'Unnamed'
          else
            Characteristic.Text := AChar.UUIDName;
          Characteristic.Tag := J;
          CharProps := TTreeViewItem.Create(nil);
          CharProps.Tag := -1;
          CharProps.Parent := Characteristic;
          CharProps.IsExpanded := True;
          CharProps.Text := GUIDToString(AChar.UUID);
          CharProps := TTreeViewItem.Create(nil);
          CharProps.Tag := -1;
          CharProps.Parent := Characteristic;
          CharProps.IsExpanded := True;
          CharProps.Text := Options;
        end);
        Application.ProcessMessages;
      end;
    end;
    tmAnimateFindServices.Enabled := False;
    PbServices.Value := 100;
  end).Start;
end;
D.h. übertragen auf das Beispiel müsste es
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:42 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-2025 by Thomas Breitkreuz