indiclient

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package indiclient is a pure Go implementation of an indi client. It supports indiserver version 1.7.

See http://indilib.org/develop/developer-manual/106-client-development.html

See http://www.clearskyinstitute.com/INDI/INDI.pdf

One of the awesome, but sometimes infuriating features of the INDI protocol is that if a device receives a command it doesn't understand, it is under no obligation to respond, and usually won't. This can make debugging difficult, because you aren't always sure if you are just sending the command incorrectly or if there is something else wrong. This library tries to alleviate that by checking parameters to all calls and will return an error if something doesn't look right.

Example (MultipleClients)
package main

import (
	"fmt"
	"os"
	"time"

	"github.com/rickbassham/logging"
	"github.com/spf13/afero"

	"github.com/goastro/indiclient"
)

func main() {
	var err error

	log := logging.NewLogger(os.Stdout, logging.JSONFormatter{}, logging.LogLevelInfo)
	dialer := indiclient.NetworkDialer{}
	fs := afero.NewMemMapFs()
	bufferSize := 10
	blobfs := afero.NewMemMapFs()

	// Initialize a new INDIClient.
	client := indiclient.NewINDIClient(log, dialer, fs, bufferSize)

	// Connect to the local indiserver.
	err = client.Connect("tcp", "localhost:7624")
	if err != nil {
		panic(err.Error())
	}

	// Get all properties of all devices.
	err = client.GetProperties("", "")
	if err != nil {
		panic(err.Error())
	}

	// Wait to get the devices back from indiserver.
	time.Sleep(2 * time.Second)

	// Print the names of all the devices we found.
	devices := client.Devices()
	for _, device := range devices {
		println(device.Name)
	}

	// Connect to our ASI224MC camera.
	err = client.SetSwitchValue("ZWO CCD ASI224MC", "CONNECTION", "CONNECT", indiclient.SwitchStateOn)
	if err != nil {
		panic(err.Error())
	}

	blobClient := indiclient.NewINDIClient(log, dialer, blobfs, bufferSize)

	// Connect to the local indiserver.
	err = blobClient.Connect("tcp", "localhost:7624")
	if err != nil {
		panic(err.Error())
	}

	// Get the "CCD1" property of the "ZWO CCD ASI224MC" device.
	err = blobClient.GetProperties("ZWO CCD ASI224MC", "CCD1")
	if err != nil {
		panic(err.Error())
	}

	// Wait to get the devices back from indiserver.
	time.Sleep(2 * time.Second)

	// Tell the indiserver we want blobs from this camera's CCD1 property, and ONLY blobs from this camera.
	// This allows the other client to stay open for control data, without slowing things down with large
	// file transfers.
	err = blobClient.EnableBlob("ZWO CCD ASI224MC", "CCD1", indiclient.BlobEnableOnly)
	if err != nil {
		panic(err.Error())
	}

	// Take a 10 second exposure. We send this on the control client.
	err = client.SetNumberValue("ZWO CCD ASI224MC", "CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", "10")
	if err != nil {
		panic(err.Error())
	}

	// Wait for the exposure to finish and transfer.
	time.Sleep(11 * time.Second)

	// Get the actual BLOB. Be sure to close rdr when you are done with it!
	rdr, fileName, length, err := blobClient.GetBlob("ZWO CCD ASI224MC", "CCD1", "CCD1")
	if err != nil {
		panic(err.Error())
	}

	println(fmt.Sprintf("%s %d", fileName, length))

	err = rdr.Close()
	if err != nil {
		panic(err.Error())
	}

	err = client.Disconnect()
	if err != nil {
		panic(err.Error())
	}

	err = blobClient.Disconnect()
	if err != nil {
		panic(err.Error())
	}
}
Output:

Example (SingleClient)
package main

import (
	"fmt"
	"os"
	"time"

	"github.com/rickbassham/logging"
	"github.com/spf13/afero"

	"github.com/goastro/indiclient"
)

