Subversion Repositories Projects

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package dongfang.mkt.frames;

public class VersionResponseFrame extends ResponseFrame {
        /*
         * uint8_t SWMajor;
         * uint8_t SWMinor;
         * uint8_t ProtoMajor;
         * uint8_t ProtoMinor;
         * uint8_t SWPatch;
         * uint8_t Reserved[5];
         */

        private int SWMajor;
        private int SWMinor;
        private int protoMajor;
        private int protoMinor;
        private int SWPatch;
        private int[] hardwareErrors;
        /*
         * hardwareErrors[0] :
         * Pressure sensor (DEFEKT_PRESSURE=0x40),
         *  3 * gyros (DEFEKT_G_NICK=0x1, DEFEKT_G_ROLL=0x2, DEFEKT_G_GIER=0x4),
         *  3 * acc. meters (DEFEKT_A_NICK=0x8, DEFEKT_A_ROLL=0x10, DEFEKT_A_Z=0x20),
         *  carefree (DEFEKT_CAREFREE_ERR=0x80).
         *  Any error bit set prevents motor-on.
         *  hardwareErrors[0] :
         *  Missing motor errors (DEFEKT_MIXER_ERR=0x10),
         *  R/C signal missing (DEFEKT_PPM_ERR=0x8),
         *  I2C error (DEFEKT_I2C=0x1),
         *  I2C timeout (DEFEKT_BL_MISSING=0x2),
         *  SPI error (DEFEKT_SPI_RX_ERR=0x4),
         *  
         */


        public VersionResponseFrame(int address) {
                super(address);
        }

        @Override
        public boolean isResponseTo(RequestFrame r) {
                return r instanceof VersionRequestFrame;
        }

        public int getSWMajor() {
                return SWMajor;
        }

        public void setSWMajor(int major) {
                SWMajor = major;
        }

        public int getSWMinor() {
                return SWMinor;
        }

        public void setSWMinor(int minor) {
                SWMinor = minor;
        }

        public int getProtoMajor() {
                return protoMajor;
        }

        public void setProtoMajor(int protoMajor) {
                this.protoMajor = protoMajor;
        }

        public int getProtoMinor() {
                return protoMinor;
        }

        public void setProtoMinor(int protoMinor) {
                this.protoMinor = protoMinor;
        }

        public int getSWPatch() {
                return SWPatch;
        }

        public void setSWPatch(int patch) {
                SWPatch = patch;
        }

        public int[] getHardwareErrors() {
                return hardwareErrors;
        }

        public void setHardwareErrors(int[] hardwareErrors) {
                this.hardwareErrors= hardwareErrors;
        }
       
        public String toString() {
                return getClass().getSimpleName() + ": SWMajor=" + SWMajor + ", SWMinor=" + SWMinor + ", SWPatch=" + SWPatch + ", protocolMajor="+protoMajor + ", protocolMinor=" + protoMinor;
        }
}