HIDProto:
Filter:
Classes | External Control > HID

HIDProto : Object

Prototype HID device to match with HIDFunc

Description

Human input devices can be used as controllers for making music. This class can be used in conjunction with HIDFunc or HIDdef to match incoming messages with a particular HID device.

HIDProto has all the variables that specify an HID device. The more of these variables you specify, the more need to be matched when filtering the incoming HID data.

Class Methods

HIDProto.new

Create a new instance of HIDProto.

HIDProto.newType(uName, pName)

Create a new instance of HIDProto based on usage and usagePage of the device.

Arguments:

uName

Name of the usage id

pName

Name of the usage page id

Returns:

an HIDProto

HIDProto.newProduct(pName, vName)

Create a new instance of HIDProto based on the product information.

Arguments:

pName

The product name to match.

vName

The vendor name to match.

Returns:

an HIDProto

HIDProto.newFromDict(dict)

Create a new instance of HIDProto based on an IdentityDictionary with a set of parameters to match.

Arguments:

dict

An IdentityDictionary with a set of parameters to match. The keys in the dictionary should be one of the instance variables of HIDProto.

Returns:

an HIDProto

Inherited class methods

Instance Methods

Instance variables that can be used to match a device

.id

.id = value

The device id that should be matched. This is dependent on the order of opening HID devices.

.productName

.productName = value

The product name to match (see also HIDInfo).

.vendorName

.vendorName = value

The vendor name to match (see also HIDInfo).

.productID

.productID = value

The product id to match (see also HIDInfo).

.vendorID

.vendorID = value

The vendor id to match (see also HIDInfo).

.interfaceNumber

.interfaceNumber = value

The interface number to match (see also HIDInfo).

.releaseNumber

.releaseNumber = value

The release number to match (see also HIDInfo).

.serialNumber

.serialNumber = value

The serial number to match (see also HIDInfo).

.path

.path = value

The path to match (see also HIDInfo).

.usage

.usage = value

The usage ID of the device to match (see also HIDInfo).

.usagePage

.usagePage = value

The usage page ID of the device to match (see also HIDInfo).

.usageName

.usageName = value

The usage name of the device to match (see also HIDInfo).

.pageName

.pageName = value

The page name of the device to match (see also HIDInfo).

Methods to match

.matches(hid)

Match the argument with the template.

Arguments:

hid

An instance of HID.

Returns:

a Boolean indicating whether the incoming HID matches the template

.shouldMatch

The variables that should be matched when filtering

Returns:

a Set with variable names.

Methods to add matching parameters

.addTypeMatch(uName, pName)

Add a match for usage name and usage page name of the device.

Arguments:

uName

The usage name to match

pName

The page name to match

.addProductMatch(pName, vName)

Add a match for product name and vendor name of the device.

Arguments:

pName

The product name to match

vName

The vendor name to match

.addDictionaryMatch(dict)

Add an IdentityDictionary with a set of parameters to match. The keys in the dictionary should be one of the instance variables of HIDProto.

Arguments:

dict

An IdentityDictionary with a set of parameters to match.

Inherited instance methods

Examples