gosqueeze

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 17, 2020 License: MIT Imports: 9 Imported by: 0

README

Gosqueeze - Squeeze Box Controller

This package is inspired by the work of Robin Bowes and his Net-UDAP Perl module. In particular the packet format was deciphered based on his work.

This module was created specifically for use in the github.com/jcrummy/sbconfig program, however it is available for use in other contexts as well.

Basics

You must specificy a network interface to use for sending broadcast messages. Note replies are listened for on all interfaces due to limitations in broadcast handling.

// Discover what devices are available on the network
sbs, _ = gosqueeze.Discover(iface)

// Get information about a specific device
sbs[0].GetIP(iface)
sbs[0].GetData(iface)

// Modify a configuration point on the device
sbs[0].Data.WirelessSSID = "NewSSID"

// Save configuration changes to the device
sbs[0].SaveData(iface)

Getting the squeeze box setup

From wiki.slimdevices.com/index.php/SBRFrontButtonAndLED.

To go to setup mode:

  1. Press and hold the button for about 3 seconds or until it blinks slow red then release it.
  2. The LED will go red solid, which means it is booting up. This will take a couple of seconds.
  3. The LED will start slowly blinking red, which means it is in setup mode.

Documentation

Overview

Package gosqueeze provides an interface to configure Logitech SqueezeBox devices over a network.

This package is inspired by the work of Robin Bowes and his Net-UDAP Perl module. In particular the packet format was deciphered based on his work.

This module was created specifically for use in the github.com/jcrummy/sbconfig program, however it is available for use in other contexts as well.

Basics

You must specificy a network interface to use for sending broadcast messages. Note replies are listened for on all interfaces due to limitations in broadcast handling.

// Discover what devices are available on the network
sbs, _ = gosqueeze.Discover(iface)

// Get information about a specific device
sbs[0].GetIP(iface)
sbs[0].GetData(iface)

// Modify a configuration point on the device
sbs[0].Data.WirelessSSID = "NewSSID"

// Save configuration changes to the device
sbs[0].SaveData(iface)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceData added in v0.0.3

type DeviceData struct {
	LanIPMode            bool   `gosqueeze:"4,1"`    // false = static IP, true = DHCP
	LanNetworkAddress    net.IP `gosqueeze:"5,4"`    // static network address
	LanSubnetMask        net.IP `gosqueeze:"9,4"`    // static subnet mask
	LanGateway           net.IP `gosqueeze:"13,4"`   // static gateway address
	Hostname             string `gosqueeze:"17,33"`  // device hostname
	Bridging             bool   `gosqueeze:"50,1"`   // true = use device as wireless bridge
	Interface            uint8  `gosqueeze:"52,1"`   // 0 = use Wireless, 1 = use Wired
	PrimaryDNS           net.IP `gosqueeze:"59,4"`   // static primary DNS address
	SecondaryDNS         net.IP `gosqueeze:"67,4"`   // static secondary DNS address
	ActiveServerAddress  net.IP `gosqueeze:"71,4"`   // IP address of currently active server (read only)
	SqueezeCenterAddress net.IP `gosqueeze:"79,4"`   // IP address of local Squeezecenter server
	SqueezeCenterName    string `gosqueeze:"83,33"`  // Name of local Squeezecenter server (read only)
	WirelessMode         uint8  `gosqueeze:"173,1"`  // 0 = infrastructure, 1 = Ad Hoc
	WirelessSSID         string `gosqueeze:"183,33"` // SSID of WiFi access point to connect to
	WirelessChannel      uint8  `gosqueeze:"216,1"`  // WiFi Channel, can normally leave at 0
	WirelessRegion       uint8  `gosqueeze:"218,1"`  // 4 = US, 6 = CA, 7 = AU, 13 = FR, 14 = EU, 16 = JP, 21 = TW, 23 = CH
	WirelessKeylen       uint8  `gosqueeze:"220,1"`  // Length of wireless key (0 = 64-bit, 1 = 128-bit)
	WirelessWEPKey0      []byte `gosqueeze:"222,13"` // WEP key 0 - in Hex
	WirelessWEPKey1      []byte `gosqueeze:"235,13"` // WEP key 1 - in Hex
	WirelessWEPKey2      []byte `gosqueeze:"248,13"` // WEP key 2 - in Hex
	WirelessWEPKey3      []byte `gosqueeze:"261,13"` // WEP key 3 - in Hex
	WirelessWEPOn        bool   `gosqueeze:"274,1"`  // 0 = Wep Off, 1 = Wep On
	WirelessWPACipher    uint8  `gosqueeze:"275,1"`  // 1 = TKIIP, 2 = AES, 3 = TKIP & AES
	WirelessWPAMode      uint8  `gosqueeze:"276,1"`  // 1 = WPA, 2 = WPA2
	WirelessWPAOn        bool   `gosqueeze:"277,1"`  // 0 = WPA Off, 1 = WPA On
	WirelessWPAPSK       string `gosqueeze:"278,64"` // WPA Public Shared Key
}

DeviceData is the configuration data of the device Tagged as offset,data length (in bytes)

type Sb

type Sb struct {
	MacAddr     net.HardwareAddr
	IPAddr      net.IP
	GatewayAddr net.IP
	SubnetMask  net.IPMask
	ID          uint
	Type        string
	Name        string
	Status      string
	HardwareRev uint
	FirmwareRev uint
	Data        DeviceData
}

Sb represents a squeezebox receiver device

func Discover

func Discover(iface *net.Interface) ([]Sb, error)

Discover returns a list of squeezebox devices found on the network

func (*Sb) GetData

func (s *Sb) GetData(iface *net.Interface) error

GetData retrieves all data points from the SqueezeBox device

func (*Sb) GetIP

func (s *Sb) GetIP(iface *net.Interface) error

GetIP retrieves IP address information from the SqueezeBox device

func (*Sb) SaveData

func (s *Sb) SaveData(iface *net.Interface) error

SaveData saves all current values to the SqueezeBox device permantently

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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