kramer

package module
v0.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const (
	BuildDate       = "BUILD-DATE"
	Model           = "MODEL"
	SerialNumber    = "SN"
	FirmwareVersion = "VERSION"
	ProtocolVersion = "PROT-VER"
	Temperature     = "HW-TEMP"
	PowerSave       = "POWER-SAVE"
	IPAddress       = "NET-IP"
	Gateway         = "NET-GATE"
	MACAddress      = "NET-MAC"
	NetDNS          = "NET-DNS"
	Signal          = "SIGNAL"
)
View Source
const (
	CARRIAGE_RETURN           = 0x0D
	LINE_FEED                 = 0x0A
	SPACE                     = 0x20
	DELAY_BETWEEN_CONNECTIONS = time.Second * 10
)
View Source
const (
	Inactive = "0"
	Active   = "1"
	Waiting  = "2"
)

User status constants

Variables

This section is empty.

Functions

func LessThanZero

func LessThanZero(numString string) bool

Returns if a given number (in a string) is less than zero.

func ToIndexOne

func ToIndexOne(numString string) (string, error)

This function converts a number (in a string) to index-based 1.

func ToIndexZero

func ToIndexZero(numString string) (string, error)

This function converts a number (in a string) to index-base 0.

Types

type ActiveSignal added in v0.1.9

type ActiveSignal struct {
	Active bool `json:"active"`
}

type CommandInfo

type CommandInfo struct {
	ResponseChannel chan Response
	Address         string
	Command         string
	ReadWelcome     bool
}

type HardwareInfo added in v0.1.9

type HardwareInfo struct {
	Hostname              string           `json:"hostname,omitempty"`
	ModelName             string           `json:"model_name,omitempty"`
	SerialNumber          string           `json:"serial_number,omitempty"`
	BuildDate             string           `json:"build_date,omitempty"`
	FirmwareVersion       string           `json:"firmware_version,omitempty"`
	ProtocolVersion       string           `json:"protocol_version,omitempty"`
	NetworkInfo           NetworkInfo      `json:"network_information,omitempty"`
	FilterStatus          string           `json:"filter_status,omitempty"`
	WarningStatus         []string         `json:"warning_status,omitempty"`
	ErrorStatus           []string         `json:"error_status,omitempty"`
	PowerStatus           string           `json:"power_status,omitempty"`
	PowerSavingModeStatus string           `json:"power_saving_mode_status,omitempty"`
	TimerInfo             []map[string]int `json:"timer_info,omitempty"`
	Temperature           string           `json:"temperature,omitempty"`
}

HardwareInfo contains the common information for device hardware information

type Kramer4x4 added in v0.1.2

type Kramer4x4 struct {
	Address string
	Log     Logger
	// contains filtered or unexported fields
}

func NewVideoSwitcher

func NewVideoSwitcher(addr string, opts ...Kramer4x4Option) *Kramer4x4

func (*Kramer4x4) GetActiveSignal added in v0.1.2

func (vs *Kramer4x4) GetActiveSignal(ctx context.Context, port string) (error, structs.ActiveSignal)

func (*Kramer4x4) GetActiveSignalByPort added in v0.1.2

func (vs *Kramer4x4) GetActiveSignalByPort(ctx context.Context, port string, readWelcome bool) (structs.ActiveSignal, error)

func (*Kramer4x4) GetAudioVideoInputs added in v0.1.12

func (vs *Kramer4x4) GetAudioVideoInputs(ctx context.Context) (map[string]string, error)

GetInput returns the current input

func (*Kramer4x4) GetHardwareInfo added in v0.1.2

func (vs *Kramer4x4) GetHardwareInfo(ctx context.Context) (structs.HardwareInfo, error)

func (*Kramer4x4) GetInfo added in v0.1.2

func (vs *Kramer4x4) GetInfo(ctx context.Context) (interface{}, error)

GetInfo .

func (*Kramer4x4) SendCommand added in v0.1.2

func (vs *Kramer4x4) SendCommand(ctx context.Context, cmd []byte) ([]byte, error)

SendCommand sends the byte array to the desired address of projector

