Documentation ¶
Index ¶
- Constants
- type Device
- func (d *Device) Call(reportId, featureIndex, functionIndex byte, data ...byte) ([]byte, error)
- func (d *Device) Close()
- func (d *Device) Features() (m map[uint16]Feature, err error)
- func (d *Device) IndexOf(featureId uint16) (feature Feature, found bool)
- func (d *Device) NotificationChan(index byte, c chan []byte)
- func (d *Device) Open() error
- func (d *Device) Version() (version byte, err error)
- type Feature
- type Hidpp1Err
- type Hidpp2Err
- type HidppErr
- type Interface
- type TypeBitfield
Constants ¶
const ( HIDpp2_Success = Hidpp2Err(0) // no error HIDpp2_ErrUnknown = Hidpp2Err(1) // unknown HIDpp2_ErrInvalidArgument = Hidpp2Err(2) // invalid argument HIDpp2_ErrOutOfRange = Hidpp2Err(3) // out of range HIDpp2_ErrHWError = Hidpp2Err(4) // hardware error HIDpp2_ErrLogitechInternal = Hidpp2Err(5) // logitech internal HIDpp2_ErrInvalidFeatureIndex = Hidpp2Err(6) // invalid feature index HIDpp2_ErrInvalidFunctionID = Hidpp2Err(7) // invalid function id HIDpp2_ErrBusy = Hidpp2Err(8) // busy HIDpp2_ErrUnsupported = Hidpp2Err(9) // unsupported )
const ( HIDpp1_Success = Hidpp1Err(0x0) // No error / undefined HIDpp1_ErrInvalidSubID = Hidpp1Err(0x1) // Invalid SubID / command HIDpp1_ErrInvalidAddress = Hidpp1Err(0x2) // Invalid address HIDpp1_ErrInvalidValue = Hidpp1Err(0x3) // Invalid value HIDpp1_ErrConnectFail = Hidpp1Err(0x4) // Connection request failed (Receiver) HIDpp1_ErrTooManyDevices = Hidpp1Err(0x5) // Too many devices connected (Receiver) HIDpp1_ErrAlreadyExists = Hidpp1Err(0x6) // Already exists (Receiver) HIDpp1_ErrBusy = Hidpp1Err(0x7) // Busy (Receiver) HIDpp1_ErrUnknownDevice = Hidpp1Err(0x8) // Unknown device (Receiver) HIDpp1_ErrResourceError = Hidpp1Err(0x9) // Resource error (Receiver) HIDpp1_ErrInvalidParamValue = Hidpp1Err(0xB) // Request parameter has unsupported value HIDpp1_ErrWrongPINCode = Hidpp1Err(0xC) // the PIN code entered on the device was wrong )
const ( ReportIDShort = 0x10 ReportIDLong = 0x11 ReportIDVeryLong = 0x12 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func New ¶
New returns Device that provides HID++ protocol
Underlying device in `d` must be open before calling, and the returned *Device should be closed after use.
func (*Device) Call ¶
Call does a single HID++ function call into the using the input report defined by `reportId` and returns the response. The call is made to function in `functionIndex` of feature in `featureIndex`.
HID++ protocol exposes arbitrary number of "features" that each provide set of functions. Feature indexes can change between devices, one can use IndexOf() to check if feature is available on a decice and which index it's located in.
func (*Device) NotificationChan ¶
NotificationChan allows setting a channel where all notifications coming from feature at specific index will be directed to.
If an index that already has an notification channel, the old channel will be closed unless it is also used as a notification channel for some other index. (i.e. it's safe to use notification channels that handle multiple indexes)
Passing nil disables notification forwarding for that index.
type Feature ¶
type Feature struct { Id uint16 Index, Version byte Type TypeBitfield }
type TypeBitfield ¶
type TypeBitfield byte
TpeBitfield contents for each bit:
0: - 1: - 2: - 3: compliance_deactivatable: A compliance feature that can be permanently deactivated. It is usually also hidden and engineering. 4: manufacturing_deactivatable: A manufacturing feature that can be permanently deactivated. It is usually also hidden and engineering. 5: engineering: A hidden feature that has been disabled for user software. Used for internal testing and manufacturing. 6: hidden: A SW hidden feature is a feature that should not be known/managed/used by end user configuration SW. The host should ignore this type of features. 7: obsolete: An obsolete feature is a feature that has been replaced by a newer one, but is advertised in order for older SWs to still be able to support the feature (in case the old SW does not knowyet the newer one).