Subversion Repositories group.electronics

Rev

Rev 162 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace nitdcscore {
    public abstract class Command {
        public uint value { get; set; }

        public Command() {
            value = 0;
        }
        public abstract int Send();
        public abstract int Send(uint value);

    }

    public class CommandDCS : Command {
        public String cmd { get; set; }

        public CommandDCS()
            : base() {
            this.cmd = "";
        }

        public CommandDCS(String cmd)
            : base() {
            this.cmd = cmd;
        }

        public override int Send() {
            if (this.cmd.Equals(""))
                return -1;

            return Globals.bios.SendData(this.ToString());
        }

        public override int Send(uint value) {
            if (this.cmd.Equals(""))
                return -1;

            this.value = value;

            return Globals.bios.SendData(this.ToString());
        }

        public override string ToString() {
            return cmd + " " + base.value + "\n";
        }
    }
}