func main() {
	var err error

	log := logging.NewLogger(os.Stdout, logging.JSONFormatter{}, logging.LogLevelInfo)
	dialer := indiclient.NetworkDialer{}
	fs := afero.NewMemMapFs()
	bufferSize := 10

	// Initialize a new INDIClient.
	client := indiclient.NewINDIClient(log, dialer, fs, bufferSize)

	// Connect to the local indiserver.
	err = client.Connect("tcp", "localhost:7624")
	if err != nil {
		panic(err.Error())
	}

	// Get all properties of all devices.
	err = client.GetProperties("", "")
	if err != nil {
		panic(err.Error())
	}

	// Wait to get the devices back from indiserver.
	time.Sleep(2 * time.Second)

	// Print the names of all the devices we found.
	devices := client.Devices()
	for _, device := range devices {
		println(device.Name)
	}

	// Connect to our ASI224MC camera.
	err = client.SetSwitchValue("ZWO CCD ASI224MC", "CONNECTION", "CONNECT", indiclient.SwitchStateOn)
	if err != nil {
		panic(err.Error())
	}

	// Tell the indiserver we want blobs from this camera's CCD1 property.
	err = client.EnableBlob("ZWO CCD ASI224MC", "CCD1", indiclient.BlobEnableAlso)
	if err != nil {
		panic(err.Error())
	}

	// Take a 10 second exposure.
	err = client.SetNumberValue("ZWO CCD ASI224MC", "CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", "10")
	if err != nil {
		panic(err.Error())
	}

	// Wait for the exposure to finish and transfer.
	time.Sleep(11 * time.Second)

	// Get the actual BLOB. Be sure to close rdr when you are done with it!
	rdr, fileName, length, err := client.GetBlob("ZWO CCD ASI224MC", "CCD1", "CCD1")
	if err != nil {
		panic(err.Error())
	}

	println(fmt.Sprintf("%s %d", fileName, length))

	err = rdr.Close()
	if err != nil {
		panic(err.Error())
	}
}
Output:

Index

Examples

Constants

View Source
const (
	// PropertyStateIdle represents a property that is "Idle". This is recommended to be displayed as Gray.
	PropertyStateIdle = PropertyState("Idle")
	// PropertyStateOk represents a property that is "Ok". This is recommended to be displayed as Green.
	PropertyStateOk = PropertyState("Ok")
	// PropertyStateBusy represents a property that is "Busy". This is recommended to be displayed as Yellow.
	PropertyStateBusy = PropertyState("Busy")
	// PropertyStateAlert represents a property that is "Alert". This is recommended to be displayed as Red.
	PropertyStateAlert = PropertyState("Alert")
)
View Source
const (
	// SwitchStateOff represents a switch that is "Off".
	SwitchStateOff = SwitchState("Off")
	// SwitchStateOn represents a switch that is "On".
	SwitchStateOn = SwitchState("On")
)
View Source
const (
	// SwitchRuleOneOfMany represents a switch that must have one switch in a vector active at a time.
	SwitchRuleOneOfMany = SwitchRule("OneOfMany")
	// SwitchRuleAtMostOne represents a switch that must have no more than one switch in a vector active at a time.
	SwitchRuleAtMostOne = SwitchRule("AtMostOne")
	// SwitchRuleAnyOfMany represents a switch that may have any number of switches in a vector active at a time.
	SwitchRuleAnyOfMany = SwitchRule("AnyOfMany")
)
View Source
const (
	// PropertyPermissionReadOnly represents a property that is Read-Only.
	PropertyPermissionReadOnly = PropertyPermission("ro")
	// PropertyPermissionWriteOnly represents a property that is Write-Only.
	PropertyPermissionWriteOnly = PropertyPermission("wo")
	// PropertyPermissionReadWrite represents a property that is Read-Write.
	PropertyPermissionReadWrite = PropertyPermission("rw")
)
View Source
const (
	// BlobEnableNever (default) represents that the current client should not be sent any BLOB's for a device.
	BlobEnableNever = BlobEnable("Never")
	// BlobEnableAlso represents that the current client should be sent any BLOB's for a device in addition to the normal INDI commands.
	BlobEnableAlso = BlobEnable("Also")
	// BlobEnableOnly represents that the current client should only be sent any BLOB's for a device.
	BlobEnableOnly = BlobEnable("Only")
)

Variables

