Documentation
¶
Index ¶
- Constants
- func NullBatteryHandler(client SpeedEditorInt, report input.BatteryReport)
- func NullJogHandler(client SpeedEditorInt, report input.JogReport)
- func NullKeyPressHandler(client SpeedEditorInt, report input.KeyPressReport)
- type AuthHandler
- func (ah AuthHandler) Authenticate() (time.Duration, error)
- func (ah AuthHandler) GetAuthChallengeResult() (uint16, error)
- func (ah AuthHandler) GetHostChallengeResponse() ([]byte, error)
- func (ah AuthHandler) GetKeyboardChallenge() (uint64, error)
- func (ah AuthHandler) ResetAuthState() error
- func (ah AuthHandler) SendAuthChallengeResponse(response uint64) error
- func (ah AuthHandler) SendHostChallenge() error
- type AuthHandlerInt
- type SpeedEditor
- func (se SpeedEditor) Authenticate() error
- func (se SpeedEditor) GetDeviceInfo() hid.DeviceInfo
- func (se SpeedEditor) HandleBattery(report input.BatteryReport)
- func (se SpeedEditor) HandleJog(report input.JogReport)
- func (se SpeedEditor) HandleKeyPress(report input.KeyPressReport)
- func (se SpeedEditor) HandleReport(genericReport any)
- func (se SpeedEditor) Poll()
- func (se SpeedEditor) Read() ([]byte, int, error)
- func (se *SpeedEditor) SetBatteryHandler(handler func(SpeedEditorInt, input.BatteryReport))
- func (se *SpeedEditor) SetJogHandler(handler func(SpeedEditorInt, input.JogReport))
- func (se SpeedEditor) SetJogLeds(leds []uint8) error
- func (se SpeedEditor) SetJogMode(mode uint8) error
- func (se *SpeedEditor) SetKeyPressHandler(handler func(SpeedEditorInt, input.KeyPressReport))
- func (se SpeedEditor) SetLeds(leds []uint32) error
- type SpeedEditorInt
Constants ¶
View Source
const ( VID = 0x1edb PID = 0xda0e LedReportId = 2 JogModeReportId = 3 JogLedReportId = 4 )
Variables ¶
This section is empty.
Functions ¶
func NullBatteryHandler ¶
func NullBatteryHandler(client SpeedEditorInt, report input.BatteryReport)
func NullJogHandler ¶
func NullJogHandler(client SpeedEditorInt, report input.JogReport)
func NullKeyPressHandler ¶
func NullKeyPressHandler(client SpeedEditorInt, report input.KeyPressReport)
Types ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func (AuthHandler) Authenticate ¶
func (ah AuthHandler) Authenticate() (time.Duration, error)
Authenticate handles the entire handshake between the host and the Speed Editor.
It returns the duration before the Speed Editor expects a reauth.
func (AuthHandler) GetAuthChallengeResult ¶
func (ah AuthHandler) GetAuthChallengeResult() (uint16, error)
func (AuthHandler) GetHostChallengeResponse ¶
func (ah AuthHandler) GetHostChallengeResponse() ([]byte, error)
func (AuthHandler) GetKeyboardChallenge ¶
func (ah AuthHandler) GetKeyboardChallenge() (uint64, error)
func (AuthHandler) ResetAuthState ¶
func (ah AuthHandler) ResetAuthState() error
func (AuthHandler) SendAuthChallengeResponse ¶
func (ah AuthHandler) SendAuthChallengeResponse(response uint64) error
func (AuthHandler) SendHostChallenge ¶
func (ah AuthHandler) SendHostChallenge() error
sendHostChallenge requests a challenge response from the device. Presumably this step exists to confirm it's a real Speed Editor.
type AuthHandlerInt ¶
type SpeedEditor ¶
type SpeedEditor struct {
AuthHandler AuthHandlerInt
// contains filtered or unexported fields
}
func (SpeedEditor) Authenticate ¶
func (se SpeedEditor) Authenticate() error
func (SpeedEditor) GetDeviceInfo ¶
func (se SpeedEditor) GetDeviceInfo() hid.DeviceInfo
func (SpeedEditor) HandleBattery ¶
func (se SpeedEditor) HandleBattery(report input.BatteryReport)
func (SpeedEditor) HandleJog ¶
func (se SpeedEditor) HandleJog(report input.JogReport)
func (SpeedEditor) HandleKeyPress ¶
func (se SpeedEditor) HandleKeyPress(report input.KeyPressReport)
func (SpeedEditor) HandleReport ¶
func (se SpeedEditor) HandleReport(genericReport any)
func (SpeedEditor) Poll ¶
func (se SpeedEditor) Poll()
func (*SpeedEditor) SetBatteryHandler ¶
func (se *SpeedEditor) SetBatteryHandler(handler func(SpeedEditorInt, input.BatteryReport))
func (*SpeedEditor) SetJogHandler ¶
func (se *SpeedEditor) SetJogHandler(handler func(SpeedEditorInt, input.JogReport))
func (SpeedEditor) SetJogLeds ¶
func (se SpeedEditor) SetJogLeds(leds []uint8) error
func (SpeedEditor) SetJogMode ¶
func (se SpeedEditor) SetJogMode(mode uint8) error
func (*SpeedEditor) SetKeyPressHandler ¶
func (se *SpeedEditor) SetKeyPressHandler(handler func(SpeedEditorInt, input.KeyPressReport))
func (SpeedEditor) SetLeds ¶
func (se SpeedEditor) SetLeds(leds []uint32) error
type SpeedEditorInt ¶
type SpeedEditorInt interface {
// Authenticate does the initial handshake with the Speed Editor,
// and re-auths periodically in the background when requested by the device.
Authenticate() error
// GetDeviceInfo returns the serial number, manufacturer string etc published
// by the device via HID. This info is cached on init, so we don't have to
// request it on every call.
GetDeviceInfo() hid.DeviceInfo
// Read pulls a single input report from the Speed Editor, and returns the
// data (list of keys currently held down, jog wheel position etc.) and
// the data length.
//
// The first byte indicates which report type was received.
Read() ([]byte, int, error)
// Poll starts a Read loop, parses each input report and calls Handle on each
// via the Report interface.
Poll()
// SetLeds accepts the bitmask for a list of LEDs, and binary ORs the bitmask
// to enable all LEDs in the mask.
//
// SetLeds does not keep any state, so it will reset any previously enabled
// LEDs if they aren't included in the next call.
SetLeds(leds []uint32) error
// SetJogMode switches between the 4 jog modes:
// RELATIVE - Relative position
// ABSOLUTE - Absolute position from -4096 to 4096
// RELATIVE2 - Relative position, I think this is used to enable a faster scroll mode when the SCRL button is pressed twice in Resolve: https://www.reddit.com/r/blackmagicdesign/comments/1dv56d4/speed_editor_firmware_update_dial_speed_change/
// ABSOLUTE_0 - Absolute position from -4096 to 4096 with deadzone around 0
SetJogMode(mode uint8) error
// SetJogLeds accepts the bitmask for a list of LEDs, and binary ORs the bitmask
// to enable all LEDs in the mask. Jog LEDs are on a separate system, and overlap
// with some of the normal LED IDs so we need a separate message to enable them.
//
// SetJogLeds does not keep any state, so it will reset any previously enabled
// LEDs if they aren't included in the next call.
SetJogLeds(leds []uint8) error
// SetJogHandler allows replacing the handler function that will be called on Poll()
// when a JogReport is received.
SetJogHandler(handler func(SpeedEditorInt, input.JogReport))
// SetBatteryHandler allows replacing the handler function that will be called on Poll()
// when a BatteryReport is received.
SetBatteryHandler(handler func(SpeedEditorInt, input.BatteryReport))
// SetKeyPressHandler allows replacing the handler function that will be called on Poll()
// when a KeyPressReport is received.
SetKeyPressHandler(handler func(SpeedEditorInt, input.KeyPressReport))
}
func NewClient ¶
func NewClient() (SpeedEditorInt, error)
NewClient connects to a Speed Editor via the HID library and returns a SpeedEditorInt to interact with the device.
It is recommended to manually initialise the HID library before creating the Speed Editor client, with `hid.Init()`.
Ensure to use `defer hid.Exit()` to avoid memory leaks.
Click to show internal directories.
Click to hide internal directories.