func (*Kramer4x4) SetAudioVideoInput added in v0.1.12

func (vs *Kramer4x4) SetAudioVideoInput(ctx context.Context, output, input string) error

SwitchInput changes the input on the given output to input

func (*Kramer4x4) SetFrontLock added in v0.1.2

func (vs *Kramer4x4) SetFrontLock(ctx context.Context, state bool) error

type Kramer4x4Option added in v0.1.2

type Kramer4x4Option interface {
	// contains filtered or unexported methods
}

func WithLogger4x4 added in v0.1.13

func WithLogger4x4(l Logger) Kramer4x4Option

type Kramer4x4optionFunc added in v0.1.2

type Kramer4x4optionFunc func(*Kramer4x4options)

type Kramer4x4options added in v0.1.2

type Kramer4x4options struct {
	// contains filtered or unexported fields
}

type KramerAFM20DSP added in v0.1.2

type KramerAFM20DSP struct {
	Address string
	Log     Logger
	// contains filtered or unexported fields
}

func NewDsp added in v0.1.2

func NewDsp(addr string, opts ...KramerAFM20DSPOption) *KramerAFM20DSP

func (*KramerAFM20DSP) GetHardwareInfo added in v0.1.2

func (dsp *KramerAFM20DSP) GetHardwareInfo(ctx context.Context) (structs.HardwareInfo, error)

func (*KramerAFM20DSP) GetInfo added in v0.1.2

func (dsp *KramerAFM20DSP) GetInfo(ctx context.Context) (interface{}, error)

GetInfo .

func (*KramerAFM20DSP) Mutes added in v0.1.15

func (dsp *KramerAFM20DSP) Mutes(ctx context.Context, blocks []string) (map[string]bool, error)

GetMuted returns the Mute Status current input The blocks are going to be a number between 1-20, determined by its configuration

func (*KramerAFM20DSP) SendCommand added in v0.1.2

func (dsp *KramerAFM20DSP) SendCommand(ctx context.Context, cmd []byte) ([]byte, error)

SendCommand sends the byte array to the desired address of projector

func (*KramerAFM20DSP) SetMute added in v0.1.12

func (dsp *KramerAFM20DSP) SetMute(ctx context.Context, block string, mute bool) error

SetMuted changes the input on the given output to input The blocks are going to be a number between 1-20, determined by its configuration

func (*KramerAFM20DSP) SetVolume added in v0.1.12

func (dsp *KramerAFM20DSP) SetVolume(ctx context.Context, block string, level int) error

SetVolume changes the volume level on the given block to the level parameter The blocks are going to be a number between 1-20, determined by its configuration

func (*KramerAFM20DSP) Volumes added in v0.1.15

func (dsp *KramerAFM20DSP) Volumes(ctx context.Context, blocks []string) (map[string]int, error)

GetVolume returns the volume Level for the given input The blocks are going to be a number between 1-20, determined by its configuration

type KramerAFM20DSPOption added in v0.1.2

type KramerAFM20DSPOption interface {
	// contains filtered or unexported methods
}

TODO add specific options for each model

func WithLoggerDSP added in v0.1.13

func WithLoggerDSP(l Logger) KramerAFM20DSPOption

type KramerAFM20DSPoptionFunc added in v0.1.2

type KramerAFM20DSPoptionFunc func(*KramerAFM20DSPoptions)

type KramerAFM20DSPoptions added in v0.1.2

type KramerAFM20DSPoptions struct {
	// contains filtered or unexported fields
}

type KramerVP558 added in v0.1.2

type KramerVP558 struct {
	Address string
	Log     Logger
	// contains filtered or unexported fields
}

func NewVideoSwitcherDsp added in v0.1.2

func NewVideoSwitcherDsp(addr string, opts ...KramerVP558Option) *KramerVP558

func (*KramerVP558) GetAudioVideoInputs added in v0.1.12

func (vsdsp *KramerVP558) GetAudioVideoInputs(ctx context.Context) (map[string]string, error)

