Platforms to show: All Mac Windows Linux Cross-Platform
/Bluetooth/Windows Bluetooth/Windows Bluetooth
Required plugins for this example: MBS Bluetooth Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Bluetooth/Windows Bluetooth/Windows Bluetooth
This example is the version from Tue, 31th Jul 2023.
Project "Windows Bluetooth.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub ExpandRow(row As Integer)
dim v as Variant = me.RowTag(row)
if v isa WindowsBlueToothDeviceInfoMBS then
dim d as WindowsBlueToothDeviceInfoMBS = v
List.AddRow "Address", d.Address
List.AddRow "Authenticated", YesNo(d.Authenticated)
List.AddRow "ClassofDevice", str(d.ClassofDevice)
List.AddRow "Connected", YesNo(d.Connected)
List.AddRow "LastSeen", d.LastSeen.LongDate
List.AddRow "LastUsed", d.LastUsed.LongDate
List.AddRow "Name", d.Name
List.AddRow "Remembered", YesNo(d.Remembered)
end if
if v isa WindowsBlueToothRadioMBS then
dim d as WindowsBlueToothRadioMBS = v
dim i as WindowsBlueToothRadioInfoMBS = d.Info
List.AddRow "Address", i.Address
List.AddRow "Name", i.Name
List.AddRow "Manufacturer ID", str(i.manufacturer)
List.AddRow "Subversion", str(i.Subversion)
end if
End EventHandler
End Control
Control SelectButton Inherits PushButton
ControlInstance SelectButton Inherits PushButton
EventHandler Sub Action()
dim d as new WindowsBlueToothSelectDeviceDialogMBS
d.Parent = self
d.Info = "Please pick device"
d.ShowAuthenticated = true
d.ShowRemembered = true
d.ShowUnknown = true
if d.ShowDialog then
dim devices() as WindowsBlueToothDeviceInfoMBS = d.Devices
for each dev as WindowsBlueToothDeviceInfoMBS in devices
add dev
next
end if
End EventHandler
End Control
EventHandler Sub Open()
dim radios() as WindowsBlueToothRadioMBS = WindowsBlueToothRadioMBS.Radios
for each radio as WindowsBlueToothRadioMBS in radios
add Radio
next
dim SearchParameter as new WindowsBlueToothDeviceSearchParameterMBS
SearchParameter.ReturnAuthenticated = True
SearchParameter.ReturnConnected = true
SearchParameter.ReturnRemembered = true
SearchParameter.ReturnUnknown = True
dim Devices() as WindowsBlueToothDeviceInfoMBS = WindowsBlueToothDeviceInfoMBS.Devices(SearchParameter)
for each Device as WindowsBlueToothDeviceInfoMBS in Devices
add Device
next
End EventHandler
Sub Add(dev as WindowsBlueToothDeviceInfoMBS)
List.AddFolder "Device"
List.cell(List.LastIndex, 1) = dev.Name
List.RowTag(List.LastIndex) = dev
End Sub
Sub Add(dev as WindowsBlueToothRadioMBS)
List.AddFolder "Radio"
List.cell(List.LastIndex, 1) = dev.Info.Name
List.RowTag(List.LastIndex) = dev
End Sub
Shared Function YesNo(b as Boolean) As string
if b then
Return "yes"
else
return "no"
end if
End Function
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS Bluetooth Plugin.