75 lines
1.6 KiB
C#
75 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HueLights
|
|
{
|
|
public abstract class Light
|
|
{
|
|
protected int id { get; }
|
|
protected bool on { get; set; }
|
|
protected int bri { get; set; }
|
|
protected int hue { get; set; }
|
|
protected int sat { get; set; }
|
|
|
|
public Light(int id)
|
|
{
|
|
this.id = id;
|
|
this.on = false;
|
|
this.bri = 255;
|
|
this.hue = 0;
|
|
this.sat = 0;
|
|
}
|
|
|
|
public virtual int getID()
|
|
{
|
|
return id;
|
|
}
|
|
|
|
public virtual bool getState()
|
|
{
|
|
return on;
|
|
}
|
|
public virtual void setState(bool on)
|
|
{
|
|
this.on = on;
|
|
}
|
|
|
|
public virtual int getBrightness()
|
|
{
|
|
return bri;
|
|
}
|
|
public virtual void setBrightness(int bri)
|
|
{
|
|
this.bri = bri;
|
|
}
|
|
|
|
public virtual int getHue()
|
|
{
|
|
return hue;
|
|
}
|
|
public virtual void setHue(int hue)
|
|
{
|
|
this.hue = hue;
|
|
}
|
|
|
|
public virtual int getSaturation()
|
|
{
|
|
return sat;
|
|
}
|
|
public virtual void setSaturation(int sat)
|
|
{
|
|
this.sat = sat;
|
|
}
|
|
|
|
public abstract void Update();
|
|
|
|
public override string ToString()
|
|
{
|
|
return "Light " + id + " is " + (getState() ? "on" : "off");
|
|
}
|
|
}
|
|
}
|