kefw2

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Models = map[string]string{
		"lsxii":  "KEF LSX II",
		"ls502w": "KEF LS50 II Wireless",
		"ls60w":  "KEF LS60 Wireless",
		"LS60W":  "KEF LS60 Wireless",
	}
)

Functions

func JSONIntValue

func JSONIntValue(data []byte, err error) (value int, err2 error)

func JSONStringValue

func JSONStringValue(data []byte, err error) (value string, err2 error)

func JSONStringValueByKey

func JSONStringValueByKey(data []byte, key string, err error) (value string, err2 error)

func JSONUnmarshalValue

func JSONUnmarshalValue(data []byte, err error) (value any, err2 error)

Types

type CableMode

type CableMode string
const (
	Wired    CableMode = "wired"
	Wireless CableMode = "wireless"
)

func (*CableMode) String

func (s *CableMode) String() string

String returns the string representation of the source

type EQProfileV2

type EQProfileV2 struct {
	AudioPolarity      string  `json:"audioPolarity"`
	Balance            int     `json:"balance"`
	BassExtension      string  `json:"bassExtension"` // less, standard, more
	DeskMode           bool    `json:"deskMode"`
	DeskModeSetting    int     `json:"deskModeSetting"`
	HighPassMode       bool    `json:"highPassMode"`
	HighPassModeFreq   int     `json:"highPassModeFreq"`
	IsExpertMode       bool    `json:"isExpertMode"`
	IsKW1              bool    `json:"isKW1"`
	PhaseCorrection    bool    `json:"phaseCorrection"`
	ProfileId          string  `json:"profileId"`
	ProfileName        string  `json:"profileName"`
	SubEnableStereo    bool    `json:"subEnableStereo"`
	SubOutLPFreq       float32 `json:"subOutLPFreq"`
	SubwooferCount     int     `json:"subwooferCount"` // 0, 1, 2
	SubwooferGain      int     `json:"subwooferGain"`
	SubwooferOut       bool    `json:"subwooferOut"`
	SubwooferOutHotfix bool    `json:"subwooferOutHotfix"`
	SubwooferPolarity  string  `json:"subwooferPolarity"`
	SubwooferPreset    string  `json:"subwooferPreset"`
	TrebleAmount       float32 `json:"trebleAmount"`
	WallMode           bool    `json:"wallMode"`
	WallModeSetting    float32 `json:"wallModeSetting"`
}

func (EQProfileV2) String

func (e EQProfileV2) String() string

String dumps a json EQProfileV2

type KEFGrouping added in v0.0.2

type KEFGrouping struct {
	GroupingMembers []KEFGroupingmember `json:"groupingMember"`
}

type KEFGroupingData added in v0.0.2

type KEFGroupingData struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type KEFGroupingmember added in v0.0.2

type KEFGroupingmember struct {
	Master   KEFGroupingData `json:"master`
	Follower KEFGroupingData `json:"folloer"`
}

type KEFPostRequest

type KEFPostRequest struct {
	Path  string           `json:"path"`
	Roles string           `json:"roles"`
	Value *json.RawMessage `json:"value"`
}

type KEFSpeaker

type KEFSpeaker struct {
	IPAddress       string `mapstructure:"ip_address" json:"ip_address" yaml:"ip_address"`
	Name            string `mapstructure:"name" json:"name" yaml:"name"`
	Model           string `mapstructure:"model" json:"model" yaml:"model"`
	FirmwareVersion string `mapstructure:"firmware_version" json:"firmware_version" yaml:"firmware_version"`
	MacAddress      string `mapstructure:"mac_address" json:"mac_address" yaml:"mac_address"`
	Id              string `mapstructure:"id" json:"id" yaml:"id"`
	MaxVolume       int    `mapstructure:"max_volume" json:"max_volume" yaml:"max_volume"`
}

func DiscoverSpeakers

func DiscoverSpeakers(timeout int) ([]KEFSpeaker, error)

func NewSpeaker

func NewSpeaker(IPAddress string) (KEFSpeaker, error)

func (*KEFSpeaker) CanControlPlayback added in v0.0.2

func (s *KEFSpeaker) CanControlPlayback() (bool, error)

func (*KEFSpeaker) GetEQProfileV2

func (s *KEFSpeaker) GetEQProfileV2() (EQProfileV2, error)

GetEQProfileV2 returns the current EQProfileV2 for the speaker EQ Profiles are connected to the selected source

func (*KEFSpeaker) GetMaxVolume

func (s *KEFSpeaker) GetMaxVolume() (int, error)

func (KEFSpeaker) GetVolume

func (s KEFSpeaker) GetVolume() (volume int, err error)

func (KEFSpeaker) IsMuted

func (s KEFSpeaker) IsMuted() (bool, error)

func (*KEFSpeaker) IsPlaying

func (s *KEFSpeaker) IsPlaying() (bool, error)

func (*KEFSpeaker) IsPoweredOn

func (s *KEFSpeaker) IsPoweredOn() (bool, error)

func (KEFSpeaker) Mute

func (s KEFSpeaker) Mute() error

func (*KEFSpeaker) NetworkOperationMode

func (s *KEFSpeaker) NetworkOperationMode() (CableMode, error)

func (*KEFSpeaker) NextTrack

