Rev 1698 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1541 | - | 1 | package dongfang.mkt.frames; |
2 | |||
3 | import java.io.IOException; |
||
4 | |||
1566 | - | 5 | import dongfang.mkt.RequestFrameVisitor; |
1541 | - | 6 | |
7 | public class ExternalControlRequestFrame extends RequestFrame { |
||
8 | public static final int COMMAND_NONE = 0; |
||
1699 | - | 9 | public static final int COMMAND_GYROCAL = 1; |
10 | public static final int COMMAND_ACCCAL = 2; |
||
11 | public static final int COMMAND_GYRO_ACC_CAL = 3; |
||
12 | public static final int COMMAND_STOP = 10; |
||
13 | public static final int COMMAND_START = 11; |
||
1541 | - | 14 | |
15 | int[] digital = new int[2];// unsigned byte. |
||
16 | int remoteButtons; // unsigned byte. |
||
17 | int pitch; // signed byte. |
||
18 | int roll; // signed byte. |
||
19 | int yaw; // signed byte. |
||
20 | int throttle; // unsigned byte. |
||
21 | int height; // signed byte (!). |
||
22 | int command; // unsigned byte. Called "free" in MK code. |
||
23 | int frameNum; // unsigned byte. |
||
24 | int argument; // unsigned byte. Called "config" in MK code. |
||
25 | |||
1698 | - | 26 | public ExternalControlRequestFrame() { |
27 | super(FC_ADDRESS); |
||
1541 | - | 28 | } |
29 | |||
30 | public int[] getDigital() { |
||
31 | return digital; |
||
32 | } |
||
33 | |||
34 | public void setDigital(int[] digital) { |
||
35 | this.digital = digital; |
||
36 | } |
||
37 | |||
38 | public int getRemoteButtons() { |
||
39 | return remoteButtons; |
||
40 | } |
||
41 | |||
42 | public void setRemoteButtons(int remoteButtons) { |
||
43 | this.remoteButtons = remoteButtons; |
||
44 | } |
||
45 | |||
46 | public int getPitch() { |
||
47 | return pitch; |
||
48 | } |
||
49 | |||
50 | public void setPitch(int pitch) { |
||
51 | this.pitch = pitch; |
||
52 | } |
||
53 | |||
54 | public int getRoll() { |
||
55 | return roll; |
||
56 | } |
||
57 | |||
58 | public void setRoll(int roll) { |
||
59 | this.roll = roll; |
||
60 | } |
||
61 | |||
62 | public int getYaw() { |
||
63 | return yaw; |
||
64 | } |
||
65 | |||
66 | public void setYaw(int yaw) { |
||
67 | this.yaw = yaw; |
||
68 | } |
||
69 | |||
70 | public int getThrottle() { |
||
71 | return throttle; |
||
72 | } |
||
73 | |||
74 | public void setThrottle(int throttle) { |
||
75 | this.throttle = throttle; |
||
76 | } |
||
77 | |||
78 | public int getHeight() { |
||
79 | return height; |
||
80 | } |
||
81 | |||
82 | public void setHeight(int height) { |
||
83 | this.height = height; |
||
84 | } |
||
85 | |||
86 | public int getCommand() { |
||
87 | return command; |
||
88 | } |
||
89 | |||
90 | public void setCommand(int command) { |
||
91 | this.command = command; |
||
92 | } |
||
93 | |||
94 | public int getFrameNum() { |
||
95 | return frameNum; |
||
96 | } |
||
97 | |||
98 | public void setFrameNum(int frameNum) { |
||
99 | this.frameNum = frameNum; |
||
100 | } |
||
101 | |||
102 | public int getArgument() { |
||
103 | return argument; |
||
104 | } |
||
105 | |||
106 | public void setArgument(int argument) { |
||
107 | this.argument = argument; |
||
108 | } |
||
109 | |||
110 | public void start() { |
||
111 | command = COMMAND_START; |
||
112 | } |
||
113 | |||
114 | public void stop() { |
||
115 | command = COMMAND_STOP; |
||
116 | } |
||
117 | |||
118 | public void gyroCal() { |
||
119 | command = COMMAND_GYROCAL; |
||
120 | } |
||
121 | |||
122 | public void accCal() { |
||
123 | command = COMMAND_ACCCAL; |
||
124 | } |
||
125 | |||
126 | @Override |
||
127 | public void accept(RequestFrameVisitor o) throws IOException { |
||
128 | o.visit(this); |
||
129 | } |
||
130 | } |