Use the chrome.hid API to interact with connected HID devices. This API provides access to HID operations from within the context of an app. Using this API, apps can function as drivers for hardware devices.
Errors generated by this API are reported by setting 'runtime.lastError' and executing the function's regular callback. The callback's regular parameters will be undefined in this case.
Use the chrome.hid API to interact with connected HID devices. This API provides access to HID operations from within the context of an app. Using this API, apps can function as drivers for hardware devices. Errors generated by this API are reported by setting 'runtime.lastError' and executing the function's regular callback. The callback's regular parameters will be undefined in this case. * available since Chrome 38 * https://developer.chrome.com/apps/hid
(connect device-id)
Open a connection to an HID device for communication.
|device-id| - The 'HidDeviceInfo.deviceId' of the device to open.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [connection] where:
|connection| - https://developer.chrome.com/apps/hid#property-callback-connection.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
Open a connection to an HID device for communication. |device-id| - The 'HidDeviceInfo.deviceId' of the device to open. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [connection] where: |connection| - https://developer.chrome.com/apps/hid#property-callback-connection. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/hid#method-connect.
(disconnect connection-id)
Disconnect from a device. Invoking operations on a device after calling this is safe but has no effect.
|connection-id| - The connectionId returned by 'connect'.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
Disconnect from a device. Invoking operations on a device after calling this is safe but has no effect. |connection-id| - The connectionId returned by 'connect'. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/hid#method-disconnect.
(get-devices options)
Enumerate connected HID devices.
|options| - The properties to search for on target devices.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [devices] where:
|devices| - https://developer.chrome.com/apps/hid#property-callback-devices.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
Enumerate connected HID devices. |options| - The properties to search for on target devices. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [devices] where: |devices| - https://developer.chrome.com/apps/hid#property-callback-devices. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/hid#method-getDevices.
(get-user-selected-devices)
(get-user-selected-devices options)
Presents a device picker to the user and returns 'HidDeviceInfo' objects for the devices selected. If the user cancels the picker devices will be empty. A user gesture is required for the dialog to display. Without a user gesture, the callback will run as though the user cancelled. If multiple filters are provided devices matching any filter will be displayed.
|options| - Configuration of the device picker dialog box.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [devices] where:
|devices| - https://developer.chrome.com/apps/hid#property-callback-devices.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/hid#method-getUserSelectedDevices.
Presents a device picker to the user and returns 'HidDeviceInfo' objects for the devices selected. If the user cancels the picker devices will be empty. A user gesture is required for the dialog to display. Without a user gesture, the callback will run as though the user cancelled. If multiple filters are provided devices matching any filter will be displayed. |options| - Configuration of the device picker dialog box. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [devices] where: |devices| - https://developer.chrome.com/apps/hid#property-callback-devices. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/hid#method-getUserSelectedDevices.
(receive connection-id)
Receive the next input report from the device.
|connection-id| - The connectionId returned by 'connect'.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [report-id data] where:
|report-id| - The report ID or 0 if none. |data| - The report data, the report ID prefix (if present) is removed.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
Receive the next input report from the device. |connection-id| - The connectionId returned by 'connect'. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [report-id data] where: |report-id| - The report ID or 0 if none. |data| - The report data, the report ID prefix (if present) is removed. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/hid#method-receive.
(receive-feature-report connection-id report-id)
Request a feature report from the device.
|connection-id| - The connectionId returned by 'connect'. |report-id| - The report ID, or 0 if none.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [data] where:
|data| - The report data, including a report ID prefix if one is sent by the device.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/hid#method-receiveFeatureReport.
Request a feature report from the device. |connection-id| - The connectionId returned by 'connect'. |report-id| - The report ID, or 0 if none. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [data] where: |data| - The report data, including a report ID prefix if one is sent by the device. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/hid#method-receiveFeatureReport.
(send connection-id report-id data)
Send an output report to the device.Note: Do not include a report ID prefix in data. It will be added if necessary.
|connection-id| - The connectionId returned by 'connect'. |report-id| - The report ID to use, or 0 if none. |data| - The report data.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
Send an output report to the device.Note: Do not include a report ID prefix in data. It will be added if necessary. |connection-id| - The connectionId returned by 'connect'. |report-id| - The report ID to use, or 0 if none. |data| - The report data. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/hid#method-send.
(send-feature-report connection-id report-id data)
Send a feature report to the device.Note: Do not include a report ID prefix in data. It will be added if necessary.
|connection-id| - The connectionId returned by 'connect'. |report-id| - The report ID to use, or 0 if none. |data| - The report data.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/hid#method-sendFeatureReport.
Send a feature report to the device.Note: Do not include a report ID prefix in data. It will be added if necessary. |connection-id| - The connectionId returned by 'connect'. |report-id| - The report ID to use, or 0 if none. |data| - The report data. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/hid#method-sendFeatureReport.
(tap-all-events chan)
Taps all valid non-deprecated events in chromex.app.hid namespace.
Taps all valid non-deprecated events in chromex.app.hid namespace.
(tap-on-device-added-events channel & args)
Event generated when a device is added to the system. Events are only broadcast to apps and extensions that have permission to access the device. Permission may have been granted at install time or when the user accepted an optional permission (see 'permissions.request').
Events will be put on the |channel| with signature [::on-device-added [device]] where:
|device| - https://developer.chrome.com/apps/hid#property-onDeviceAdded-device.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
Event generated when a device is added to the system. Events are only broadcast to apps and extensions that have permission to access the device. Permission may have been granted at install time or when the user accepted an optional permission (see 'permissions.request'). Events will be put on the |channel| with signature [::on-device-added [device]] where: |device| - https://developer.chrome.com/apps/hid#property-onDeviceAdded-device. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/hid#event-onDeviceAdded.
(tap-on-device-removed-events channel & args)
Event generated when a device is removed from the system. See 'onDeviceAdded' for which events are delivered.
Events will be put on the |channel| with signature [::on-device-removed [device-id]] where:
|device-id| - The deviceId property of the device passed to 'onDeviceAdded'.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/hid#event-onDeviceRemoved.
Event generated when a device is removed from the system. See 'onDeviceAdded' for which events are delivered. Events will be put on the |channel| with signature [::on-device-removed [device-id]] where: |device-id| - The deviceId property of the device passed to 'onDeviceAdded'. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/hid#event-onDeviceRemoved.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close