|
Registriert seit: 29. Mär 2008 Ort: D-49626 381 Beiträge Delphi 11 Alexandria |
#9
... ich bin jetzt minimal weiter gekommen ...
Hier mal 2 Proceduren die ich zum testen nutze:
Delphi-Quellcode:
procedure TBT.Check_Devs_WinAPI();
var i, ii : integer; RadioHandle, DeviceHandle : THandle; FindHandle : HBLUETOOTH_RADIO_FIND; BtFrp : TBlueToothFindRadioParams; RadioInfo : BLUETOOTH_RADIO_INFO; DeviceInfo : BLUETOOTH_DEVICE_INFO; DeviceSearchParams : BLUETOOTH_DEVICE_SEARCH_PARAMS; numServices : DWORD; GUIDList : array[0..31] of TGUID; begin Log('Check_Devs', '===== ... by WinAPI / Jedi ====='); BtFrp.dwSize := SizeOf(BtFrp); DeviceInfo.dwSize := SizeOf(DeviceInfo); RadioInfo.dwSize := SizeOf(RadioInfo); FindHandle := BluetoothFindFirstRadio(@BtFrp, RadioHandle); if (FindHandle = 0) then begin LOG('Check_Devs', ' --- NO BT-RADIO FOUND'); exit; end; repeat BluetoothEnableDiscovery(RadioHandle, True); with DeviceSearchParams do begin dwSize := SizeOf(DeviceSearchParams); fReturnAuthenticated := false; fReturnRemembered := true; fReturnUnknown := true; // false; fReturnConnected := false; fIssueInquiry := false; hRadio := RadioHandle; end; DeviceHandle := BluetoothFindFirstDevice(DeviceSearchParams, DeviceInfo); if DeviceHandle = 0 then continue; repeat if BluetoothGetDeviceInfo(RadioHandle, DeviceInfo) = ERROR_SUCCESS then begin BluetoothUpdateDeviceRecord(DeviceInfo); LOG('Check_Devs', ' -> ' + DeviceInfo.szName + ' | ' + 'CON: ' + booltostr(DeviceInfo.fConnected, true) + ' | ' + 'REM: ' + booltostr(DeviceInfo.fRemembered, true) + ' | ' + 'AUTH: ' + booltostr(DeviceInfo.fAuthenticated, true)); numServices := 32; if (BluetoothEnumerateInstalledServices(RadioHandle, @DeviceInfo, numServices, @GUIDList) = ERROR_SUCCESS) then begin LOG('Check_Devs', 'Num. GUIDs: ' + inttostr(numServices)); for i := 1 to numServices do begin LOG('Check_Devs', GUIDtoString(GUIDList[i-1])); if IsEqualGUID(GUIDList[i-1], GUID_SerialPort) then begin LOG('Check_Devs', '... HAS SERIAL-PORT !'); end; end; end; end; until not BluetoothFindNextDevice(DeviceHandle, DeviceInfo); BluetoothFindDeviceClose(DeviceHandle) until not (BluetoothFindNextRadio(FindHandle, RadioHandle)); BluetoothFindRadioClose(FindHandle); end;
Delphi-Quellcode:
Der Auszug aus dem LOG sieht dann so aus:
procedure TBT.Check_Devs_SysBTH();
var i, ii : integer; Device : TBluetoothDevice; SrvList : TBluetoothServiceList; Srv : TBluetoothService; begin Log('Check_Devs', '===== ... by System.Bluetooth ====='); FPairedDevices := FManager.GetPairedDevices; for i := 1 to FPairedDevices.Count do begin Device := FPairedDevices[i - 1]; Log('Check_Devs', '-> ' + Device.DeviceName + ' | State: ' + inttostr(ord(Device.State))); Application.ProcessMessages; inttostr(ord(Device.State)); SrvList := Device.GetServices; LOG('Check_Devs', 'Num. GUIDs: ' + inttostr(SrvList.Count)); for ii := 1 to SrvList.Count do begin Srv := SrvList[ii - 1]; LOG('Check_Devs', GUIDtoString(Srv.UUID)); if IsEqualGUID(Srv.UUID, GUID_SerialPort) then begin LOG('Check_Devs', '... HAS SERIAL-PORT !'); end; end; end; end; ![]() [19:32:50:059] [BT - Check_Devs]: ===== ... by WinAPI / Jedi =====
[19:32:50:074] [BT - Check_Devs]: -> OBDII | CON: False | REM: True | AUTH: True [19:32:50:074] [BT - Check_Devs]: Num. GUIDs: 2 [19:32:50:074] [BT - Check_Devs]: {00001101-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: ... HAS SERIAL-PORT ! [19:32:50:074] [BT - Check_Devs]: {0000110E-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: -> OBDII | CON: False | REM: True | AUTH: True [19:32:50:074] [BT - Check_Devs]: Num. GUIDs: 2 [19:32:50:074] [BT - Check_Devs]: {00001101-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: ... HAS SERIAL-PORT ! [19:32:50:074] [BT - Check_Devs]: {00001200-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: -> Galaxy J7 | CON: False | REM: True | AUTH: True [19:32:50:074] [BT - Check_Devs]: Num. GUIDs: 12 [19:32:50:074] [BT - Check_Devs]: {00001105-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {0000110A-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {0000110C-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {0000110E-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {00001112-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {00001115-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {00001116-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {0000111F-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {0000112F-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {00001132-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {00001800-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {00001801-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: -> EP650 | CON: True | REM: True | AUTH: True [19:32:50:074] [BT - Check_Devs]: Num. GUIDs: 4 [19:32:50:074] [BT - Check_Devs]: {0000110B-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {0000110C-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {0000110E-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: {0000111E-0000-1000-8000-00805F9B34FB} [19:32:50:074] [BT - Check_Devs]: ===== ... by System.Bluetooth ===== [19:32:50:074] [BT - Check_Devs]: -> OBDII | State: 1 [19:32:55:255] [BT - Check_Devs]: Num. GUIDs: 0 [19:32:55:255] [BT - Check_Devs]: -> OBDII | State: 1 [19:33:00:396] [BT - Check_Devs]: Num. GUIDs: 0 [19:33:00:396] [BT - Check_Devs]: -> Galaxy J7 | State: 1 [19:33:01:230] [BT - Check_Devs]: Num. GUIDs: 12 [19:33:01:230] [BT - Check_Devs]: {00001801-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {00001800-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {00001112-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {0000111F-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {0000110C-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {0000110A-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {0000110E-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {00001116-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {00001115-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {0000112F-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {00001132-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: {00001105-0000-1000-8000-00805F9B34FB} [19:33:01:230] [BT - Check_Devs]: -> EP650 | State: 2 [19:33:03:068] [BT - Check_Devs]: Num. GUIDs: 5 [19:33:03:068] [BT - Check_Devs]: {0000111E-0000-1000-8000-00805F9B34FB} [19:33:03:068] [BT - Check_Devs]: {00001108-0000-1000-8000-00805F9B34FB} [19:33:03:068] [BT - Check_Devs]: {0000110B-0000-1000-8000-00805F9B34FB} [19:33:03:068] [BT - Check_Devs]: {0000110E-0000-1000-8000-00805F9B34FB} [19:33:03:068] [BT - Check_Devs]: {0000110C-0000-1000-8000-00805F9B34FB} "Galaxy J7" ist mein Handy - BT ist EIN, aber anscheinend nicht connected --- ABER ANSCHEINEND LESBAR IN REICHWEITE !. "EP650" ist mein BT-Kopfhörer - ist EIN und anscheinend connected (er spielt den Sound vom Schleppi) Alle Geräte sind ge-PAIRED ! Man beachte die Zeiten im LOG ! - via WinAPI ist das i.d.R: < 20 ms fertig,es wird alles (bekannte) gelistet. - via System.Bluetooth braucht's: -- ca. 1 Sek. um die GUIDs zu lesen / anzuzeigen (WENN GERÄT IN RECHWEITE UND "ON") -- ca. 5 Sek. zum Timeout, wenn Gerät aus / nicht erreichbar - ES WERDEN KEINE GUIDs ANGEZEIGT ! So weit so gut ..... als KRÜCKE sicherlich nutzbar & hilfreich ! Aber das kann doch kein "Industrie-Standard" sein ??? Oder haben die Schergen um Billy Boy Gates da wieder (immer noch) was vergessen ? Mein FAZIT bisher: Da kann ich auch genau so gut für die ermittelten Ser-COMs für BT aus der REGISTRY "mal eben schnell" ein "OPEN" versuchen. .... das dauert auch jeweils ca. 5 Sekunden. D.h.: Kein Zeitvorteil, aber mehr Aufwand mit dem Blauzahn. Geändert von TERWI (29. Mär 2023 um 19:04 Uhr) |
![]() |
Ansicht |
![]() |
![]() |
![]() |
ForumregelnEs 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
|
|
Nützliche Links |
Heutige Beiträge |
Sitemap |
Suchen |
Code-Library |
Wer ist online |
Alle Foren als gelesen markieren |
Gehe zu... |
LinkBack |
![]() |
![]() |