Documentation ¶
Overview ¶
Package protocol
Package protocol ¶
Package protocol ¶
Package protocol ¶
Package protocol ¶
Package protocol ¶
Package protocol
Index ¶
- Variables
- func KeyboardEventTypeNames() []string
- func KeyboardLocationNames() []string
- func ParseMessage(data []byte) (any, error)
- func PointerEventTypeNames() []string
- func PointerTypeNames() []string
- func WeylusCommandNames() []string
- func WeylusResponseNames() []string
- func WrapMessage[T MessageOutboundContent](a T) any
- type ButtonFlags
- type CapturableList
- type Config
- type KeyData
- type KeyboardEvent
- type KeyboardEventType
- type KeyboardLocation
- type MessageInbound
- type MessageOutbound
- type MessageOutboundContent
- type PointerEvent
- type PointerEventType
- type PointerType
- type WeylusCommand
- type WeylusConfigError
- type WeylusError
- type WeylusResponse
- type WheelEvent
Constants ¶
This section is empty.
Variables ¶
var ( CodeValue = map[uint]string{}/* 201 elements not displayed */ KeyValue = map[uint]string{ gdk.KEY_Escape: "Escape", gdk.KEY_3270_Enter: "Enter", gdk.KEY_ISO_Enter: "Enter", gdk.KEY_Return: "Enter", gdk.KEY_BackSpace: "Backspace", gdk.KEY_Tab: "Tab", gdk.KEY_Caps_Lock: "CapsLock", gdk.KEY_F1: "F1", gdk.KEY_F2: "F2", gdk.KEY_F3: "F3", gdk.KEY_F4: "F4", gdk.KEY_F5: "F5", gdk.KEY_F6: "F6", gdk.KEY_F7: "F7", gdk.KEY_F8: "F8", gdk.KEY_F9: "F9", gdk.KEY_F10: "F10", gdk.KEY_F11: "F11", gdk.KEY_F12: "F12", gdk.KEY_F13: "F13", gdk.KEY_F14: "F14", gdk.KEY_F15: "F15", gdk.KEY_F16: "F16", gdk.KEY_F17: "F17", gdk.KEY_F18: "F18", gdk.KEY_F19: "F19", gdk.KEY_F20: "F20", gdk.KEY_F21: "F21", gdk.KEY_F22: "F22", gdk.KEY_F23: "F23", gdk.KEY_F24: "F24", gdk.KEY_Num_Lock: "NumLock", gdk.KEY_Scroll_Lock: "ScrollLock", gdk.KEY_KP_Enter: "Enter", gdk.KEY_Katakana: "KanaMode", gdk.KEY_3270_PrintScreen: "PrintScreen", gdk.KEY_Home: "Home", gdk.KEY_Up: "ArrowUp", gdk.KEY_Page_Up: "PageUp", gdk.KEY_Left: "ArrowLeft", gdk.KEY_Right: "ArrowRight", gdk.KEY_End: "End", gdk.KEY_Down: "ArrowDown", gdk.KEY_Page_Down: "PageDown", gdk.KEY_Insert: "Insert", gdk.KEY_Delete: "Delete", gdk.KEY_AudioMute: "VolumeMute", gdk.KEY_AudioLowerVolume: "VolumeDown", gdk.KEY_AudioRaiseVolume: "VolumeUp", gdk.KEY_Pause: "Pause", gdk.KEY_Menu: "ContextMenu", gdk.KEY_Cancel: "Cancel", gdk.KEY_Undo: "Undo", gdk.KEY_Copy: "Copy", gdk.KEY_Open: "Open", gdk.KEY_Paste: "Paste", gdk.KEY_Find: "Find", gdk.KEY_Cut: "Cut", gdk.KEY_Help: "Help", gdk.KEY_Mail: "LaunchMail", gdk.KEY_Sleep: "Sleep", gdk.KEY_Control_L: "Control", gdk.KEY_Control_R: "Control", gdk.KEY_Alt_L: "Alt", gdk.KEY_Alt_R: "Alt", gdk.KEY_Meta_L: "Meta", gdk.KEY_Meta_R: "Meta", gdk.KEY_Super_L: "Super", gdk.KEY_Super_R: "Super", gdk.KEY_Hyper_L: "Hyper", gdk.KEY_Hyper_R: "Hyper", gdk.KEY_Shift_L: "Shift", gdk.KEY_Shift_R: "Shift", gdk.KEY_Mode_switch: "AltGraph", gdk.KEY_ISO_Level3_Shift: "AltGraph", gdk.KEY_ISO_Level3_Latch: "AltGraph", gdk.KEY_ISO_Level3_Lock: "AltGraph", gdk.KEY_ISO_Level5_Shift: "AltGraph", gdk.KEY_ISO_Level5_Latch: "AltGraph", gdk.KEY_ISO_Level5_Lock: "AltGraph", } )
var ErrInvalidKeyboardEventType = fmt.Errorf("not a valid KeyboardEventType, try [%s]", strings.Join(_KeyboardEventTypeNames, ", "))
var ErrInvalidKeyboardLocation = fmt.Errorf("not a valid KeyboardLocation, try [%s]", strings.Join(_KeyboardLocationNames, ", "))
var ErrInvalidPointerEventType = fmt.Errorf("not a valid PointerEventType, try [%s]", strings.Join(_PointerEventTypeNames, ", "))
var ErrInvalidPointerType = fmt.Errorf("not a valid PointerType, try [%s]", strings.Join(_PointerTypeNames, ", "))
var ErrInvalidWeylusCommand = fmt.Errorf("not a valid WeylusCommand, try [%s]", strings.Join(_WeylusCommandNames, ", "))
var ErrInvalidWeylusResponse = fmt.Errorf("not a valid WeylusResponse, try [%s]", strings.Join(_WeylusResponseNames, ", "))
Functions ¶
func KeyboardEventTypeNames ¶
func KeyboardEventTypeNames() []string
KeyboardEventTypeNames returns a list of possible string values of KeyboardEventType.
func KeyboardLocationNames ¶
func KeyboardLocationNames() []string
KeyboardLocationNames returns a list of possible string values of KeyboardLocation.
func ParseMessage ¶
func PointerEventTypeNames ¶
func PointerEventTypeNames() []string
PointerEventTypeNames returns a list of possible string values of PointerEventType.
func PointerTypeNames ¶
func PointerTypeNames() []string
PointerTypeNames returns a list of possible string values of PointerType.
func WeylusCommandNames ¶
func WeylusCommandNames() []string
WeylusCommandNames returns a list of possible string values of WeylusCommand.
func WeylusResponseNames ¶
func WeylusResponseNames() []string
WeylusResponseNames returns a list of possible string values of WeylusResponse.
func WrapMessage ¶
func WrapMessage[T MessageOutboundContent](a T) any
Types ¶
type ButtonFlags ¶
type ButtonFlags byte
const ( // ButtonNone is a ButtonFlags of type None. ButtonNone ButtonFlags = 0 // ButtonPrimary is a ButtonFlags of type Primary. Usually the left button ButtonPrimary ButtonFlags = 1 << (iota - 1) // ButtonSecondary is a ButtonFlags of type Secondary. Usually the right button ButtonSecondary // ButtonAuxiliary is a ButtonFlags of type Auxiliary. Usually the wheel button or the middle button (if present) ButtonAuxiliary // ButtonFourth is a ButtonFlags of type Fourth. Typically the Browser Back button ButtonFourth // ButtonFifth is a ButtonFlags of type Fifth. Typically the Browser Forward button ButtonFifth // ButtonEraser is a ButtonFlags of type Eraser. ButtonEraser )
type CapturableList ¶
type CapturableList struct {
CapturableList []string `json:"CapturableList"`
}
type KeyData ¶
type KeyData struct { Name string Key string Location KeyboardLocation }
type KeyboardEvent ¶
type KeyboardEvent struct { EventType KeyboardEventType `json:"event_type"` Code string `json:"code"` Key string `json:"key"` Location KeyboardLocation `json:"location"` Alt bool `json:"alt"` Ctrl bool `json:"ctrl"` Shift bool `json:"shift"` Meta bool `json:"meta"` }
type KeyboardEventType ¶
type KeyboardEventType string
KeyboardEventType indicates what kind of event is represented. ENUM(down,up,repeat)
const ( // KeyboardEventTypeDown is a KeyboardEventType of type down. KeyboardEventTypeDown KeyboardEventType = "down" // KeyboardEventTypeUp is a KeyboardEventType of type up. KeyboardEventTypeUp KeyboardEventType = "up" // KeyboardEventTypeRepeat is a KeyboardEventType of type repeat. KeyboardEventTypeRepeat KeyboardEventType = "repeat" )
func KeyboardEventTypeValues ¶
func KeyboardEventTypeValues() []KeyboardEventType
KeyboardEventTypeValues returns a list of the values for KeyboardEventType
func ParseKeyboardEventType ¶
func ParseKeyboardEventType(name string) (KeyboardEventType, error)
ParseKeyboardEventType attempts to convert a string to a KeyboardEventType.
func (KeyboardEventType) IsValid ¶
func (x KeyboardEventType) IsValid() bool
String implements the Stringer interface.
func (KeyboardEventType) MarshalText ¶
func (x KeyboardEventType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (KeyboardEventType) String ¶
func (x KeyboardEventType) String() string
String implements the Stringer interface.
func (*KeyboardEventType) UnmarshalText ¶
func (x *KeyboardEventType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type KeyboardLocation ¶
type KeyboardLocation int
KeyboardLocation identifies which part of the keyboard the key event originates from.
ENUM( standard // The key described by the event is not identified as being located in a particular area of the keyboard. left // The key is on the left side of the keyboard. right // The key is located on the right side of the keyboard. numpad // The key is located on the numeric keypad.
)
const ( // KeyboardLocationStandard is a KeyboardLocation of type Standard. // The key described by the event is not identified as being located in a particular area of the keyboard. KeyboardLocationStandard KeyboardLocation = iota // KeyboardLocationLeft is a KeyboardLocation of type Left. // The key is on the left side of the keyboard. KeyboardLocationLeft // KeyboardLocationRight is a KeyboardLocation of type Right. // The key is located on the right side of the keyboard. KeyboardLocationRight // KeyboardLocationNumpad is a KeyboardLocation of type Numpad. // The key is located on the numeric keypad. KeyboardLocationNumpad )
func KeyboardLocationValues ¶
func KeyboardLocationValues() []KeyboardLocation
KeyboardLocationValues returns a list of the values for KeyboardLocation
func ParseKeyboardLocation ¶
func ParseKeyboardLocation(name string) (KeyboardLocation, error)
ParseKeyboardLocation attempts to convert a string to a KeyboardLocation.
func (KeyboardLocation) MarshalText ¶
func (x KeyboardLocation) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (KeyboardLocation) String ¶
func (x KeyboardLocation) String() string
String implements the Stringer interface.
func (*KeyboardLocation) UnmarshalText ¶
func (x *KeyboardLocation) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type MessageInbound ¶
type MessageInbound interface { CapturableList | ~string | WeylusError | WeylusConfigError }
type MessageOutbound ¶
type MessageOutbound interface { map[WeylusCommand]PointerEvent | map[WeylusCommand]WheelEvent | map[WeylusCommand]KeyboardEvent | map[WeylusCommand]Config | ~string }
type MessageOutboundContent ¶
type MessageOutboundContent interface { PointerEvent | WheelEvent | KeyboardEvent | Config | ~string }
type PointerEvent ¶
type PointerEvent struct { EventType PointerEventType `json:"event_type"` PointerType PointerType `json:"pointer_type"` X float64 `json:"x"` Y float64 `json:"y"` Pressure float64 `json:"pressure"` Width float64 `json:"width"` Height float64 `json:"height"` PointerID int `json:"pointer_id"` Timestamp uint64 `json:"timestamp"` MovementX int64 `json:"movement_x"` MovementY int64 `json:"movement_y"` TiltX int32 `json:"tilt_x"` TiltY int32 `json:"tilt_y"` Twist int32 `json:"twist"` Button ButtonFlags `json:"button"` Buttons ButtonFlags `json:"buttons"` IsPrimary bool `json:"is_primary"` }
type PointerEventType ¶
type PointerEventType string
PointerEventType indicates what kind of event is represented.
ENUM( down=pointerdown up=pointerup cancel=pointercancel move=pointermove )
const ( // PointerEventTypeDown is a PointerEventType of type down. PointerEventTypeDown PointerEventType = "pointerdown" // PointerEventTypeUp is a PointerEventType of type up. PointerEventTypeUp PointerEventType = "pointerup" // PointerEventTypeCancel is a PointerEventType of type cancel. PointerEventTypeCancel PointerEventType = "pointercancel" // PointerEventTypeMove is a PointerEventType of type move. PointerEventTypeMove PointerEventType = "pointermove" )
func ParsePointerEventType ¶
func ParsePointerEventType(name string) (PointerEventType, error)
ParsePointerEventType attempts to convert a string to a PointerEventType.
func PointerEventTypeValues ¶
func PointerEventTypeValues() []PointerEventType
PointerEventTypeValues returns a list of the values for PointerEventType
func (PointerEventType) IsValid ¶
func (x PointerEventType) IsValid() bool
String implements the Stringer interface.
func (PointerEventType) MarshalText ¶
func (x PointerEventType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (PointerEventType) String ¶
func (x PointerEventType) String() string
String implements the Stringer interface.
func (*PointerEventType) UnmarshalText ¶
func (x *PointerEventType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type PointerType ¶
type PointerType string
PointerType indicates what type the pointer triggering this event is.
ENUM( unknown="" mouse pen touch )
const ( // PointerTypeUnknown is a PointerType of type unknown. PointerTypeUnknown PointerType = "" // PointerTypeMouse is a PointerType of type mouse. PointerTypeMouse PointerType = "mouse" // PointerTypePen is a PointerType of type pen. PointerTypePen PointerType = "pen" // PointerTypeTouch is a PointerType of type touch. PointerTypeTouch PointerType = "touch" )
func ParsePointerType ¶
func ParsePointerType(name string) (PointerType, error)
ParsePointerType attempts to convert a string to a PointerType.
func PointerTypeValues ¶
func PointerTypeValues() []PointerType
PointerTypeValues returns a list of the values for PointerType
func (PointerType) IsValid ¶
func (x PointerType) IsValid() bool
String implements the Stringer interface.
func (PointerType) MarshalText ¶
func (x PointerType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (PointerType) String ¶
func (x PointerType) String() string
String implements the Stringer interface.
func (*PointerType) UnmarshalText ¶
func (x *PointerType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type WeylusCommand ¶
type WeylusCommand string
WeylusCommand contains the possible commands supported by weylus
ENUM( TryGetFrame GetCapturableList Config KeyboardEvent PointerEvent WheelEvent )
const ( // WeylusCommandTryGetFrame is a WeylusCommand of type TryGetFrame. WeylusCommandTryGetFrame WeylusCommand = "TryGetFrame" // WeylusCommandGetCapturableList is a WeylusCommand of type GetCapturableList. WeylusCommandGetCapturableList WeylusCommand = "GetCapturableList" // WeylusCommandConfig is a WeylusCommand of type Config. WeylusCommandConfig WeylusCommand = "Config" // WeylusCommandKeyboardEvent is a WeylusCommand of type KeyboardEvent. WeylusCommandKeyboardEvent WeylusCommand = "KeyboardEvent" // WeylusCommandPointerEvent is a WeylusCommand of type PointerEvent. WeylusCommandPointerEvent WeylusCommand = "PointerEvent" // WeylusCommandWheelEvent is a WeylusCommand of type WheelEvent. WeylusCommandWheelEvent WeylusCommand = "WheelEvent" )
func CommandFromOutboundContent ¶
func CommandFromOutboundContent[T MessageOutboundContent](content T) WeylusCommand
func ParseWeylusCommand ¶
func ParseWeylusCommand(name string) (WeylusCommand, error)
ParseWeylusCommand attempts to convert a string to a WeylusCommand.
func WeylusCommandValues ¶
func WeylusCommandValues() []WeylusCommand
WeylusCommandValues returns a list of the values for WeylusCommand
func (WeylusCommand) IsValid ¶
func (x WeylusCommand) IsValid() bool
String implements the Stringer interface.
func (WeylusCommand) MarshalText ¶
func (x WeylusCommand) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (WeylusCommand) String ¶
func (x WeylusCommand) String() string
String implements the Stringer interface.
func (*WeylusCommand) UnmarshalText ¶
func (x *WeylusCommand) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type WeylusConfigError ¶
type WeylusConfigError struct {
ErrorMessage string `json:"ConfigError"`
}
func (*WeylusConfigError) Error ¶
func (e *WeylusConfigError) Error() string
type WeylusError ¶
type WeylusError struct {
ErrorMessage string `json:"Error"`
}
func (*WeylusError) Error ¶
func (e *WeylusError) Error() string
type WeylusResponse ¶
type WeylusResponse string
WeylusResponse contains the possible commands supported by weylus
ENUM( NewVideo CapturableList ConfigOk ConfigError Error )
const ( // WeylusResponseNewVideo is a WeylusResponse of type NewVideo. WeylusResponseNewVideo WeylusResponse = "NewVideo" // WeylusResponseCapturableList is a WeylusResponse of type CapturableList. WeylusResponseCapturableList WeylusResponse = "CapturableList" // WeylusResponseConfigOk is a WeylusResponse of type ConfigOk. WeylusResponseConfigOk WeylusResponse = "ConfigOk" // WeylusResponseConfigError is a WeylusResponse of type ConfigError. WeylusResponseConfigError WeylusResponse = "ConfigError" // WeylusResponseError is a WeylusResponse of type Error. WeylusResponseError WeylusResponse = "Error" )
func ParseWeylusResponse ¶
func ParseWeylusResponse(name string) (WeylusResponse, error)
ParseWeylusResponse attempts to convert a string to a WeylusResponse.
func ResponseFromOutboundContent ¶
func ResponseFromOutboundContent[T MessageOutboundContent](content T) WeylusResponse
func WeylusResponseValues ¶
func WeylusResponseValues() []WeylusResponse
WeylusResponseValues returns a list of the values for WeylusResponse
func (WeylusResponse) IsValid ¶
func (x WeylusResponse) IsValid() bool
String implements the Stringer interface.
func (WeylusResponse) MarshalText ¶
func (x WeylusResponse) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (WeylusResponse) String ¶
func (x WeylusResponse) String() string
String implements the Stringer interface.
func (*WeylusResponse) UnmarshalText ¶
func (x *WeylusResponse) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.