X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fled-pattern.vala;h=fe3446cc0f695e860471b591e4ec299d466a891f;hb=4445913670dd11e52e4c9c1a1e78839ec7f76912;hp=25f1ae5f92e93d576a414d7fa585c9fa575c7457;hpb=2aa86ffa70e4ce9848989513d26a41435189a46e;p=led-pattern-ed diff --git a/src/led-pattern.vala b/src/led-pattern.vala index 25f1ae5..fe3446c 100644 --- a/src/led-pattern.vala +++ b/src/led-pattern.vala @@ -16,7 +16,11 @@ * along with LED Pattern Editor. If not, see . */ -class LedPattern : Object { +errordomain LedPatternError { + INVALID_PATTERN; +} + +abstract class LedPattern : Object { enum ScreenOn { DISPLAY_OFF = 0, DISPLAY_ON = 1, @@ -33,6 +37,9 @@ class LedPattern : Object { public double duration; + public abstract string dump (); + public abstract void parse (string line) throws LedPatternError; + public signal void changed (); } @@ -41,8 +48,10 @@ enum CommandType { RESET_MUX, SET_PWM, RAMP_WAIT, - REPEAT, - STOP + GO_TO_START, + BRANCH, + END, + TRIGGER } class LedCommand : Object { @@ -70,6 +79,17 @@ class LedCommand : Object { changed (); } + public virtual void go_to_start () { + type = CommandType.GO_TO_START; + changed (); + } + + public virtual void end (bool reset) { + type = CommandType.END; + steps = reset ? -255 : 0; + changed (); + } + public signal void changed (); }