func (s *KEFSpeaker) NextTrack() error

NextTrack works only if the speaker is playing in wifi mode

func (KEFSpeaker) PlayPause

func (s KEFSpeaker) PlayPause() error

func (*KEFSpeaker) PlayerData

func (s *KEFSpeaker) PlayerData() (PlayerData, error)

func (KEFSpeaker) PowerOff

func (s KEFSpeaker) PowerOff() error

PowerOff set the speaker to standby mode

func (*KEFSpeaker) PreviousTrack

func (s *KEFSpeaker) PreviousTrack() error

PreviousTrack works only if the speaker is playing in wifi mode

func (*KEFSpeaker) SetMaxVolume

func (s *KEFSpeaker) SetMaxVolume(maxVolume int) error

func (KEFSpeaker) SetSource

func (s KEFSpeaker) SetSource(source Source) error

func (KEFSpeaker) SetVolume

func (s KEFSpeaker) SetVolume(volume int) error

func (*KEFSpeaker) SongProgress

func (s *KEFSpeaker) SongProgress() (string, error)

PlayerData returns the current song progress as a string: "minutes:seconds"

func (*KEFSpeaker) SongProgressMS

func (s *KEFSpeaker) SongProgressMS() (int, error)

SongProgressMS returns the current song progress in milliseconds

func (*KEFSpeaker) Source

func (s *KEFSpeaker) Source() (Source, error)

func (*KEFSpeaker) SpeakerState

func (s *KEFSpeaker) SpeakerState() (SpeakerStatus, error)

func (KEFSpeaker) Unmute

func (s KEFSpeaker) Unmute() error

func (*KEFSpeaker) UpdateInfo

func (s *KEFSpeaker) UpdateInfo() (err error)

type PlayerControls

type PlayerControls struct {
	Previous bool `json:"previous"`
	Pause    bool `json:"pause"`
	Next     bool `json:"next_"`
}

type PlayerData

type PlayerData struct {
	State      string           `json:"state"`
	Status     PlayerResource   `json:"status"`
	TrackRoles PlayerTrackRoles `json:"trackRoles"`
	Controls   PlayerControls   `json:"controls"`
	MediaRoles PlayerMediaRoles `json:"mediaRoles"`
	PlayID     PlayerPlayID     `json:"playId"`
}

type PlayerMediaData

type PlayerMediaData struct {
	ActiveResource PlayerResource   `json:"activeResource"`
	MetaData       PlayerMetaData   `json:"metaData"`
	Resources      []PlayerResource `json:"resources"`
}

type PlayerMediaRoles

type PlayerMediaRoles struct {
	AudioType  string                   `json:"audioType"`
	DoNotTrack bool                     `json:"doNotTrack"`
	Type       string                   `json:"type"`
	MediaData  PlayerMediaRolesMetaData `json:"mediaData"`
	Title      string                   `json:"title"`
}

type PlayerMediaRolesMedieDataMetaData

type PlayerMediaRolesMedieDataMetaData struct {
	ServiceID     string `json:"serviceId"`
	Live          bool   `json:"live"`
	PlayLogicPath string `json:"playLogicPath"`
}

type PlayerMediaRolesMetaData

type PlayerMediaRolesMetaData struct {
	MetaData  PlayerMediaRolesMedieDataMetaData `json:"metaData"`
	Resources []PlayerMimeResource              `json:"resources"`
}

type PlayerMetaData

type PlayerMetaData struct {
	Artist string `json:"artist"`
	Album  string `json:"album"`
}

type PlayerMimeResource

type PlayerMimeResource struct {
	MimeType string `json:"mimeType"`
	URI      string `json:"uri"`
}

type PlayerPlayID

type PlayerPlayID struct {
	TimeStamp      int    `json:"timestamp"`
	SystemMemberId string `json:"systemMemberId"`
}

type PlayerResource

type PlayerResource struct {
	Duration int `json:"duration"`
}

func (PlayerResource) String

func (p PlayerResource) String() string

String returns the duration in minutes:seconds format instead of milliseconds

type PlayerTrackRoles

type PlayerTrackRoles struct {
	Icon      string          `json:"icon"`
	MediaData PlayerMediaData `json:"mediaData"`
	Title     string          `json:"title"`
}

type Source

type Source string

Source represents the source of the audio signal (kefPhysicalSource)

const (
	SourceAux       Source = "analog"
	SourceBluetooth Source = "bluetooth"
	SourceCoaxial   Source = "coaxial"
	SourceOptical   Source = "optical"
	SourceStandby   Source = "standby"
	SourceTV        Source = "tv"
	SourceUSB       Source = "usb"
	SourceWiFi      Source = "wifi"
)

func (*Source) String

func (s *Source) String() string

String returns the string representation of the source

type SpeakerStatus

type SpeakerStatus string
const (
	SpeakerStatusStandby     SpeakerStatus = "standby"
	SpeakerStatusOn          SpeakerStatus = "powerOn"
	SpeakerInNetworkSetup    SpeakerStatus = "networkSetup"
	SpeakerInFirmwareUpgrade SpeakerStatus = "firmwareUpgrade"
)

func (*SpeakerStatus) String

func (s *SpeakerStatus) String() string

String returns the string representation of the speaker status

Jump to

Keyboard shortcuts

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