package main // VirtualOutlet definition type VirtualOutlet struct { name string status bool location string } // On - Switch on the virtual outlet func (o VirtualOutlet) On() error { o.status = true return nil } // Off - Switch off the virtual outlet func (o VirtualOutlet) Off() error { o.status = false return nil } // Toggle - Toggle the virtual outlet and return actual status func (o VirtualOutlet) Toggle() (bool, error) { o.status = !o.status return o.status, nil } // Name - Returns the virtual outlet name func (o VirtualOutlet) Name() (string, error) { return o.name, nil } // Status - Returns the virtual outlet status func (o VirtualOutlet) Status() (bool, error) { return o.status, nil } // Location - Returns the virtual outlet location (set in configuration) func (o VirtualOutlet) Location() string { return o.location } // Board - There's no physical board, so it's always an empty Board func (o VirtualOutlet) Board() Board { return Board{} } // Channel - There's no physical channel, so it's always zero func (o VirtualOutlet) Channel() uint { return 0 }