Subversion Repositories Projects

Rev

Rev 1540 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1540 - 1
package dongfang.mkt.frames;
2
 
3
public class VersionResponseFrame extends ResponseFrame {
4
        /*
5
         * uint8_t SWMajor;
6
         * uint8_t SWMinor;
7
         * uint8_t ProtoMajor;
8
         * uint8_t ProtoMinor;
9
         * uint8_t SWPatch;
10
         * uint8_t Reserved[5];
11
         */
12
        private int SWMajor;
13
        private int SWMinor;
14
        private int protoMajor;
15
        private int protoMinor;
16
        private int SWPatch;
17
        private int[] hardwareErrors;
18
        /*
19
         * hardwareErrors[0] :
20
         * Pressure sensor (DEFEKT_PRESSURE=0x40),
21
         *  3 * gyros (DEFEKT_G_NICK=0x1, DEFEKT_G_ROLL=0x2, DEFEKT_G_GIER=0x4),
22
         *  3 * acc. meters (DEFEKT_A_NICK=0x8, DEFEKT_A_ROLL=0x10, DEFEKT_A_Z=0x20),
23
         *  carefree (DEFEKT_CAREFREE_ERR=0x80).
24
         *  Any error bit set prevents motor-on.
25
         *  hardwareErrors[0] :
26
         *  Missing motor errors (DEFEKT_MIXER_ERR=0x10),
27
         *  R/C signal missing (DEFEKT_PPM_ERR=0x8),
28
         *  I2C error (DEFEKT_I2C=0x1),
29
         *  I2C timeout (DEFEKT_BL_MISSING=0x2),
30
         *  SPI error (DEFEKT_SPI_RX_ERR=0x4),
31
         *  
32
         */
33
 
34
        public VersionResponseFrame(int address) {
35
                super(address);
36
        }
37
 
38
        @Override
39
        public boolean isResponseTo(RequestFrame r) {
40
                return r instanceof VersionRequestFrame;
41
        }
42
 
43
        public int getSWMajor() {
44
                return SWMajor;
45
        }
46
 
47
        public void setSWMajor(int major) {
48
                SWMajor = major;
49
        }
50
 
51
        public int getSWMinor() {
52
                return SWMinor;
53
        }
54
 
55
        public void setSWMinor(int minor) {
56
                SWMinor = minor;
57
        }
58
 
59
        public int getProtoMajor() {
60
                return protoMajor;
61
        }
62
 
63
        public void setProtoMajor(int protoMajor) {
64
                this.protoMajor = protoMajor;
65
        }
66
 
67
        public int getProtoMinor() {
68
                return protoMinor;
69
        }
70
 
71
        public void setProtoMinor(int protoMinor) {
72
                this.protoMinor = protoMinor;
73
        }
74
 
75
        public int getSWPatch() {
76
                return SWPatch;
77
        }
78
 
79
        public void setSWPatch(int patch) {
80
                SWPatch = patch;
81
        }
82
 
83
        public int[] getHardwareErrors() {
84
                return hardwareErrors;
85
        }
86
 
87
        public void setHardwareErrors(int[] hardwareErrors) {
88
                this.hardwareErrors= hardwareErrors;
89
        }
90
 
91
        public String toString() {
1698 - 92
                StringBuilder result = new StringBuilder();
93
                result.append("SW=" + SWMajor + "." + SWMinor + "." + SWPatch + ", protocol=" + protoMajor + "." + protoMinor);
94
                result.append();
1540 - 95
        }
96
}