Liking cljdoc? Tell your friends :D

chromex.app.usb

clj

Use the chrome.usb API to interact with connected USB devices. This API provides access to USB 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.usb API to interact with connected USB
devices. This API provides access to USB 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 33
  * https://developer.chrome.com/apps/usb
raw docstring

api-tableclj

source

bulk-transferclj/smacro

(bulk-transfer handle transfer-info)

Performs a bulk transfer on the specified device.

|handle| - An open connection to the device. |transfer-info| - The transfer parameters.

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 [info] where:

|info| - https://developer.chrome.com/apps/usb#property-callback-info.

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/usb#method-bulkTransfer.

Performs a bulk transfer on the specified device.

  |handle| - An open connection to the device.
  |transfer-info| - The transfer parameters.

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 [info] where:

  |info| - https://developer.chrome.com/apps/usb#property-callback-info.

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/usb#method-bulkTransfer.
sourceraw docstring

bulk-transfer*cljs

(bulk-transfer* config handle transfer-info)
source

claim-interfaceclj/smacro

(claim-interface handle interface-number)

Claims an interface on a USB device. Before data can be transfered to an interface or associated endpoints the interface must be claimed. Only one connection handle can claim an interface at any given time. If the interface is already claimed, this call will fail.'releaseInterface' should be called when the interface is no longer needed.

|handle| - An open connection to the device. |interface-number| - The interface to be claimed.

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/usb#method-claimInterface.

Claims an interface on a USB device. Before data can be transfered to an interface or associated endpoints the interface
must be claimed. Only one connection handle can claim an interface at any given time. If the interface is already claimed,
this call will fail.'releaseInterface' should be called when the interface is no longer needed.

  |handle| - An open connection to the device.
  |interface-number| - The interface to be claimed.

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/usb#method-claimInterface.
sourceraw docstring

claim-interface*cljs

(claim-interface* config handle interface-number)
source

close-deviceclj/smacro

(close-device handle)

Closes a connection handle. Invoking operations on a handle after it has been closed is a safe operation but causes no action to be taken.

|handle| - The 'ConnectionHandle' to close.

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/usb#method-closeDevice.

Closes a connection handle. Invoking operations on a handle after it has been closed is a safe operation but causes no
action to be taken.

  |handle| - The 'ConnectionHandle' to close.

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/usb#method-closeDevice.
sourceraw docstring

close-device*cljs

(close-device* config handle)
source

control-transferclj/smacro

(control-transfer handle transfer-info)

Performs a control transfer on the specified device.Control transfers refer to either the device, an interface or an endpoint. Transfers to an interface or endpoint require the interface to be claimed.

|handle| - An open connection to the device. |transfer-info| - https://developer.chrome.com/apps/usb#property-controlTransfer-transferInfo.

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 [info] where:

|info| - https://developer.chrome.com/apps/usb#property-callback-info.

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/usb#method-controlTransfer.

Performs a control transfer on the specified device.Control transfers refer to either the device, an interface or an
endpoint. Transfers to an interface or endpoint require the interface to be claimed.

  |handle| - An open connection to the device.
  |transfer-info| - https://developer.chrome.com/apps/usb#property-controlTransfer-transferInfo.

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 [info] where:

  |info| - https://developer.chrome.com/apps/usb#property-callback-info.

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/usb#method-controlTransfer.
sourceraw docstring

control-transfer*cljs

(control-transfer* config handle transfer-info)
source

find-devicesclj/smacro

(find-devices options)

Finds USB devices specified by the vendor, product and (optionally) interface IDs and if permissions allow opens them for use.If the access request is rejected or the device fails to be opened a connection handle will not be created or returned.Calling this method is equivalent to calling 'getDevices' followed by 'openDevice' for each device.

|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 [handles] where:

|handles| - https://developer.chrome.com/apps/usb#property-callback-handles.

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/usb#method-findDevices.

Finds USB devices specified by the vendor, product and (optionally) interface IDs and if permissions allow opens them for
use.If the access request is rejected or the device fails to be opened a connection handle will not be created or
returned.Calling this method is equivalent to calling 'getDevices' followed by 'openDevice' for each device.

  |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 [handles] where:

  |handles| - https://developer.chrome.com/apps/usb#property-callback-handles.

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/usb#method-findDevices.
sourceraw docstring

find-devices*cljs

(find-devices* config options)
source

gen-callclj

source

gen-wrapclj/smacro

(gen-wrap kind item-id config & args)
source

get-configurationclj/smacro

(get-configuration handle)

Gets the configuration descriptor for the currently selected configuration.

|handle| - An open connection to the device.

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 [config] where:

|config| - https://developer.chrome.com/apps/usb#property-callback-config.

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/usb#method-getConfiguration.

