Hello Forum,
I developed an IoT Sensor with BLE-Hardware (Nordic CPU, https://github.com/joembedded/Open-SDI12-Blue ), which works excellent and I can access it easily (and without pairing) via Web-Bluetooth API (HTML/JS) an Windows and Android.
Now, while trying the same in RAD Studio (using WIndows 11), it seems ONLY paired devices are accepted for "DiscoverServices()". This makes (especially for BLE) no sense...
I recognised a flag in the Windows Settings to "allow this for special APPs", like MS LE Explorer.
I found for the "TBluetoothLEDevice*" entry a Flag "Paired"
Does anybody know, if there is a automatic solution?
Thanky for your help!
Jo ( JoEmbedded.de )
//This is from the RAD Studio BLE-Scanner-Demo (just C, but Data is same for Delphi)
void __fastcall TTPDiscoverServices::Invoke(void){
TBluetoothLE *BLEh = FForm->BluetoothLE1;
TBluetoothLEDeviceList *DLh = BLEh->DiscoveredDevices;
TBluetoothLEDevice* BTDev= DLh->Items[FForm->ListBox1->ItemIndex];
bool bres;
if(!BTDev->Paired){
bres=false;
::MessageBox(NULL,L"Device not paired?",L"**Error**",MB_OK);
}else{
//original: if(!FForm->BluetoothLE1->DiscoveredDevices->Items[FForm->ListBox1->ItemIndex]->DiscoverServices())
bres = BTDev->DiscoverServices(); // Jo: Exception Win11 for unpaired Devices
::MessageBox(NULL,bres?L"Discover OK":L"Discover Error",L"**Discover**",MB_OK);
}
if(!bres) TThread::Synchronize(NULL, SynchronizeProc);
}