Subversion Repositories group.electronics

Rev

Rev 165 | Rev 167 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 165 Rev 166
Line 5... Line 5...
5
using System.Threading.Tasks;
5
using System.Threading.Tasks;
6
using WindowsInput.Native;
6
using WindowsInput.Native;
7
 
7
 
8
namespace nitdcscore {
8
namespace nitdcscore {
9
    public abstract class Command {
9
    public abstract class Command {
10
        public uint value { get; set; }
10
        public UInt64 value { get; set; }
11
        public nitdcscore.Utils.InputPair data { get; set; }
11
        public nitdcscore.Utils.InputPair data { get; set; }
12
 
12
 
13
        public Command() {
13
        public Command() {
14
            value = 0;
14
            value = 0;
15
        }
15
        }
16
        public abstract int Send();
16
        public abstract int Send();
17
        public abstract int Send(uint value);
17
        public abstract int Send(UInt64 value);
18
 
18
 
19
    }
19
    }
20
 
20
 
21
    public class CommandDCS : Command {
21
    public class CommandDCS : Command {
22
        public String cmd { get; set; }
22
        public String cmd { get; set; }
23
 
23
 
24
        public CommandDCS()
24
        public CommandDCS() : base() {
25
            : base() {
-
 
26
            this.cmd = "";
25
            this.cmd = "";
27
        }
26
        }
28
 
27
 
29
        public CommandDCS(String cmd)
28
        public CommandDCS(String cmd) : base() {
30
            : base() {
-
 
31
            this.cmd = cmd;
29
            this.cmd = cmd;
32
        }
30
        }
33
 
31
 
34
        public override int Send() {
32
        public override int Send() {
35
            if (this.cmd.Equals(""))
33
            if (this.cmd.Equals(""))
36
                return -1;
34
                return -1;
37
 
35
 
38
            return Globals.bios.SendData(this.ToString());
36
            return Globals.bios.SendData(this.ToString());
39
        }
37
        }
40
 
38
 
41
        public override int Send(uint value) {
39
        public override int Send(UInt64 value) {
42
            if (this.cmd.Equals(""))
40
            if (this.cmd.Equals(""))
43
                return -1;
41
                return -1;
44
 
42
 
45
            this.value = value;
43
            this.value = value;
46
            Globals.bios.SendData(this.ToString());
44
            Globals.bios.SendData(this.ToString());
Line 68... Line 66...
68
                return 0;
66
                return 0;
69
            }
67
            }
70
            return 1;
68
            return 1;
71
        }
69
        }
72
 
70
 
73
        public override int Send(uint value) {
71
        public override int Send(UInt64 value) {
74
            this.value = value;
72
            this.value = value;
75
            return this.Send();
73
            return this.Send();
76
        }
74
        }
77
 
75
 
78
        public override string ToString() {
76
        public override string ToString() {
Line 119... Line 117...
119
                    break;
117
                    break;
120
            }
118
            }
121
            return 0;
119
            return 0;
122
        }
120
        }
123
 
121
 
124
        public override int Send(uint value) {
122
        public override int Send(UInt64 value) {
125
            this.value = value;
123
            this.value = value;
126
            return this.Send();
124
            return this.Send();
127
        }
125
        }
128
 
126
 
129
        public override string ToString() {
127
        public override string ToString() {
Line 149... Line 147...
149
                return 0;
147
                return 0;
150
            }
148
            }
151
            return 1;
149
            return 1;
152
        }
150
        }
153
 
151
 
154
        public override int Send(uint value) {
152
        public override int Send(UInt64 value) {
155
            this.value = value;
153
            this.value = value;
156
            return this.Send();
154
            return this.Send();
157
        }
155
        }
158
 
156
 
159
        public override string ToString() {
157
        public override string ToString() {
Line 174... Line 172...
174
            Command cmd;
172
            Command cmd;
175
            
173
            
176
            ctl.data = this.data;
174
            ctl.data = this.data;
177
            ctl.Tick();
175
            ctl.Tick();
178
 
176
 
179
            if (opts.TryGetValue(ctl.value, out cmd)) {
177
            if (opts.TryGetValue((uint)ctl.value, out cmd)) {
180
                cmd.value = this.value;
178
                cmd.value = this.value;
181
                cmd.data = this.data;
179
                cmd.data = this.data;
182
                cmd.Send(this.value);
180
                cmd.Send(this.value);
183
                Console.Write(cmd.ToString());
181
                Console.Write(cmd.ToString());
184
                return 0;
182
                return 0;
185
            }
183
            }
186
            return 1;
184
            return 1;
187
        }
185
        }
188
 
186
 
189
        public override int Send(uint value) {
187
        public override int Send(UInt64 value) {
190
            this.value = value;
188
            this.value = value;
191
            return this.Send();
189
            return this.Send();
192
        }
190
        }
193
 
191
 
194
        public override string ToString() {
192
        public override string ToString() {