Einzelnen Beitrag anzeigen

elmar.faber

Registriert seit: 10. Sep 2007
Ort: Neustadt (Hessen)
37 Beiträge
 
Delphi 10.2 Tokyo Architect
 
#1

Bluetooth LE unter Windows 11 funktioniert nicht mehr

  Alt 13. Aug 2023, 11:41
Hallo,

bislang hat die Bluetooth LE Komponente unter Windows 10 keine Probleme gemacht. Unter Windows 11
jedoch funktioniert keines meiner Programme mit Bluetooth LE mehr.

Ich habe die Delphi Version 11.1 und die Community Version 11.3 getestet.

Verwenden tue ich ein HM-10 Bluetooth Modul mit der Firmware 5.40 und 7.09.
Wie gesagt unter Windows 10 funktioniert die Kommunikation einwandfrei.

Hier mein Code:

Delphi-Quellcode:
procedure TFrmPeltierController.BluetoothLE1EndDiscoverServices(const Sender: TObject;
  const AServiceList: TBluetoothGattServiceList);
Var
  Idx : Integer;
  cmd_Str : String;
  AService : TBluetoothGattService;
  ACharacteristic : TBluetoothGattCharacteristic;
begin
  FCurrentService := NIL;
  for AService IN AServiceList Do Begin
    DM.Protocol[1].Add(AService.UUIDName);
    If AService.UUIDName = ServiceName Then Begin
      FCurrentService := AService;
      laBluetoothStatus.BeginUpdate;
      laBluetoothStatus.Text := AService.UUIDName;
      laBluetoothStatus.EndUpdate;
      Application.ProcessMessages;
      Break;
    End;
  End;
  If Assigned(FCurrentService) Then Begin
    Try
      for ACharacteristic IN FCurrentService.Characteristics Do Begin <------ Hier hängt sich das Programm komplett auf
        DM.Protocol[2].Add(ACharacteristic.UUIDName);
        If ACharacteristic.UUIDName = CharacteristicName Then Begin
          FCurrentCharacteristic := ACharacteristic;
          laBluetoothStatus.BeginUpdate;
          laBluetoothStatus.Text := FCurrentCharacteristic.UUIDName;
          laBluetoothStatus.EndUpdate;
          If BluetoothLE1.SubscribeToCharacteristic(FCurrentDevice, FCurrentCharacteristic) Then Begin
            laBluetoothStatus.BeginUpdate;
            laBluetoothStatus.Text := 'Ready to send/receive data...';
            laBluetoothStatus.EndUpdate;
            Application.ProcessMessages;
            (*
            // <Command> | <Type of Value> | <Assignd Value> | <Value>
            cmd_Str := IntToStr(cct_Response)+'|'+IntToStr(cvt_Boolean)+'|'+
                      IntToStr(Ord(at_Response))+'|'+IntToStr(1)+'^';

            FCurrentCharacteristic.SetValueAsString(cmd_Str);
            BluetoothLE1.WriteCharacteristic(FCurrentDevice, FCurrentCharacteristic);
            *)

            SendCommand(ct_Response, vt_Boolean, at_Response, True);

            btn_Connect.Text := 'Verbunden';
            btn_Connect.Enabled := False;

            Circle1.Fill.Color := TAlphaColors.Chartreuse;
          End;
          Break;
        End;
      End;
    Except

    End;
  End;
End;

Das Demoprogramm "ExploreDevicesLE" hängt sich auch genau an diesem Punkt auf.

Kann mir hier jemand weiterhelfen?

Viele Grüße

Elmar
Elmar Faber
  Mit Zitat antworten Zitat