Skip to content

patopesto/go-sacn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sACN in go

A library for sACN (ANSI E1.31) in Go.

Fully supports and complies to the specification:

  • All Packet types (Data, Sync and Discovery)
  • Receiver with callbacks on sync packet reception
  • Transmitter sending discovery packets

Usage

go get gitlab.com/patopest/go-sacn
  • Receiver
package main

import (
    "fmt"
    "time"
    "net"

    "gitlab.com/patopest/go-sacn"
    "gitlab.com/patopest/go-sacn/packet"
)

func main() {
    fmt.Println("hello")

    itf, _ := net.InterfaceByName("en0") // change based on your machine
    receiver := sacn.NewReceiver(itf)
    receiver.JoinUniverse(1)
    receiver.RegisterPacketCallback(packet.PacketTypeData, dataPacketCallback)
    receiver.Start()

    for {
        time.Sleep(1)
    }
}

func dataPacketCallback(p packet.SACNPacket, source string) {
    d, ok := p.(*packet.DataPacket)
    if ok == false {
        return
    }
    fmt.Printf("Received Data Packet for universe %d from %s\n", d.Universe, source)
}
  • Transmitter

TODO

See examples directory for more examples.

Development

  • Run an example to test your code
go run examples/receiver/receiver.go
  • Tests
go test ./...

References

Similar projects

  • sACN-Monitor: An app to view data from all sACN universes, built using this library.
  • Hundemeier's go-sacn: Only supports Data packets
  • go-artnet
  • Open Lighting Architecure (OLA) framework (C implementations of control protocols).

Documentation

Releases

No releases published

Packages

No packages published

Languages