artnet

package module
v0.0.0-...-748cf5f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: MIT Imports: 10 Imported by: 0

README

go-artnet Build Status GoDoc Go Report Card

Package artnet attempts to implement the Art-Net 4 specification from (c) Artistic Licence Holding Ltd, from art-net.pdf.

Art-Net is an Ethernet protocol based on the TCP/IP protocol suite. Its purpose is to allow transfer of large amounts of DMX512 data over a wide area using standard networking technology.

MIT Licensed.

This package is still unfinished. The API is highly unstable.

See Examples for some hints on how to use this package.

Documentation

Overview

Package artnet attempts to implement the Art-Net 4 specification from (c) Artistic Licence Holding Ltd, available at www.Art-Net.org.uk. Art-Net is an Ethernet protocol based on the TCP/IP protocol suite. Its purpose is to allow transfer of large amounts of DMX512 data over a wide area using standard networking technology.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArtPollReplyFromConfig

func ArtPollReplyFromConfig(c NodeConfig) *packet.ArtPollReplyPacket

ArtPollReplyFromConfig will return a ArtPollReplyPacket from the NodeConfig TODO: make this a more complete packet by adding the other NodeConfig fields

Types

type Address

type Address struct {
	Net    uint8 // 0-128
	SubUni uint8
}

Address contains a universe address

func (Address) Integer

func (a Address) Integer() int

Integer returns the integer representation of Address

func (Address) String

func (a Address) String() string

String returns a string representation of Address

type ControlledNode

type ControlledNode struct {
	LastSeen   time.Time
	Node       NodeConfig
	UDPAddress net.UDPAddr

	Sequence   uint8
	DMXBuffer  map[Address][512]byte
	LastUpdate time.Time
	// contains filtered or unexported fields
}

ControlledNode hols the configuration of a node we control

type Controller

type Controller struct {

	// Nodes is a slice of nodes that are seen by this controller
	Nodes         []*ControlledNode
	OutputAddress map[Address]*ControlledNode
	InputAddress  map[Address]*ControlledNode
	// contains filtered or unexported fields
}

Controller holds the information for a controller

func NewController

func NewController(name string, ip net.IP, log Logger) *Controller

NewController return a Controller

func (*Controller) SendDMXToAddress

func (c *Controller) SendDMXToAddress(dmx [512]byte, address Address)

SendDMXToAddress will set the DMXBuffer for a destination address and update the node

func (*Controller) Start

func (c *Controller) Start() error

Start will start this controller

func (*Controller) Stop

func (c *Controller) Stop()

Stop will stop this controller

type Fields

type Fields map[string]interface{}

Fields are a representation of formatted log fields

type InputPort

type InputPort struct {
	Address Address
	Type    code.PortType
	Status  code.GoodInput
}

InputPort contains information for an input port

type Logger

type Logger interface {
	logrus.StdLogger
	With(fields Fields) *logger
}

Logger is the interface for a logger

func NewDefaultLogger

func NewDefaultLogger() Logger

NewLogger returns a Logger based on logrus

func NewLogger

func NewLogger(log *logrus.Entry) Logger

NewLogger creates a new logger from given logrus logger

type Node

type Node struct {
	// Config holds the configuration of this node
	Config NodeConfig
	// contains filtered or unexported fields
}

Node is the information known about a node

func NewNode

func NewNode(name string, style code.StyleCode, ip net.IP, log Logger) *Node

NewNode return a Node

func (*Node) Start

func (n *Node) Start() error

Start will start the controller

func (*Node) Stop

func (n *Node) Stop()

Stop will stop all running routines and close the network connection

type NodeConfig

type NodeConfig struct {
	OEM          uint16
	Version      uint16
	BiosVersion  uint8
	Manufacturer string
	Type         code.StyleCode
	Name         string
	Description  string

	Ethernet  net.HardwareAddr
	IP        net.IP
	BindIP    net.IP
	BindIndex uint8
	Port      uint16

	Report  []code.NodeReportCode
	Status1 code.Status1
	Status2 code.Status2

	BaseAddress Address
	InputPorts  []InputPort
	OutputPorts []OutputPort
}

NodeConfig is a representation of a single node.

func ConfigFromArtPollReply

func ConfigFromArtPollReply(p packet.ArtPollReplyPacket) NodeConfig

ConfigFromArtPollReply will return a Config from the information in the ArtPollReplyPacket

type OutputPort

type OutputPort struct {
	Address Address
	Type    code.PortType
	Status  code.GoodOutput
}

OutputPort contains information for an input port

Directories

Path Synopsis
example
Package packet contains the ArtNet packet definitions
Package packet contains the ArtNet packet definitions
code
Package code contains codes used in ArtNet packets
Package code contains codes used in ArtNet packets
Package version implements the version of the protocol
Package version implements the version of the protocol

Jump to

Keyboard shortcuts

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