package models import "fmt" type Device struct { startAddress uint length uint channels *DMX } func NewDevice(startAddress uint, channels uint, dmx *DMX) *Device { return &Device{ startAddress: startAddress, length: channels, channels: dmx, } } func (d *Device) SetChannelValue(channel uint, value uint8) error { if d.length == channel { return fmt.Errorf("channel out of range %d", channel) } d.channels.SetValue(d.startAddress+channel, value) return nil }