Subversion Repositories Projects

Rev

Rev 1540 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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