1 /* This file is part of LED Pattern Editor.
3 * Copyright (C) 2010 Philipp Zabel
5 * LED Pattern Editor is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * LED Pattern Editor is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with LED Pattern Editor. If not, see <http://www.gnu.org/licenses/>.
19 errordomain LedPatternError {
23 abstract class LedPattern : Object {
27 DISPLAY_OFF_ACT_DEAD = 2,
28 DISPLAY_ON_ACT_DEAD = 3,
29 DISPLAY_OFF_OR_ACT_DEAD = 4,
38 public double duration;
40 public abstract string dump ();
41 public abstract void parse (string line) throws LedPatternError;
43 public signal void changed ();
57 class LedCommand : Object {
58 public CommandType type;
60 public double step_time;
61 public double duration;
65 public virtual void set_pwm (int _level) {
66 type = CommandType.SET_PWM;
71 public virtual void ramp_wait (double _step_time, int _steps) {
72 type = CommandType.RAMP_WAIT;
73 step_time = _step_time;
76 duration = step_time * (1 - steps);
78 duration = step_time * (steps + 1);
82 public virtual void go_to_start () {
83 type = CommandType.GO_TO_START;
87 public virtual void end (bool reset) {
88 type = CommandType.END;
89 steps = reset ? -255 : 0;
93 public signal void changed ();