// // rhctl // // Copyright (C) 2009-2016 Christian Pointner // // This file is part of rhctl. // // rhctl is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. // // rhctl is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with rhctl. If not, see . // package main import ( "fmt" ) type AudioSwitch struct { port *SerialPort } func (sw *AudioSwitch) Run() { rhdl.Printf("running audio switch") sw.port.tx <- "hello switch" } func SwitchInit(dev string, rate Baudrate) (sw *AudioSwitch, err error) { sw = &AudioSwitch{} if sw.port, err = SerialOpenAndHandle(dev, rate, ""); err != nil { err = fmt.Errorf("Error opening switch port: %s", err) return } return }