View Source
var (
	// ErrDeviceNotFound is returned when a call cannot find a device.
	ErrDeviceNotFound = errors.New("device not found")

	// ErrPropertyNotFound is returned when a call cannot find a property.
	ErrPropertyNotFound = errors.New("property not found")

	// ErrPropertyValueNotFound is returned when a call cannot find a property value.
	ErrPropertyValueNotFound = errors.New("property value not found")

	// ErrPropertyReadOnly is returned when an attempt to change a read-only property was made.
	ErrPropertyReadOnly = errors.New("property read only")

	// ErrPropertyWithoutDevice is returned when an attempt to GetProperties specifies a property but no device.
	ErrPropertyWithoutDevice = errors.New("property specified without device")

	// ErrInvalidBlobEnable is returned when a value other than Only, Also, Never is specified for BlobEnable.
	ErrInvalidBlobEnable = errors.New("invalid BlobEnable value")
)

Functions

This section is empty.

Types

type BlobEnable

type BlobEnable string

BlobEnable represents whether BLOB's should be sent to this client.

type BlobProperty

type BlobProperty struct {
	Name        string               `json:"name"`
	Label       string               `json:"label"`
	Group       string               `json:"group"`
	State       PropertyState        `json:"state"`
	LastUpdated time.Time            `json:"lastUpdated"`
	Messages    []MessageJSON        `json:"messages"`
	Permissions PropertyPermission   `json:"permissions"`
	Timeout     int                  `json:"timeout"`
	Values      map[string]BlobValue `json:"values"`
}

BlobProperty is a blob property on a device.

type BlobValue

type BlobValue struct {
	Name  string `json:"name"`
	Label string `json:"label"`
	Value string `json:"value"`
	Size  int64  `json:"size"`
}

BlobValue is a blob value on a BlobProperty.

type DefBlob

type DefBlob struct {
	XMLName xml.Name `xml:"defBLOB"`
	Name    string   `xml:"name,attr"`
	Label   string   `xml:"label,attr"`
}

DefBlob Define one member of a BLOB vector. Unlike other defXXX elements, this does not contain an initial value for the BLOB.

type DefBlobVector

type DefBlobVector struct {
	XMLName   xml.Name           `xml:"defBLOBVector"`
	Device    string             `xml:"device,attr"`
	Name      string             `xml:"name,attr"`
	Label     string             `xml:"label,attr"`
	Group     string             `xml:"group,attr"`
	State     PropertyState      `xml:"state,attr"`
	Perm      PropertyPermission `xml:"perm,attr"`
	Timeout   int                `xml:"timeout,attr"`
	Timestamp string             `xml:"timestamp,attr"`
	Message   string             `xml:"message"`
	Blobs     []DefBlob          `xml:"defBLOB"`
}

DefBlobVector Define a property that holds one or more Binary Large Objects, BLOBs.

type DefLight

type DefLight struct {
	XMLName xml.Name      `xml:"defLight"`
	Name    string        `xml:"name,attr"`
	Label   string        `xml:"label,attr"`
	Value   PropertyState `xml:",chardata"`
}

DefLight Define one member of a light vector.

type DefLightVector

type DefLightVector struct {
	XMLName   xml.Name      `xml:"defLightVector"`
	Device    string        `xml:"device,attr"`
	Name      string        `xml:"name,attr"`
	Label     string        `xml:"label,attr"`
	Group     string        `xml:"group,attr"`
	State     PropertyState `xml:"state,attr"`
	Timestamp string        `xml:"timestamp,attr"`
	Message   string        `xml:"message"`
	Lights    []DefLight    `xml:"defLight"`
}

DefLightVector Define a collection of passive indicator lights.

type DefNumber

type DefNumber struct {
	XMLName xml.Name `xml:"defNumber"`
	Name    string   `xml:"name,attr"`
	Label   string   `xml:"label,attr"`
	Format  string   `xml:"format,attr"`
	Min     string   `xml:"min,attr"`
	Max     string   `xml:"max,attr"`
	Step    string   `xml:"step,attr"`
	Value   string   `xml:",chardata"`
}

DefNumber Define one member of a number vector.

type DefNumberVector

