Platforms to show: All Mac Windows Linux Cross-Platform

Back to HIDAPIDeviceMBS class.

HIDAPIDeviceMBS.Close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Close a HID device.

HIDAPIDeviceMBS.Constructor   Private

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
The private constructor.

HIDAPIDeviceMBS.GetFeatureReport(ReportID as Integer, MaxLength as Integer) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Get a feature report from a HID device.

Set the first byte of Data to the Report ID of the report to be read. Make sure to allow space for this extra byte in data. Upon return, the first byte will still contain the Report ID, and the report data will start in data.UInt8(1).

ReportID: The report ID to read.

This function returns the number of bytes read plus one for the report ID (which is still in the first byte), or -1 on error.

Some examples using this method:

HIDAPIDeviceMBS.GetInputReport(ReportID as Integer, MaxLength as Integer) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 21.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Get a input report from a HID device.

MaxLength is how many bytes we allocate for receiving buffer.

Returns the data read, which has the report ID as first byte.

HIDAPIDeviceMBS.GetReportDescriptor as MemoryBlock   New in 24.1

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 24.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Get a report descriptor from a HID device.

Returns the data or nil in case of an error.

HIDAPIDeviceMBS.IndexedString(Index as Integer, MaxLen as Integer = 1024) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Get a string from a HID device, based on its string index.

Index: The index of the string to get.
maxlen: The maximum length for read buffer.
Returns text read.

HIDAPIDeviceMBS.Read(MaxLength as Integer) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Read an Input report from a HID device.

Input reports are returned to the host through the INTERRUPT IN endpoint. The first byte will contain the Report number if the device uses numbered reports.

MaxLength: The number of bytes to read. For devices with multiple reports, make sure to read an extra byte for the report number.

This function returns the actual number of bytes read and -1 on error. If no packet was available to be read and the handle is in non-blocking mode, this function returns 0.

HIDAPIDeviceMBS.ReadTimeOut(MaxLength as Integer, TimeoutMS as Integer) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Read an Input report from a HID device with timeout.

Input reports are returned to the host through the INTERRUPT IN endpoint. The first byte will contain the Report number if the device uses numbered reports.

MaxLength: The number of bytes to read. For devices with multiple reports, make sure to read an extra byte for the report number.

TimeoutMS: timeout in milliseconds or -1 for blocking wait.

This function returns the actual number of bytes read and -1 on error. If no packet was available to be read within the timeout period, this function returns 0.

HIDAPIDeviceMBS.SendFeatureReport(data as MemoryBlock) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Send a Feature report to the device.

Feature reports are sent over the Control endpoint as a Set_Report transfer. The first byte of Data must contain the Report ID. For devices which only support a single report, this must be set to 0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to SendFeatureReport() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to SendFeatureReport(): the Report ID (or 0, for devices which do not use numbered reports), followed by the report data (16 bytes). In this example, the length passed in would be 17.

dat:a The data to send, including the report number as the first byte.

This function returns the actual number of bytes written and -1 on error.

See also:

Some examples using this method:

HIDAPIDeviceMBS.SendFeatureReport(data as String) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Send a Feature report to the device.

Feature reports are sent over the Control endpoint as a Set_Report transfer. The first byte of Data must contain the Report ID. For devices which only support a single report, this must be set to 0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to SendFeatureReport() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to SendFeatureReport(): the Report ID (or 0, for devices which do not use numbered reports), followed by the report data (16 bytes). In this example, the length passed in would be 17.

dat:a The data to send, including the report number as the first byte.

This function returns the actual number of bytes written and -1 on error.

See also:

HIDAPIDeviceMBS.Write(data as MemoryBlock) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Write an Output report to a HID device.

The first byte of data must contain the Report ID. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to Write() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to Write(), the Report ID (or 0x0, for devices with a single report), followed by the report data (16 bytes). In this example, the length passed in would be 17.
Write() will send the data on the first OUT endpoint, if one exists. If it does not, it will send the data through the Control Endpoint (Endpoint 0).

data: The data to send, including the report number as the first byte.

This function returns the actual number of bytes written and -1 on error.
Length of data to send is data.size.

See also:

HIDAPIDeviceMBS.Write(data as String) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Write an Output report to a HID device.

The first byte of data must contain the Report ID. For devices which only support a single report, this must be set to 0x0. The remaining bytes contain the report data. Since the Report ID is mandatory, calls to Write() will always contain one more byte than the report contains. For example, if a hid report is 16 bytes long, 17 bytes must be passed to Write(), the Report ID (or 0x0, for devices with a single report), followed by the report data (16 bytes). In this example, the length passed in would be 17.
Write() will send the data on the first OUT endpoint, if one exists. If it does not, it will send the data through the Control Endpoint (Endpoint 0).

data: The data to send, including the report number as the first byte.

This function returns the actual number of bytes written and -1 on error.
Length of data to send is LenB(data).

See also:

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


The biggest plugin in space...