Gets the configuration descriptor for the currently selected configuration.

  |handle| - An open connection to the device.

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 [config] where:

  |config| - https://developer.chrome.com/apps/usb#property-callback-config.

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/usb#method-getConfiguration.
sourceraw docstring

get-configuration*cljs

(get-configuration* config handle)
source

get-configurationsclj/smacro

(get-configurations device)

Returns the full set of device configuration descriptors.

|device| - The 'Device' to fetch descriptors from.

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 [configs] where:

|configs| - https://developer.chrome.com/apps/usb#property-callback-configs.

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/usb#method-getConfigurations.

Returns the full set of device configuration descriptors.

  |device| - The 'Device' to fetch descriptors from.

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 [configs] where:

  |configs| - https://developer.chrome.com/apps/usb#property-callback-configs.

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/usb#method-getConfigurations.
sourceraw docstring

get-configurations*cljs

(get-configurations* config device)
source

get-devicesclj/smacro

(get-devices options)

Enumerates connected USB 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/usb#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/usb#method-getDevices.

Enumerates connected USB 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/usb#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/usb#method-getDevices.
sourceraw docstring

get-devices*cljs

(get-devices* config options)
source

get-user-selected-devicesclj/smacro

(get-user-selected-devices options)

Presents a device picker to the user and returns the 'Device's 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.

|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/usb#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/usb#method-getUserSelectedDevices.

Presents a device picker to the user and returns the 'Device's 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.

  |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/usb#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/usb#method-getUserSelectedDevices.
sourceraw docstring

get-user-selected-devices*cljs

(get-user-selected-devices* config options)
source

interrupt-transferclj/smacro

(interrupt-transfer handle transfer-info)

Performs an interrupt transfer on the specified device.

|handle| - An open connection to the device. |transfer-info| - The transfer parameters.

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 [info] where:

|info| - https://developer.chrome.com/apps/usb#property-callback-info.

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/usb#method-interruptTransfer.

Performs an interrupt transfer on the specified device.

  |handle| - An open connection to the device.
  |transfer-info| - The transfer parameters.

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 [info] where:

  |info| - https://developer.chrome.com/apps/usb#property-callback-info.

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/usb#method-interruptTransfer.
sourceraw docstring

interrupt-transfer*cljs

(interrupt-transfer* config handle transfer-info)
source

isochronous-transferclj/smacro

(isochronous-transfer handle transfer-info)

Performs an isochronous transfer on the specific device.

|handle| - An open connection to the device. |transfer-info| - https://developer.chrome.com/apps/usb#property-isochronousTransfer-transferInfo.

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 [info] where:

|info| - https://developer.chrome.com/apps/usb#property-callback-info.

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/usb#method-isochronousTransfer.

Performs an isochronous transfer on the specific device.

  |handle| - An open connection to the device.
  |transfer-info| - https://developer.chrome.com/apps/usb#property-isochronousTransfer-transferInfo.

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 [info] where:

  |info| - https://developer.chrome.com/apps/usb#property-callback-info.

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/usb#method-isochronousTransfer.
sourceraw docstring

isochronous-transfer*cljs

(isochronous-transfer* config handle transfer-info)
source

list-interfacesclj/smacro

(list-interfaces handle)

Lists all interfaces on a USB device.

|handle| - An open connection to the device.

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 [descriptors] where:

|descriptors| - https://developer.chrome.com/apps/usb#property-callback-descriptors.

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/usb#method-listInterfaces.

Lists all interfaces on a USB device.

  |handle| - An open connection to the device.

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 [descriptors] where:

  |descriptors| - https://developer.chrome.com/apps/usb#property-callback-descriptors.

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/usb#method-listInterfaces.
sourceraw docstring

list-interfaces*cljs

(list-interfaces* config handle)
source

on-device-added*cljs

(on-device-added* config channel & args)
source

on-device-removed*cljs

(on-device-removed* config channel & args)
source

open-deviceclj/smacro

(open-device device)

Opens a USB device returned by 'getDevices'.

|device| - 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 [handle] where:

|handle| - https://developer.chrome.com/apps/usb#property-callback-handle.

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/usb#method-openDevice.

Opens a USB device returned by 'getDevices'.

  |device| - 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 [handle] where:

  |handle| - https://developer.chrome.com/apps/usb#property-callback-handle.

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/usb#method-openDevice.
sourceraw docstring

open-device*cljs

(open-device* config device)
source

release-interfaceclj/smacro

(release-interface handle interface-number)

Releases a claimed interface.

|handle| - An open connection to the device. |interface-number| - The interface to be released.

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/usb#method-releaseInterface.