GetInput returns the current input The API is zero indexed, so outputs 0-3 correspond with outputs 1-4 on device inputs 0-10 correspond with outputs 1-11 see https://cdn.kramerav.com/web/downloads/manuals/vp-558_rev_4.pdf (page 66)

func (*KramerVP558) GetHardwareInfo added in v0.1.2

func (vsdsp *KramerVP558) GetHardwareInfo(ctx context.Context) (structs.HardwareInfo, error)

func (*KramerVP558) GetInfo added in v0.1.2

func (vsdsp *KramerVP558) GetInfo(ctx context.Context) (interface{}, error)

GetInfo .

func (*KramerVP558) Mutes added in v0.1.15

func (vsdsp *KramerVP558) Mutes(ctx context.Context, blocks []string) (map[string]bool, error)

GetMuted returns the Mute Status current input Audio inputs are formatted 0:0 - 4:2, and audio level is between 0-100. for more information on Audio Inputs reference https://cdn.kramerav.com/web/downloads/manuals/vp-558_rev_4.pdf (pg. 64)

func (*KramerVP558) SendCommand added in v0.1.2

func (vsdsp *KramerVP558) SendCommand(ctx context.Context, cmd []byte, readAgain bool) ([]byte, error)

SendCommand sends the byte array to the desired address of projector

func (*KramerVP558) SetAudioVideoInput added in v0.1.12

func (vsdsp *KramerVP558) SetAudioVideoInput(ctx context.Context, output, input string) error

SwitchInput changes the input on the given output to input outputs 1-4 on device inputs 1-11 see https://cdn.kramerav.com/web/downloads/manuals/vp-558_rev_4.pdf (page 66)

func (*KramerVP558) SetMute added in v0.1.13

func (vsdsp *KramerVP558) SetMute(ctx context.Context, block string, muted bool) error

setMuted changes the input on the given output to input Audio inputs are formatted 0:0 - 4:2, and audio level is between 0-100. for more information on Audio Inputs reference https://cdn.kramerav.com/web/downloads/manuals/vp-558_rev_4.pdf (pg. 64)

func (*KramerVP558) SetVolume added in v0.1.12

func (vsdsp *KramerVP558) SetVolume(ctx context.Context, block string, level int) error

SetVolume changes the volume level on the given block to the level parameter Audio inputs are formatted 0:0 - 4:2, and audio level is between 0-100. for more information on Audio Inputs reference https://cdn.kramerav.com/web/downloads/manuals/vp-558_rev_4.pdf (pg. 64)

func (*KramerVP558) Volumes added in v0.1.15

func (vsdsp *KramerVP558) Volumes(ctx context.Context, blocks []string) (map[string]int, error)

GetVolume returns the volume Level for the given input Audio inputs are formatted 0:0 - 4:2, and audio level is between 0-100. for more information on Audio Inputs reference https://cdn.kramerav.com/web/downloads/manuals/vp-558_rev_4.pdf (pg. 64)

type KramerVP558Option added in v0.1.2

type KramerVP558Option interface {
	// contains filtered or unexported methods
}

func WithLoggerVSDSP added in v0.1.13

func WithLoggerVSDSP(l Logger) KramerVP558Option

type KramerVP558optionFunc added in v0.1.2

type KramerVP558optionFunc func(*KramerVP558options)

type KramerVP558options added in v0.1.2

type KramerVP558options struct {
	// contains filtered or unexported fields
}

type Logger

type Logger interface {
	Debugf(format string, a ...interface{})
	Infof(format string, a ...interface{})
	Warnf(format string, a ...interface{})
	Errorf(format string, a ...interface{})
}

type Message added in v0.1.9

type Message struct {
	EventType string
	Action    string
	User      string
	State     string
}

type NetworkInfo added in v0.1.9

type NetworkInfo struct {
	IPAddress  string   `json:"ip_address,omitempty"`
	MACAddress string   `json:"mac_address,omitempty"`
	Gateway    string   `json:"gateway,omitempty"`
	DNS        []string `json:"dns,omitempty"`
}

NetworkInfo contains the network information for the device

type PersistentViaConnection added in v0.1.9