type DefNumberVector struct {
	XMLName   xml.Name           `xml:"defNumberVector"`
	Device    string             `xml:"device,attr"`
	Name      string             `xml:"name,attr"`
	Label     string             `xml:"label,attr"`
	Group     string             `xml:"group,attr"`
	State     PropertyState      `xml:"state,attr"`
	Perm      PropertyPermission `xml:"perm,attr"`
	Timeout   int                `xml:"timeout,attr"`
	Timestamp string             `xml:"timestamp,attr"`
	Message   string             `xml:"message"`
	Numbers   []DefNumber        `xml:"defNumber"`
}

DefNumberVector Define a property that holds one or more numeric values.

type DefSwitch

type DefSwitch struct {
	XMLName xml.Name    `xml:"defSwitch"`
	Name    string      `xml:"name,attr"`
	Label   string      `xml:"label,attr"`
	Value   SwitchState `xml:",chardata"`
}

DefSwitch Define one member of a switch vector.

type DefSwitchVector

type DefSwitchVector struct {
	XMLName   xml.Name           `xml:"defSwitchVector"`
	Device    string             `xml:"device,attr"`
	Name      string             `xml:"name,attr"`
	Label     string             `xml:"label,attr"`
	Group     string             `xml:"group,attr"`
	State     PropertyState      `xml:"state,attr"`
	Perm      PropertyPermission `xml:"perm,attr"`
	Rule      SwitchRule         `xml:"rule,attr"`
	Timeout   int                `xml:"timeout,attr"`
	Timestamp string             `xml:"timestamp,attr"`
	Message   string             `xml:"message"`
	Switches  []DefSwitch        `xml:"defSwitch"`
}

DefSwitchVector Define a collection of switches. Rule is only a hint for use by a GUI to decide a suitable presentation style. Rules are actually implemented wholly within the Device.

type DefText

type DefText struct {
	XMLName xml.Name `xml:"defText"`
	Name    string   `xml:"name,attr"`
	Label   string   `xml:"label,attr"`
	Value   string   `xml:",chardata"`
}

DefText Define one member of a text vector.

type DefTextVector

type DefTextVector struct {
	XMLName   xml.Name           `xml:"defTextVector"`
	Device    string             `xml:"device,attr"`
	Name      string             `xml:"name,attr"`
	Label     string             `xml:"label,attr"`
	Group     string             `xml:"group,attr"`
	State     PropertyState      `xml:"state,attr"`
	Perm      PropertyPermission `xml:"perm,attr"`
	Timeout   int                `xml:"timeout,attr"`
	Timestamp string             `xml:"timestamp,attr"`
	Message   string             `xml:"message"`
	Texts     []DefText          `xml:"defText"`
}

DefTextVector Define a property that holds one or more text elements.

type DelProperty

type DelProperty struct {
	XMLName   xml.Name `xml:"delProperty"`
	Device    string   `xml:"device,attr"`
	Name      string   `xml:"name,attr"`
	Timestamp string   `xml:"timestamp,attr"`
	Message   string   `xml:"message,attr"`
}

DelProperty Delete the given property, or entire device if no property is specified.

type Device

type Device struct {
	Name             string                    `json:"name"`
	TextProperties   map[string]TextProperty   `json:"textProperties"`
	SwitchProperties map[string]SwitchProperty `json:"switchProperties"`
	NumberProperties map[string]NumberProperty `json:"numberProperties"`
	BlobProperties   map[string]BlobProperty   `json:"blobProperties"`
	LightProperties  map[string]LightProperty  `json:"lightProperties"`
	Messages         []MessageJSON             `json:"messages"`
}

Device is an INDI device.

func (Device) Groups

func (d Device) Groups() []string

Groups retreives a list of all the groups for a device for display purposes. Groups are returned in alphabetical order.

type Dialer

type Dialer interface {
	Dial(network, address string) (io.ReadWriteCloser, error)
}

Dialer allows the client to connect to an INDI server.

type EnableBlob

type EnableBlob struct {
	XMLName xml.Name   `xml:"enableBLOB"`
	Device  string     `xml:"device,attr"`
	Name    string     `xml:"name,attr"`
	Value   BlobEnable `xml:",chardata"`
}

