Subversion Repositories group.electronics

Rev

Rev 162 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
161 pfowler 1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
 
7
namespace nitdcscore {
8
    public abstract class Command {
9
        public uint value { get; set; }
10
 
11
        public Command() {
12
            value = 0;
13
        }
14
        public abstract int Send();
15
        public abstract int Send(uint value);
16
 
17
    }
18
 
19
    public class CommandDCS : Command {
20
        public String cmd { get; set; }
21
 
22
        public CommandDCS()
23
            : base() {
24
            this.cmd = "";
25
        }
26
 
27
        public CommandDCS(String cmd)
28
            : base() {
29
            this.cmd = cmd;
30
        }
31
 
32
        public override int Send() {
33
            if (this.cmd.Equals(""))
34
                return -1;
35
 
36
            return Globals.bios.SendData(this.ToString());
37
        }
38
 
39
        public override int Send(uint value) {
40
            if (this.cmd.Equals(""))
41
                return -1;
42
 
43
            this.value = value;
44
 
45
            return Globals.bios.SendData(this.ToString());
46
        }
47
 
48
        public override string ToString() {
49
            return cmd + " " + base.value + "\n";
50
        }
51
    }
52
}