Platforms to show: All Mac Windows Linux Cross-Platform
/Bluetooth/Mac Bluetooth/Mac Bluetooth Devices
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/Mac Bluetooth/Mac Bluetooth Devices
This example is the version from Tue, 24th Sep 2018.
Project "Mac Bluetooth Devices.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
End Control
Control StartButton Inherits PushButton
ControlInstance StartButton Inherits PushButton
EventHandler Sub Action()
Start
End EventHandler
End Control
Control StopButton Inherits PushButton
ControlInstance StopButton Inherits PushButton
EventHandler Sub Action()
stop
End EventHandler
End Control
Control Wheel Inherits ProgressWheel
ControlInstance Wheel Inherits ProgressWheel
End Control
EventHandler Sub Open()
Inquiry = new IOBluetoothDeviceInquiry
Inquiry.list = list
End EventHandler
Sub Completed()
StartButton.Enabled = true
StopButton.Enabled = false
Wheel.Visible = false
End Sub
Sub Start()
Inquiry.Start
StartButton.Enabled = false
StopButton.Enabled = true
End Sub
Sub Started()
Wheel.Visible = true
End Sub
Sub Stop()
Inquiry.stop
End Sub
Property Inquiry As IOBluetoothDeviceInquiry
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
Class IOBluetoothDeviceInquiry Inherits IOBluetoothDeviceInquiryMBS
EventHandler Sub Complete(error as Integer, aborted as Boolean)
mainWindow.Completed
End EventHandler
EventHandler Sub DeviceFound(device as IOBluetoothDeviceMBS)
dim f as string
dim p as string
if device.isPaired then
p = "✔︎"
end if
if device.isFavorite then
f = "✔︎"
end if
list.AddRow device.name, device.addressString, f, p
End EventHandler
EventHandler Sub Started()
MainWindow.Started
End EventHandler
Property list As listbox
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Bluetooth Plugin.