EnableBlob Command to control whether setBLOBs should be sent to this channel from a given Device. They can be turned off completely by setting Never (the default), allowed to be intermixed with other INDI commands by setting Also or made the only command by setting Only.

type GetProperties

type GetProperties struct {
	XMLName xml.Name `xml:"getProperties"`
	Version string   `xml:"version,attr"`
	Device  string   `xml:"device,attr,omitempty"`
	Name    string   `xml:"name,attr,omitempty"`
}

type INDIClient

type INDIClient struct {
	// contains filtered or unexported fields
}

INDIClient is the struct used to keep a connection alive to an indiserver.

func NewINDIClient

func NewINDIClient(log logging.Logger, dialer Dialer, fs afero.Fs, bufferSize int) *INDIClient

NewINDIClient creates a client to connect to an INDI server.

func (*INDIClient) CloseBlobStream

func (c *INDIClient) CloseBlobStream(deviceName, propName, blobName string, id string) (err error)

CloseBlobStream closes the blob stream created by GetBlobStream.

func (*INDIClient) Connect

func (c *INDIClient) Connect(network, address string) error

Connect dials to create a connection to address. address should be in the format that the provided Dialer expects.

func (*INDIClient) Devices

func (c *INDIClient) Devices() []Device

Devices returns the current list of INDI devices with their current state.

func (*INDIClient) Disconnect

func (c *INDIClient) Disconnect() error

Disconnect clears out all devices from memory, closes the connection, and closes the read and write channels.

func (*INDIClient) EnableBlob

func (c *INDIClient) EnableBlob(deviceName, propName string, val BlobEnable) error

EnableBlob sends a command to the INDI server to enable/disable BLOBs for the current connection. It is recommended to enable blobs on their own client, and keep the main connection clear of large transfers. By default, BLOBs are NOT enabled.

func (*INDIClient) GetBlob

func (c *INDIClient) GetBlob(deviceName, propName, blobName string) (rdr io.ReadCloser, fileName string, length int64, err error)

GetBlob finds a BLOB with the given deviceName, propName, blobName. Be sure to close rdr when you are done with it.

func (*INDIClient) GetBlobStream

func (c *INDIClient) GetBlobStream(deviceName, propName, blobName string) (rdr io.ReadCloser, id string, err error)

GetBlobStream finds a BLOB with the given deviceName, propName, blobName. This will return an io.Pipe that can stream the BLOBs that are received from the indiserver. The client will keep track of all open streams and write to them as blobs are received from indiserver. Remember to call CloseBlobStream when you are done. If you don't, all blobs received for that device, property, blob will fail to write once the reader is closed.

func (*INDIClient) GetProperties

func (c *INDIClient) GetProperties(deviceName, propName string) error

GetProperties sends a command to the INDI server to retreive the property definitions for the given deviceName and propName. deviceName and propName are optional.

func (*INDIClient) IsConnected

func (c *INDIClient) IsConnected() bool

IsConnected returns true if the client is currently connected to an INDI server. Otherwise, returns false.

func (*INDIClient) SetBlobValue

func (c *INDIClient) SetBlobValue(deviceName, propName, blobName, blobValue, blobFormat string, blobSize int) error

SetBlobValue sends a command to the INDI server to change the value of a blobVector.

func (*INDIClient) SetNumberValue

func (c *INDIClient) SetNumberValue(deviceName, propName, NumberName, NumberValue string) error

SetNumberValue sends a command to the INDI server to change the value of a numberVector.

func (*INDIClient) SetSwitchValue

func (c *INDIClient) SetSwitchValue(deviceName, propName, switchName string, switchValue SwitchState) error

SetSwitchValue sends a command to the INDI server to change the value of a switchVector. Note that you will ususally set the desired property on SwitchStateOn, and let the device decide how to switch the other values off.

Example (Connect)
package main

import (
	"os"
	"time"

	"github.com/rickbassham/logging"
	"github.com/spf13/afero"

	"github.com/goastro/indiclient"
)

