Platforms to show: All Mac Windows Linux Cross-Platform

/Bluetooth/Windows Bluetooth/Windows Bluetooth Services


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 Services

This example is the version from Sun, 23th Jun 2018.

Project "Windows Bluetooth Services.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 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 WindowsBlueToothDeviceMBS then dim w as WindowsBlueToothDeviceMBS = v List.AddRow "Name", w.Name List.AddRow "LocalAddress", w.LocalAddress List.AddRow "RemoteAddress", w.RemoteAddress dim Services() as WindowsBlueToothServiceMBS = w.Services for each Service as WindowsBlueToothServiceMBS in Services Add Service next end if if v isa WindowsBlueToothServiceMBS then dim w as WindowsBlueToothServiceMBS = v List.AddRow "Name", w.Name List.AddRow "Comment", w.Comment List.AddRow "RemoteAddress", w.RemoteAddress List.AddRow "Port", str(w.Port) add w.Properties end if if v isa Dictionary then dim w as Dictionary = v // sort keys dim keys() as integer for each key as Variant in w.keys keys.Append key.IntegerValue next keys.sort for each key as Variant in keys dim val as Variant = w.Value(key) dim vv as string try if val isa MemoryBlock then dim s as string = val vv = EncodeHex(s) else vv = val.StringValue end if catch r as runtimeException // ignore? end try List.AddRow key.StringValue, vv next end if End EventHandler
End Control
EventHandler Sub Open() dim Devices() as WindowsBlueToothDeviceMBS = WindowsBlueToothDeviceMBS.Devices for each Device as WindowsBlueToothDeviceMBS in Devices Add Device next End EventHandler
Sub Add(service as Dictionary) List.AddFolder "Properties" List.RowTag(List.LastIndex) = service End Sub
Sub Add(device as WindowsBlueToothDeviceMBS) List.AddFolder device.Name List.RowTag(List.LastIndex) = device list.Expanded(List.LastIndex) = true End Sub
Sub Add(service as WindowsBlueToothServiceMBS) List.AddFolder service.Name List.RowTag(List.LastIndex) = service list.Expanded(List.LastIndex) = true End Sub
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.


The biggest plugin in space...