Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

MacHIDMBS.Close
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: Closes the active connection.

Feedback, Comments & Corrections

MacHIDMBS.Connect
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: Creates a connection to the current device.
Example:
Function OpenUSBDevice() As boolean
dim i as Integer
dim h as MacHIDMBS

h=FindDevice // see FindFirst example

if h=nil then
MsgBox "No XYZ device found."
Return false
end if

h.Connect

if h.Lasterror<>0 then
MsgBox "Failed to connect to USB Device."
Return false
end if

h.InstallCallback

Return true

End Function
Notes:
Lasterror is set.

Lasterror values for this function:
-1Not supported (Windows and Linux).
0Everything okay.
1Failed to get IOKit Plugin Interface for this IO object.
2Failed to query interface
3Failed to open interface
4Failed to create async port
5Failed to create async event source
6no longer used
7Failed to start queue

Feedback, Comments & Corrections

MacHIDMBS.Disconnect
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: Disconnets current USB device.
Notes: Lasterror is set.

Feedback, Comments & Corrections

MacHIDMBS.FindFirstDevice as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: Finds the first device and loads the properties.
Example:
Function FindDevice() As MyMacHIDMBS
dim h as MyMacHIDMBS
dim p as string

h=new MyMacHIDMBS // your own subclass of MacHIDMBS so you can get events

if h.FindFirstDevice then

p=h.Product
if p="MyProduct" then
Return h
end if

while h.FindNextDevice

p=h.Product
if p="MyProduct" then
Return h
end if

wend

end if
End Function
Notes: Returns true on success and false on failure.

Feedback, Comments & Corrections

MacHIDMBS.FindNextDevice as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: Finds next device.
Notes: Returns true on success and false on failure.

Feedback, Comments & Corrections

MacHIDMBS.HIDProperties as Variant
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 15.0 Yes No No Yes, macOS only No
Function: Queries HID properties dictionary.
Notes:
Value is a CFDictionaryMBS with details about current device. Returned as Variant to reduce plugin dependencies.

The plugin queries this dictionary to return SerialNumber, ProductID, Manufacturer, Product, VendorID and VersionNumber.

Feedback, Comments & Corrections

MacHIDMBS.InstallCallback
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: Installs the callback used for the event handler.
Notes:
Lasterror is set.
Please use after connect.

Feedback, Comments & Corrections

MacHIDMBS.Manufacturer as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 7.5 Yes No No Yes, macOS only No
Function: The manufacturer name.
Notes: On any error an empty string is returned.

Feedback, Comments & Corrections

MacHIDMBS.Product as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: The product string of the selected device.
Notes: Lasterror is set.

Feedback, Comments & Corrections

MacHIDMBS.ProductID as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: The product ID of the selected device.
Notes: Lasterror is set.

Feedback, Comments & Corrections

MacHIDMBS.ReadMessage(ReportID as Integer, reportType as Integer, length as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 14.0 Yes No No Yes, macOS only No
Function: Reads a message from usb device.
Notes:
This is for synchronously operation without the event/callback.
You can specify report id, report type and the maximum length to read.
Also set timeout property.

Feedback, Comments & Corrections

MacHIDMBS.ReadMessageMemory(ReportID as Integer, reportType as Integer, length as Integer) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 14.0 Yes No No Yes, macOS only No
Function: Reads a message from usb device.
Notes:
This is for synchronously operation without the event/callback.
You can specify report id, report type and the maximum length to read.
Also set timeout property.

Feedback, Comments & Corrections

MacHIDMBS.SendMessage(data as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: Sends a message to the USB device.
Notes:
A connection must be open.
Lasterror is set. Lasterror -536854447 is an USB timeout.
Uses kIOHIDReportTypeOutput.

See also:

Feedback, Comments & Corrections

MacHIDMBS.SendMessage(ReportID as Integer, reportType as Integer, data as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 8.6 Yes No No Yes, macOS only No
Function: Sends a message to the USB device.
Notes:
A connection must be open.
Lasterror is set. Lasterror -536854447 is an USB timeout.
ReportType can be kIOHIDReportTypeOutput or kIOHIDReportTypeFeature.

See also:

Feedback, Comments & Corrections

MacHIDMBS.SendMessageMemory(data as memoryblock, offset as Integer, length as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: Sends a message to the USB device.
Notes:
A connection must be open.
Lasterror is set. Lasterror -536854447 is an USB timeout.
Internally ReportID=0 is used.

While writing a crossplatform application for one specific device we saw the following thing: The data buffer for the SendMessageMemory call must be 8 bytes long on Mac (with MacHIDMBS) and 61 bytes long for Windows (with WinHIDMBS) for our HID device. We have 1 byte for the ReportID and 60 data bytes where the first 8 are set like on the Mac. So if the calls fail on Windows, try with a higher length and check the WinHIDMBS.OutputReportByteLength property.
Uses kIOHIDReportTypeOutput.

See also:

Feedback, Comments & Corrections

MacHIDMBS.SendMessageMemory(ReportID as Integer, reportType as Integer, data as memoryblock, offset as Integer, length as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 8.6 Yes No No Yes, macOS only No
Function: Sends a message to the USB device.
Notes:
A connection must be open.
Lasterror is set. Lasterror -536854447 is an USB timeout.
ReportType can be kIOHIDReportTypeOutput or kIOHIDReportTypeFeature.

See also:

Feedback, Comments & Corrections

MacHIDMBS.SerialNumber as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: The serial number of the current selected device.
Notes: Lasterror is set.

Feedback, Comments & Corrections

MacHIDMBS.VendorID as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 6.4 Yes No No Yes, macOS only No
Function: The vendor ID of the selected device.
Notes: Lasterror is set.

Feedback, Comments & Corrections

MacHIDMBS.VersionNumber as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method USB MBS USB Plugin 7.5 Yes No No Yes, macOS only No
Function: The device specific version number.
Notes:
Value can be anything.
On any error, 0 is returned.

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS USB Plugin.




Links
MBS Xojo Plugins