func main() {
	var err error

	log := logging.NewLogger(os.Stdout, logging.JSONFormatter{}, logging.LogLevelInfo)
	dialer := indiclient.NetworkDialer{}
	fs := afero.NewMemMapFs()
	bufferSize := 10

	// Initialize a new INDIClient.
	client := indiclient.NewINDIClient(log, dialer, fs, bufferSize)

	// Connect to the local indiserver.
	err = client.Connect("tcp", "localhost:7624")
	if err != nil {
		panic(err.Error())
	}

	// Get all properties of all devices.
	err = client.GetProperties("", "")
	if err != nil {
		panic(err.Error())
	}

	// Wait to get the devices back from indiserver.
	time.Sleep(2 * time.Second)

	// Connect to our ASI224MC camera.
	err = client.SetSwitchValue("ZWO CCD ASI224MC", "CONNECTION", "CONNECT", indiclient.SwitchStateOn)
	if err != nil {
		panic(err.Error())
	}

	// Wait to connect to the device.
	time.Sleep(2 * time.Second)

	// Notice that we are not setting "CONNECT" to SwitchStateOff, but instead setting "DISCONNECT" to SwitchStateOn.
	err = client.SetSwitchValue("ZWO CCD ASI224MC", "CONNECTION", "DISCONNECT", indiclient.SwitchStateOn)
	if err != nil {
		panic(err.Error())
	}

	err = client.Disconnect()
	if err != nil {
		panic(err.Error())
	}
}
Output:

func (*INDIClient) SetTextValue

func (c *INDIClient) SetTextValue(deviceName, propName, textName, textValue string) error

SetTextValue sends a command to the INDI server to change the value of a textVector.

type LightProperty

type LightProperty struct {
	Name        string                `json:"name"`
	Label       string                `json:"label"`
	Group       string                `json:"group"`
	State       PropertyState         `json:"state"`
	LastUpdated time.Time             `json:"lastUpdated"`
	Messages    []MessageJSON         `json:"messages"`
	Values      map[string]LightValue `json:"values"`
}

LightProperty is a light property on a device. Note that these properties are read-only.

type LightValue

type LightValue struct {
	Name  string        `json:"name"`
	Label string        `json:"label"`
	Value PropertyState `json:"value"`
}

LightValue is a light value on a LightProperty.

type Message

type Message struct {
	XMLName   xml.Name `xml:"message"`
	Device    string   `xml:"device,attr"`
	Timestamp string   `xml:"timestamp,attr"`
	Message   string   `xml:"message,attr"`
}

Message Send a message associated with a device or entire system.

type MessageJSON

type MessageJSON struct {
	Timestamp time.Time `json:"timestamp"`
	Message   string    `json:"message"`
}

MessageJSON is a message received from indiserver.

type NetworkDialer

type NetworkDialer struct{}

NetworkDialer is an implementation of Dialer that uses the built-in net package.

func (NetworkDialer) Dial

func (NetworkDialer) Dial(network, address string) (io.ReadWriteCloser, error)

Dial connects to the address on the named network.

type NewBlobVector

type NewBlobVector struct {
	XMLName   xml.Name  `xml:"newBLOBVector"`
	Device    string    `xml:"device,attr"`
	Name      string    `xml:"name,attr"`
	Timestamp string    `xml:"timestamp,attr,omitempty"`
	Blobs     []OneBlob `xml:"oneBLOB"`
}

NewBlobVector Commands to inform Device of new target values for a Property. After sending, the Client must set its local state for the Property to Busy, leaving it up to the Device to change it when it sees fit.

type NewNumberVector

type NewNumberVector struct {
	XMLName   xml.Name    `xml:"newNumberVector"`
	Device    string      `xml:"device,attr"`
	Name      string      `xml:"name,attr"`
	Timestamp string      `xml:"timestamp,attr,omitempty"`
	Numbers   []OneNumber `xml:"oneNumber"`
}

NewNumberVector Commands to inform Device of new target values for a Property. After sending, the Client must set its local state for the Property to Busy, leaving it up to the Device to change it when it sees fit.

type NewSwitchVector

type NewSwitchVector struct {
	XMLName   xml.Name    `xml:"newSwitchVector"`
	Device    string      `xml:"device,attr"`
	Name      string      `xml:"name,attr"`
	Timestamp string      `xml:"timestamp,attr,omitempty"`
	Switches  []OneSwitch `xml:"oneSwitch"`
}

