package relay

import cc "rpirelay/internal/context"

var _ Service = (*Relay)(nil)

func (r *Relay) SwitchOn(c *cc.C) (err error) {
	r.pin.High()

	return nil
}

func (r *Relay) SwitchOff(c *cc.C) (err error) {
	r.pin.Low()

	return nil
}

func (r *Relay) GetState(c *cc.C) (open bool, err error) {
	state := r.pin.Read()

	return state == 1, nil
}
