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