NewSwitchVector Commands to inform Device of new target values for a Property. After sending, the Client must set its local state for the Property to Busy, leaving it up to the Device to change it when it sees fit.

type NewTextVector

type NewTextVector struct {
	XMLName   xml.Name  `xml:"newTextVector"`
	Device    string    `xml:"device,attr"`
	Name      string    `xml:"name,attr"`
	Timestamp string    `xml:"timestamp,attr,omitempty"`
	Texts     []OneText `xml:"oneText"`
}

NewTextVector Commands to inform Device of new target values for a Property. After sending, the Client must set its local state for the Property to Busy, leaving it up to the Device to change it when it sees fit.

type NumberProperty

type NumberProperty struct {
	Name        string                 `json:"name"`
	Label       string                 `json:"label"`
	Group       string                 `json:"group"`
	State       PropertyState          `json:"state"`
	Timeout     int                    `json:"timeout"`
	LastUpdated time.Time              `json:"lastUpdated"`
	Messages    []MessageJSON          `json:"messages"`
	Permissions PropertyPermission     `json:"permissions"`
	Values      map[string]NumberValue `json:"values"`
}

NumberProperty is a number property on a device.

type NumberValue

type NumberValue struct {
	Name   string `json:"name"`
	Label  string `json:"label"`
	Value  string `json:"value"`
	Format string `json:"format"`
	Min    string `json:"min"`
	Max    string `json:"max"`
	Step   string `json:"step"`
}

NumberValue is a number value on a NumberProperty.

type OneBlob

type OneBlob struct {
	XMLName xml.Name `xml:"oneBLOB"`
	Name    string   `xml:"name,attr"`
	Size    int      `xml:"size,attr"`
	Format  string   `xml:"format,attr"`
	Value   string   `xml:",chardata"`
}

OneBlob One member of a BLOB vector. The contents of this element must always be encoded using base64. The format attribute consists of one or more file name suffixes, each preceded with a period, which indicate how the decoded data is to be interpreted. For example .fits indicates the decoded BLOB is a FITS file, and .fits.z indicates the decoded BLOB is a FITS file compressed with zlib. The INDI protocol places no restrictions on the contents or formats of BLOBs but at minimum astronomical INDI clients are encouraged to support the FITS image file format and the zlib compression mechanism. The size attribute indicates the number of bytes in the final BLOB after decoding and after any decompression. For example, if the format is .fits.z the size attribute is the number of bytes in the FITS file. A Client unfamiliar with the specified format may use the attribute as a simple string, perhaps in combination with the timestamp attribute, to create a file name in which to store the data without processing other than decoding the base64.

type OneLight

type OneLight struct {
	XMLName xml.Name      `xml:"oneLight"`
	Name    string        `xml:"name,attr"`
	Value   PropertyState `xml:",chardata"`
}

OneLight Send a message to specify state of one member of a Light vector

type OneNumber

type OneNumber struct {
	XMLName xml.Name `xml:"oneNumber"`
	Name    string   `xml:"name,attr"`
	Value   string   `xml:",chardata"`
}

OneNumber One member of a Number vector.

type OneSwitch

type OneSwitch struct {
	XMLName xml.Name    `xml:"oneSwitch"`
	Name    string      `xml:"name,attr"`
	Value   SwitchState `xml:",chardata"`
}

OneSwitch One member of a switch vector.

type OneText

type OneText struct {
	XMLName xml.Name `xml:"oneText"`
	Name    string   `xml:"name,attr"`
	Value   string   `xml:",chardata"`
}

OneText One member of a Text vector.

type PropertyPermission

type PropertyPermission string

PropertyPermission represents a permission hint for the client. "ro", "wo", or "rw".

type PropertyState

type PropertyState string

PropertyState represents the current state of a property. "Idle", "Ok", "Busy", or "Alert".

type SetBlobVector

type SetBlobVector struct {
	XMLName   xml.Name      `xml:"setBLOBVector"`
	Device    string        `xml:"device,attr"`
	Name      string        `xml:"name,attr"`
	State     PropertyState `xml:"state,attr"`
	Timeout   int           `xml:"timeout,attr"`
	Timestamp string        `xml:"timestamp,attr"`
	Message   string        `xml:"message"`
	Blobs     []OneBlob     `xml:"oneBLOB"`
}