type PersistentViaConnection struct {
	Conn   net.Conn
	Reader *bufio.Reader
}

type Response

type Response struct {
	Response string
	Err      error
}

type VIAUsers added in v0.1.9

type VIAUsers struct {
	InactiveUsers []string `json:"inactive_users"`
	ActiveUsers   []string `json:"active_users"`
	UsersWaiting  []string `json:"users_waiting"`
}

VIAUsers contains the counts of the users logged in to the VIA and their status

type Via added in v0.1.9

type Via struct {
	Address  string
	Username string
	Password string
	Logger   Logger
}

VIA Struct that defines general parameters needed for any VIA

func (*Via) Debugf added in v0.1.9

func (v *Via) Debugf(format string, a ...interface{})

func (*Via) Errorf added in v0.1.9

func (v *Via) Errorf(format string, a ...interface{})

func (*Via) GetActiveSignal added in v0.1.9

func (v *Via) GetActiveSignal(ctx context.Context) (ActiveSignal, error)

GetActiveSignal determines the active signal of the VIA by getting the user count

func (*Via) GetHardwareInfo added in v0.1.9

func (v *Via) GetHardwareInfo(ctx context.Context) (HardwareInfo, error)

GetHardwareInfo for a VIA device

func (*Via) GetInfo added in v0.1.9

func (v *Via) GetInfo(ctx context.Context) (interface{}, error)

GetInfo: needed by the DSP drivers implementation. Will get hardware information

func (*Via) GetPresenterCount added in v0.1.9

func (v *Via) GetPresenterCount(ctx context.Context) (int, error)

GetPresenterCount .

func (*Via) GetRoomCode added in v0.1.9

func (v *Via) GetRoomCode(ctx context.Context) (string, error)

Get the Room Code and return the current room code as a string

func (*Via) GetStatusOfUsers added in v0.1.9

func (v *Via) GetStatusOfUsers(ctx context.Context) (VIAUsers, error)

getStatusOfUsers returns the status of users that are logged in to the VIA

func (*Via) GetVolume added in v0.1.9

func (v *Via) GetVolume(ctx context.Context) (int, error)

func (*Via) Infof added in v0.1.9

func (v *Via) Infof(format string, a ...interface{})

func (*Via) PersistConnection added in v0.1.9

func (v *Via) PersistConnection(ctx context.Context) (*PersistentViaConnection, error)

Create a persistent connection in order to catch actions and events that are printed out on console. This includes login, logoff, media presentation, and sharing events

func (*Via) Ping added in v0.1.9

func (v *Via) Ping(conn *PersistentViaConnection) error

Implementing ping functionality here for via-control Do I really need to gather the output of this considering I am using this to just keep the connection alive -- you decide!

func (*Via) Reboot added in v0.1.9

func (v *Via) Reboot(ctx context.Context) error

Reboot: Reboot a VIA using the API

func (*Via) Reset added in v0.1.9

func (v *Via) Reset(ctx context.Context) error

Reset: Reset a VIA sessions - Causes VIAAdmin to log out and log back in which can help with some lock up issues.

func (*Via) RoomCode added in v0.1.9

func (v *Via) RoomCode(ctx context.Context) (string, error)

Get the Room Code and return the current room code as a string

func (*Via) SetAlert added in v0.1.9

func (v *Via) SetAlert(ctx context.Context, AlertMessage string) error

SetAlert - Send an alert popup on the screen of the VIA

func (*Via) SetViaVolume added in v0.1.15

func (v *Via) SetViaVolume(ctx context.Context, volume int) (string, error)

Set the Volume for a VIA

func (*Via) SetVolume added in v0.1.9

func (v *Via) SetVolume(ctx context.Context, block string, volume int) error

SetVolume: Connect and set the volume on the VIA

func (*Via) Volumes added in v0.1.15

func (v *Via) Volumes(ctx context.Context, block []string) (map[string]int, error)

These functions fulfill the DSP driver requirements GetVolumes: opening a connection with the VIAs and then return the volume for the device

func (*Via) Warnf added in v0.1.9

func (v *Via) Warnf(format string, a ...interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL