diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-04-18 22:17:10 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-04-18 22:17:10 (GMT) |
commit | b9975f025a7dd3ba4fcfde03be9176618ef9aa5b (patch) | |
tree | d08171f8769dfef530e5a07ba5ee06f2a2127dca | |
parent | 3e407753f61cba0431312511998f31972caaa744 (diff) |
improved audio switch port config
-rw-r--r-- | sample-config.toml | 8 | ||||
-rw-r--r-- | src/rhctl/audio_switch_command.go | 4 | ||||
-rw-r--r-- | src/rhctl/conf.go | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/sample-config.toml b/sample-config.toml index cdd27da..e31db07 100644 --- a/sample-config.toml +++ b/sample-config.toml @@ -3,10 +3,10 @@ dev = "/dev/ttyUSB0" baud = 19200 timeout = "500ms" unit = 0 -ports = [ { name = "master_main", number = 1 }, - { name = "master_music", number = 2 }, - { name = "standby_main", number = 3 }, - { name = "standby_music", number = 4 } ] +ports = [ { server = "master", channel = "main", number = 1 }, + { server = "master", channel = "music", number = 2 }, + { server = "standby", channel = "main", number = 3 }, + { server = "standby", channel = "music", number = 4 } ] [servers] diff --git a/src/rhctl/audio_switch_command.go b/src/rhctl/audio_switch_command.go index 3c67b3c..1c2e2fb 100644 --- a/src/rhctl/audio_switch_command.go +++ b/src/rhctl/audio_switch_command.go @@ -76,6 +76,10 @@ func (i *SwitchInputNum) FromString(str string) error { return nil } +func (i *SwitchInputNum) UnmarshalTOML(data []byte) error { + return i.FromString(string(data)) +} + type SwitchOutputNum uint func (o SwitchOutputNum) String() string { diff --git a/src/rhctl/conf.go b/src/rhctl/conf.go index b6f21ca..77ab174 100644 --- a/src/rhctl/conf.go +++ b/src/rhctl/conf.go @@ -36,8 +36,9 @@ type Config struct { Timeout Duration `toml:"timeout"` Unit SwitchUnitID `toml:"unit"` Ports []struct { - Name string `toml:"name"` - Number uint `toml:"number"` + Server string `toml:"server"` + Channel string `toml:"channel"` + Number SwitchInputNum `toml:"number"` } } |