SetBlobVector Send a new set of values for a BLOB vector, with optional new timeout, state and message.

type SetLightVector

type SetLightVector struct {
	XMLName   xml.Name      `xml:"setLightVector"`
	Device    string        `xml:"device,attr"`
	Name      string        `xml:"name,attr"`
	State     PropertyState `xml:"state,attr"`
	Timestamp string        `xml:"timestamp,attr"`
	Message   string        `xml:"message"`
	Lights    []OneLight    `xml:"oneLight"`
}

SetLightVector Send a new set of values for a Light vector, with optional new state and message.

type SetNumberVector

type SetNumberVector struct {
	XMLName   xml.Name      `xml:"setNumberVector"`
	Device    string        `xml:"device,attr"`
	Name      string        `xml:"name,attr"`
	State     PropertyState `xml:"state,attr"`
	Timeout   int           `xml:"timeout,attr"`
	Timestamp string        `xml:"timestamp,attr"`
	Message   string        `xml:"message"`
	Numbers   []OneNumber   `xml:"oneNumber"`
}

SetNumberVector Send a new set of values for a Number vector, with optional new timeout, state and message.

type SetSwitchVector

type SetSwitchVector struct {
	XMLName   xml.Name      `xml:"setSwitchVector"`
	Device    string        `xml:"device,attr"`
	Name      string        `xml:"name,attr"`
	State     PropertyState `xml:"state,attr"`
	Timeout   int           `xml:"timeout,attr"`
	Timestamp string        `xml:"timestamp,attr"`
	Message   string        `xml:"message"`
	Switches  []OneSwitch   `xml:"oneSwitch"`
}

SetSwitchVector Send a new set of values for a Switch vector, with optional new timeout, state and message.

type SetTextVector

type SetTextVector struct {
	XMLName   xml.Name      `xml:"setTextVector"`
	Device    string        `xml:"device,attr"`
	Name      string        `xml:"name,attr"`
	State     PropertyState `xml:"state,attr"`
	Timeout   int           `xml:"timeout,attr"`
	Timestamp string        `xml:"timestamp,attr"`
	Message   string        `xml:"message"`
	Texts     []OneText     `xml:"oneText"`
}

SetTextVector Send a new set of values for a Text vector, with optional new timeout, state and message.

type SwitchProperty

type SwitchProperty struct {
	Name        string                 `json:"name"`
	Label       string                 `json:"label"`
	Group       string                 `json:"group"`
	State       PropertyState          `json:"state"`
	Timeout     int                    `json:"timeout"`
	LastUpdated time.Time              `json:"lastUpdated"`
	Messages    []MessageJSON          `json:"messages"`
	Rule        SwitchRule             `json:"rule"`
	Permissions PropertyPermission     `json:"permissions"`
	Values      map[string]SwitchValue `json:"values"`
}

SwitchProperty is a switch property on a device.

type SwitchRule

type SwitchRule string

SwitchRule represents how a switch state can exist relative to the other switches in the vector. "OneOfMany", "AtMostOne", or "AnyOfMany".

type SwitchState

type SwitchState string

SwitchState reprensents the current state of a switch value. "On" or "Off".

type SwitchValue

type SwitchValue struct {
	Name  string      `json:"name"`
	Label string      `json:"label"`
	Value SwitchState `json:"value"`
}

SwitchValue is a switch value on a SwitchProperty.

type TextProperty

type TextProperty struct {
	Name        string               `json:"name"`
	Label       string               `json:"label"`
	Group       string               `json:"group"`
	State       PropertyState        `json:"state"`
	Timeout     int                  `json:"timeout"`
	LastUpdated time.Time            `json:"lastUpdated"`
	Messages    []MessageJSON        `json:"messages"`
	Permissions PropertyPermission   `json:"permissions"`
	Values      map[string]TextValue `json:"values"`
}

TextProperty is a text property on a device.

type TextValue

type TextValue struct {
	Name  string `json:"name"`
	Label string `json:"label"`
	Value string `json:"value"`
}

TextValue is a text value on a TextProperty.

Jump to

Keyboard shortcuts

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