llun / soundtouch-golang

Bose Soundtouch API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang Soundtouch API

Base on Nodejs version

Sample

package main

import (
  "log"

  "github.com/llun/soundtouch-golang"
)

func main() {
  speakerCh := make(chan *soundtouch.Speaker, 1)
  soundtouch.Lookup(speakerCh)
  speaker := <-speakerCh

  websocketCh, err := speaker.Listen()
  if err != nil {
    log.Fatal(err)
  }

  data, err := speaker.Volume()
  if err != nil {
    log.Fatal(err)
  }
  log.Printf("%v\n", data)
  log.Printf("%s\n", data.Raw)

  speaker.SetVolume(40)
  log.Printf("Set volume to 40")

  for message := range websocketCh {
    log.Printf(message)
  }
}

License

MIT

About

Bose Soundtouch API


Languages

Language:Go 100.0%