Releases a claimed interface.

  |handle| - An open connection to the device.
  |interface-number| - The interface to be released.

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/usb#method-releaseInterface.
sourceraw docstring

release-interface*cljs

(release-interface* config handle interface-number)
source

request-accessclj/smacro

(request-access device interface-id)

Requests access from the permission broker to a device claimed by Chrome OS if the given interface on the device is not claimed.

|device| - The 'Device' to request access to. |interface-id| - The particular interface requested.

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 [success] where:

|success| - https://developer.chrome.com/apps/usb#property-callback-success.

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/usb#method-requestAccess.

Requests access from the permission broker to a device claimed by Chrome OS if the given interface on the device is not
claimed.

  |device| - The 'Device' to request access to.
  |interface-id| - The particular interface requested.

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 [success] where:

  |success| - https://developer.chrome.com/apps/usb#property-callback-success.

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/usb#method-requestAccess.
sourceraw docstring

request-access*cljs

(request-access* config device interface-id)
source

reset-deviceclj/smacro

(reset-device handle)

Tries to reset the USB device. If the reset fails, the given connection handle will be closed and the USB device will appear to be disconnected then reconnected. In this case 'getDevices' or 'findDevices' must be called again to acquire the device.

|handle| - A connection handle to reset.

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 [success] where:

|success| - https://developer.chrome.com/apps/usb#property-callback-success.

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/usb#method-resetDevice.

Tries to reset the USB device. If the reset fails, the given connection handle will be closed and the  USB device will
appear to be disconnected then reconnected.  In this case 'getDevices' or 'findDevices' must be called again to acquire the
device.

  |handle| - A connection handle to reset.

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 [success] where:

  |success| - https://developer.chrome.com/apps/usb#property-callback-success.

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/usb#method-resetDevice.
sourceraw docstring

reset-device*cljs

(reset-device* config handle)
source

set-configurationclj/smacro

(set-configuration handle configuration-value)

Select a device configuration.This function effectively resets the device by selecting one of the device's available configurations. Only configuration values greater than 0 are valid however some buggy devices have a working configuration 0 and so this value is allowed.

|handle| - An open connection to the device. |configuration-value| - https://developer.chrome.com/apps/usb#property-setConfiguration-configurationValue.

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/usb#method-setConfiguration.

Select a device configuration.This function effectively resets the device by selecting one of the device's available
configurations. Only configuration values greater than 0 are valid however some buggy devices have a working configuration
0 and so this value is allowed.

  |handle| - An open connection to the device.
  |configuration-value| - https://developer.chrome.com/apps/usb#property-setConfiguration-configurationValue.

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/usb#method-setConfiguration.
sourceraw docstring

set-configuration*cljs

(set-configuration* config handle configuration-value)
source

set-interface-alternate-settingclj/smacro

(set-interface-alternate-setting handle interface-number alternate-setting)

Selects an alternate setting on a previously claimed interface.

|handle| - An open connection to the device where this interface has been claimed. |interface-number| - The interface to configure. |alternate-setting| - The alternate setting to configure.

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/usb#method-setInterfaceAlternateSetting.

Selects an alternate setting on a previously claimed interface.

  |handle| - An open connection to the device where this interface has been     claimed.
  |interface-number| - The interface to configure.
  |alternate-setting| - The alternate setting to configure.

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/usb#method-setInterfaceAlternateSetting.
sourceraw docstring

set-interface-alternate-setting*cljs

(set-interface-alternate-setting* config
                                  handle
                                  interface-number
                                  alternate-setting)
source

tap-all-eventsclj/smacro

(tap-all-events chan)

Taps all valid non-deprecated events in chromex.app.usb namespace.

Taps all valid non-deprecated events in chromex.app.usb namespace.
sourceraw docstring

tap-on-device-added-eventsclj/smacro

(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, when the user accepted an optional permission (see 'permissions.request'), or through 'getUserSelectedDevices'.

Events will be put on the |channel| with signature [::on-device-added [device]] where:

|device| - https://developer.chrome.com/apps/usb#property-onDeviceAdded-device.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/apps/usb#event-onDeviceAdded.

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, when the user accepted an optional permission (see
'permissions.request'), or through 'getUserSelectedDevices'.

Events will be put on the |channel| with signature [::on-device-added [device]] where:

  |device| - https://developer.chrome.com/apps/usb#property-onDeviceAdded-device.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/apps/usb#event-onDeviceAdded.
sourceraw docstring

tap-on-device-removed-eventsclj/smacro

(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]] where:

|device| - https://developer.chrome.com/apps/usb#property-onDeviceRemoved-device.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/apps/usb#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]] where:

  |device| - https://developer.chrome.com/apps/usb#property-onDeviceRemoved-device.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/apps/usb#event-onDeviceRemoved.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close