namespace PipeTap.Logic {
    public PipeTap.Application app;

    public interface Ctrl : Object  {
        public enum CtrlType {
            Exposure,
            ExposureEnable,
            Contrast,
            ContrastEnable,
            Focus,
            AutoFocusEnable,
        }
        public abstract CtrlType ctrl_type { get; }
        public abstract int value { get; set; }
    }
    public HashTable<string, List<Logic.Ctrl>> ctrls;

    public void init() {
        ctrls = new HashTable<string, List<Logic.Ctrl>> (str_hash, str_equal);
    }

    public Ctrl ? find_ctrl(Ctrl.CtrlType type) {
        if (app.device == null)
            return null;
        foreach (var ctrl in ctrls.get(app.device)) {
            message("%u", ctrl.ctrl_type);
            if (ctrl.ctrl_type == type)
                return ctrl;
        }
        return null;
    }
}