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