Platforms to show: All Mac Windows Linux Cross-Platform
/Bluetooth/Mac Bluetooth/Mac Bluetooth Dialogs
Required plugins for this example: MBS MacBase Plugin, MBS Bluetooth Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Bluetooth/Mac Bluetooth/Mac Bluetooth Dialogs
This example is the version from Sun, 23th Jun 2018.
Project "Mac Bluetooth Dialogs.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
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 MainWindow Inherits Window
Control ChooseDeviceButton Inherits PushButton
ControlInstance ChooseDeviceButton Inherits PushButton
EventHandler Sub Action()
DeviceSelectorController.beginSheetModalForWindow(self)
End EventHandler
End Control
Control ChooseServiceButton Inherits PushButton
ControlInstance ChooseServiceButton Inherits PushButton
EventHandler Sub Action()
ServiceBrowserController.beginSheetModalForWindow(self)
End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open()
DeviceSelectorController = new IOBluetoothDeviceSelectorController
ServiceBrowserController = new IOBluetoothServiceBrowserController(IOBluetoothServiceBrowserController.kOptionsNone)
DeviceSelectorController.list = list
ServiceBrowserController.list = list
DeviceSelectorController.Title = "Device Selector"
ServiceBrowserController.Title = "Service Browser"
End EventHandler
Property DeviceSelectorController As IOBluetoothDeviceSelectorController
Property ServiceBrowserController As IOBluetoothServiceBrowserController
End Class
Class IOBluetoothDeviceSelectorController Inherits IOBluetoothDeviceSelectorControllerMBS
EventHandler Sub SheetDone(returnCode as Integer, tag as Variant)
select case returnCode
case me.kIOBluetoothUISuccess
List.AddRow "Success"
case me.kIOBluetoothUIUserCanceledErr
List.AddRow "Cancelled"
end Select
dim devices() as IOBluetoothDeviceMBS = me.Results
for each device as IOBluetoothDeviceMBS in devices
List.AddRow device.nameOrAddress
next
End EventHandler
Property List As Listbox
End Class
Class IOBluetoothServiceBrowserController Inherits IOBluetoothServiceBrowserControllerMBS
EventHandler Sub SheetDone(returnCode as Integer, tag as Variant)
select case returnCode
case me.kIOBluetoothUISuccess
List.AddRow "Success"
case me.kIOBluetoothUIUserCanceledErr
List.AddRow "Cancelled"
end Select
dim serviceRecords() as IOBluetoothSDPServiceRecordMBS = me.Results
for each serviceRecord as IOBluetoothSDPServiceRecordMBS in serviceRecords
List.AddRow serviceRecord.ServiceName
'dim d as Dictionary = serviceRecord.Properties
'Break
next
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.