![pexelsphoto21279692410548 | Embarcadero RAD Studio Delphi C++Builder Blogs focus photography of sea waves](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2021/02/pexels-photo-2127969-2410548.jpeg?resize=1140%2C694&ssl=1)
Do your need to detect all the connected Bluetooth devices in your machine programmatically? How to get the Device Name, Address, Last Used, Authenticated, Connected status, etc., for each Bluetooth Devices connected? Don’t know what to do? Don’t worry. MiTec’s System Information Management Suite’s component helps to get this information with less code, and we will learn how to use TMiTeC_BT in this blog post. RAD Studio also has some built-in Bluetooth solutions.
Platforms: Windows.
Installation Steps:
You can easily install this Component Suite from GetIt Package Manager. The steps are as follows.
- Navigate In RAD Studio IDE->Tools->GetIt Package Manager->select Components in Categories->Components->Trail -MiTec system Information Component Suite 14.3 and click Install Button.
- Read the license and Click Agree All. An Information dialog saying ‘Requires a restart of RAD studio at the end of the process. Do you want to proceed? click yes and continue.
- It will download the plugin and installs it. Once installed Click Restart now.
How to run the Demo app:
- Navigate to the System Information Management Suite trails setup, Demos folder which is installed during Get It installation e.g) C:UsersDocumentsEmbarcaderoStudio21.0CatalogRepositoryMiTeC-14.3DemosDelphi11
- Open the BT project in RAD studio 10.4.1, compile and Run the application.
- This Demo App shows how to list down the Connected Bluetooth devices, enumerate among them and access its properties.
Components used in MSIC BT Demo App:
- TMiTeC_BT: Detects all connected Bluetooth devices.
- TListView for viewing the detected Bluetooth devices.
- TButton to refresh and close.
Implementation Details:
- An instance BT of TMiTeC_BT is created. Add the list of connected Bluetooth Devices is detected by loop through the DeviceCount property. Retrieves the TBTDevice for each Devices and shows the Device Name, Address, Last Used, Last Seen, Authenticated, Remembered, Connected status, etc.
- The retrieved Devices and its properties were added to list view instance lv.
- Press Refresh to list the recent detected Bluetooth devices by calling cmRefresh again. Alternatively you can use the Device monitor, to detect the device on arrival and removal. Check how to use MiTeC’s Device monitor here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
procedure TForm2.cmRefresh(Sender: TObject); var i: Integer; begin Screen.Cursor:=crHourglass; with TMiTeC_BT.Create(Self) do try lv.Items.Clear; RefreshData; for i:=0 to DeviceCount-1 do with lv.Items.Add do begin Caption:=Devices[i].Name; SubItems.Add(Devices[i].Address); SubItems.Add(DatetimeToStrDef(devices[i].LastUsed,'')); SubItems.Add(DatetimeToStrDef(devices[i].LastSeen,'')); SubItems.Add(BooleanEn[Devices[i].Authenticated]); SubItems.Add(BooleanEn[Devices[i].Remembered]); SubItems.Add(BooleanEn[Devices[i].Connected]); end; finally Free; Screen.Cursor:=crDefault; end; end; |
![BlueTooth6403520 | Embarcadero RAD Studio Delphi C++Builder Blogs bluetooth 6403520](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2021/02/BlueTooth-6403520.png?resize=750%2C407&ssl=1)
It’s that simple to list down the detected Bluetooth devices in your machine and access its properties with less code. Use this MiTeC component suite and get the job done quickly rather than spending time understanding low-level Microsoft interfaces to detect Bluetooth devices.
With the use of a Windows IDE, you can easily detect Bluetooth devices in your Windows apps with a component suite. Try your Free Trial here.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition