Documentation ¶
Overview ¶
Package indiserver is used to start up and control an instance of indiserver. It can also be used to list all known INDI drivers on the current machine.
Example ¶
package main import ( "os" "os/signal" "time" "github.com/goastro/indiserver" "github.com/rickbassham/goexec" "github.com/rickbassham/logging" "github.com/spf13/afero" ) func main() { logger := logging.NewLogger(os.Stdout, logging.JSONFormatter{}, logging.LogLevelInfo) fs := afero.NewOsFs() port := "" s := indiserver.NewINDIServer(logger, fs, port, goexec.ExecCommand{}) logger.WithField("drivers", s.Drivers()).Info("drivers") s.StartServer() time.Sleep(1 * time.Second) s.StartDriver("indi_asi_ccd", "CCD 1") println("Server Running. Press CTRL-C to stop.") // Wait for a CTRL-C to stop the server. sigchan := make(chan os.Signal, 1) signal.Notify(sigchan, os.Interrupt) <-sigchan s.StopDriver("indi_asi_ccd", "CCD 1") time.Sleep(1 * time.Second) s.StopServer() }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type INDIServer ¶
type INDIServer struct {
// contains filtered or unexported fields
}
INDIServer is a struct to start/stop and control a local indiserver executable.
func NewINDIServer ¶
NewINDIServer creates a struct that can be used to get info about installed INDI drivers and start/stop a local indiserver.
func (*INDIServer) Drivers ¶
func (s *INDIServer) Drivers() map[string][]Driver
Drivers returns a list of drivers organzied by group.
func (*INDIServer) StartDriver ¶
func (s *INDIServer) StartDriver(driver, name string) error
StartDriver starts up a driver on the indiserver. Note that this will NOT return an error if the indiserver doesn't recognize the driver or if it has any other issues. Watch the log for info on failures inside indiserver.
func (*INDIServer) StartServer ¶
func (s *INDIServer) StartServer() error
StartServer starts up the indiserver. Be sure to call StopServer when you are done!
func (*INDIServer) StopDriver ¶
func (s *INDIServer) StopDriver(driver, name string) error
StopDriver stops a driver on the indiserver.
func (*INDIServer) StopServer ¶
func (s *INDIServer) StopServer() error
StopServer stops the currently running indiserver and cleans up.