Documentation ¶
Index ¶
- type Client
- func (c *Client) AlarmCreate(ctx context.Context, a api.Alarm) (id int, err error)
- func (c *Client) AlarmDelete(ctx context.Context, a api.Alarm) error
- func (c *Client) AlarmState(ctx context.Context) (on bool, err error)
- func (c *Client) Alarms(ctx context.Context) ([]api.Alarm, error)
- func (c *Client) Close() error
- func (c *Client) Equalizer(ctx context.Context, eq ...EqualizerSetting) error
- func (c *Client) EqualizerInfo(ctx context.Context) (*api.EqualizerInfo, error)
- func (c *Client) Function(ctx context.Context, f api.Function) error
- func (c *Client) FunctionInfo(ctx context.Context) (*api.FunctionInfo, error)
- func (c *Client) Mute(ctx context.Context, on bool) error
- func (c *Client) NetworkInfo(ctx context.Context) (*api.NetworkInfo, error)
- func (c *Client) NightMode(ctx context.Context, on bool) error
- func (c *Client) OnBroadcast(fn func(message string, data []byte))
- func (c *Client) PlayInfo(ctx context.Context) (*api.PlayInfo, error)
- func (c *Client) ProductInfo(ctx context.Context, now time.Time, setTime bool) (*api.ProductInfo, error)
- func (c *Client) Send(ctx context.Context, req Request, reply interface{}, opts ...SendOption) error
- func (c *Client) SetName(ctx context.Context, name string) error
- func (c *Client) Settings(ctx context.Context) (*api.Settings, error)
- func (c *Client) SleepAfter(ctx context.Context, minutes int) error
- func (c *Client) SystemVersion(ctx context.Context) (*api.SystemVersion, error)
- func (c *Client) TestTone(ctx context.Context) error
- func (c *Client) Volume(ctx context.Context, volume, fadetime int) error
- func (c *Client) WooferLevel(ctx context.Context, level int) error
- type DialOption
- type EqualizerSetting
- type Logger
- type Request
- type Response
- type SendOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Music Flow Player client.
func NewClient ¶
func NewClient(conn io.ReadWriteCloser) *Client
NewClient returns a new Music Flow Player client that uses the provided connection. Use Dial for more options.
func (*Client) AlarmCreate ¶
AlarmCreate creates a new alarm.
func (*Client) AlarmDelete ¶
AlarmDelete deletes the alarm.
func (*Client) AlarmState ¶
AlarmState returns true if an alarm is active right now.
func (*Client) Equalizer ¶
func (c *Client) Equalizer(ctx context.Context, eq ...EqualizerSetting) error
Equalizer sets the provided equalizer settings.
func (*Client) EqualizerInfo ¶
EqualizerInfo returns information on what's playing.
func (*Client) FunctionInfo ¶
FunctionInfo sets the provided equalizer settings.
func (*Client) NetworkInfo ¶
NetworkInfo returns the network information.
WARNING: Returns WiFi password in plain text.
func (*Client) OnBroadcast ¶
OnBroadcast sets the handler for broadcasted messages.
func (*Client) ProductInfo ¶
func (c *Client) ProductInfo(ctx context.Context, now time.Time, setTime bool) (*api.ProductInfo, error)
ProductInfo returns the product info and optionally sets the time on the soundbar.
func (*Client) Send ¶
func (c *Client) Send(ctx context.Context, req Request, reply interface{}, opts ...SendOption) error
Send a request to the Music Flow device.
func (*Client) SleepAfter ¶
SleepAfter sets the sleep timer. Set -1 to disable.
func (*Client) SystemVersion ¶
SystemVersion returns the system version information.
type DialOption ¶
type DialOption func(*dialOptions)
A DialOption sets custom options for Dial.
func WithGoodspeakerOption ¶
func WithGoodspeakerOption(opt ...goodspeaker.Option) DialOption
WithGoodspeakerOption sets the option(s) passed to the goodspeaker package.
func WithLogger ¶
func WithLogger(log Logger) DialOption
type EqualizerSetting ¶
EqualizerSetting represents an equalizer setting.
func RestoreEqualizerSettings ¶
func RestoreEqualizerSettings() EqualizerSetting
RestoreEqualizerSettings restores the previously saved equalizer settings.
func SaveEqualizerSettings ¶
func SaveEqualizerSettings() EqualizerSetting
SaveEqualizerSettings saves the current equalizer settings as default.
func SetEqualizer ¶
func SetEqualizer(value api.Equalizer) EqualizerSetting
SetEqualizer sets the equalizer.
func SetLeftRightBalance ¶
func SetLeftRightBalance(value int) EqualizerSetting
SetLeftRightBalance sets the left right balance.
type Request ¶
type Request struct { Data interface{} `json:"data,omitempty"` Message string `json:"msg"` }
Request to the speaker.
type Response ¶
type Response struct { Data json.RawMessage `json:"data,omitempty"` Message string `json:"msg"` Result string `json:"result,omitempty"` }
Response from the speaker.
type SendOption ¶
type SendOption func(*sendOptions)
func WaitFor ¶
func WaitFor(message string, result string) SendOption
WaitFor allows Send to wait for a different response message than the request. Result is usually be "OK", or empty for events. If the response result differs from this value, Send will return an error.
Directories ¶
Path | Synopsis |
---|---|
Package api contains the types and request/reply/event payloads associated with the JSON protocol used by Music Flow Player apps.
|
Package api contains the types and request/reply/event payloads associated with the JSON protocol used by Music Flow Player apps. |
cmd
|
|