goiio is a Go client to interact with IIO (industrial I/O).
go-iio was written to access remote iiod instanced, since libiio does not seem to have golang bindings by itself. It's main use case is connecting with remote IIOd instances: local IIO access is out of scope, you'll need to run iiod.
// Create TCP connection
c, err := goiio.New("my-sensor.home.lan:30431")
if err != nil {
panic(err)
}
// Populate the values in attributes
if err = c.FetchAttributes(); err != nil {
panic(err)
}
// Loop through all devices
for _, dev := range c.Context.Devices {
log.Infof("Device: id=%s, name=%s", dev.ID, dev.Name)
for _, ch := range dev.Channels {
log.Infof(" Channel: id=%s", ch.ID)
for _, attr := range ch.Attributes {
log.Infof(" Attribute: %s, value: %0.3f", attr.Name, attr.Value)
}
}
}
Install goiio using the "go get" command:
go get github.com/brendan-ta/goiio
Minimum Golang dependency: 1.16
- logrus - Structured logger
Standard Go library imports:
- bufio - buffered I/O
- encoding/xml - XML parser
- fmt - formatted I/O
- net - network I/O
- strconv - to and from string conversion
- strings - maipulate UTF-8 encoded strings
- libiio - libiio
This project was forked from the original project goiio however due to go modules forking a project meant collisions with module names. Therefore this is simply an evolution of the original project:
- goiio - Original goiio
goiio is available under the GNU AGPL Licence.