public static MAVLink.mavlink_sys_status_t to_mavlink_sys_status_t(BattStatus bStatus) 
        {
            MAVLink.mavlink_sys_status_t c = new MAVLink.mavlink_sys_status_t() 
            {
                current_battery = (short)bStatus.ptotalcurrent,
                voltage_battery = (ushort)bStatus.pavgvoltage,
                

            };
            return c;
        }
        public void translate(byte[] bytes)
        {
            myMsg = new IPMsg(bytes);

            switch ((MsgType)myMsg.header.msgtype)
            {

                case MsgType.LBL_SEND_2D:
                    if (myMsg.msgbyte.Length != 28)
                        break;
                    myLBLSend2D = new LBLSend2D(myMsg.msgbyte);
                    break;

                case MsgType.PRS_SEND:
                    if (myMsg.msgbyte.Length != 10)
                        break;
                    myPrsSend = new PrsSend(myMsg.msgbyte);
                    break;

                case MsgType.BATT_STATUS:
                    if (myMsg.msgbyte.Length != 36)
                        break;
                    myBattStatus = new BattStatus(myMsg.msgbyte);
                    break;

                case MsgType.NAV_SEND_REL_STATUS:
                    if (myMsg.msgbyte.Length != 96)
                        break;
                    myNavSendRelStatus = new NavSendRelStatus(myMsg.msgbyte);
                    break;

                case MsgType.CPS_SEND:
                    if (myMsg.msgbyte.Length != 62)
                        break;
                    myCpsSend = new CpsSend(myMsg.msgbyte);
                    break;

                case MsgType.CPS_MTI:
                    if (myMsg.msgbyte.Length != 80)
                        break;
                    myCpsMti = new CpsMti(myMsg.msgbyte);
                    break;

                case MsgType.GPS_SEND_2D:
                    if (myMsg.msgbyte.Length != 24)
                        break;
                    myGPSSend2D = new GPSSend2D(myMsg.msgbyte);
                    break;

                case MsgType.GPS_SEND_3D:
                    if (myMsg.msgbyte.Length != 72)
                        break;
                    myGPSSend3D = new GPSSend3D(myMsg.msgbyte);
                    break;

                case MsgType.NAV_SEND_ABS_STATUS:
                    if (myMsg.msgbyte.Length != 96)
                        break;
                    myNavSendAbsStatus = new NavSendAbsStatus(myMsg.msgbyte);
                    break;

                case MsgType.ALTIMETER_DATA:
                    if (myMsg.msgbyte.Length != 20)
                        break;
                    myAltimeterData = new AltimeterData(myMsg.msgbyte);
                    break;

                case MsgType.CTD_SEND:
                    if (myMsg.msgbyte.Length != 40)
                        break;
                    myCtdSend = new CtdSend(myMsg.msgbyte);
                    break;

                case MsgType.SUPERVISION_LEAK:
                    if (myMsg.msgbyte.Length != 4)
                        break;
                    mySupervisionLeak = new SupervisionLeak(myMsg.msgbyte);
                    break;

                case MsgType.PRS_SET_SURF:
                    if (myMsg.msgbyte.Length != 8)
                        break;
                    mytSurf = new tSurf(myMsg.msgbyte);
                    break;

                case MsgType.MOTION_REF:
                    if (myMsg.msgbyte.Length != 60)
                        break;
                    myMotionRef = new MotionRef(myMsg.msgbyte);
                    break;

                case MsgType.SYS_ACK:
                    if (myMsg.msgbyte.Length != 2)
                        break;
                    mySysAck = new SysAck(myMsg.msgbyte);
                    break;

                case MsgType.KLM_SET_POS:
                    if (myMsg.msgbyte.Length != 32)
                        break;
                    myKlmSetPos = new KlmSetPos(myMsg.msgbyte);
                    break;

                case MsgType.KLM_DEAD_RECK:
                    if (myMsg.msgbyte.Length != 16)
                        break;
                    myKlmDeadReck = new KlmDeadReck(myMsg.msgbyte);
                    break;

                case MsgType.KLM_RNG_CRT:
                    if (myMsg.msgbyte.Length != 36)
                        break;
                    myKlmRngCrt = new KlmRngCrt(myMsg.msgbyte);
                    break;

                case MsgType.KLM_MOB_INITIATE:
                    if (myMsg.msgbyte.Length != 56)
                        break;
                    myKlmMobInitiate = new KlmMobInitiate(myMsg.msgbyte);
                    break;

                case MsgType.KLM_MOB_SET_POS:
                    if (myMsg.msgbyte.Length != 24)
                        break;
                    myKlmMobSetPos = new KlmMobSetPos(myMsg.msgbyte);
                    break;

                case MsgType.KLM_MOB_SET_NETWORK:
                    if (myMsg.msgbyte.Length != 32)
                        break;
                    myKlmMobSetNetwork = new KlmMobSetNetwork(myMsg.msgbyte);
                    break;

                case MsgType.LBL_SET_BUOYPOS:
                    if (myMsg.msgbyte.Length != 26)
                        break;
                    myLBLSetBuoyPos = new LBLSetBuoyPos(myMsg.msgbyte);
                    break;

                case MsgType.MIS_START:
                    if (myMsg.msgbyte.Length != 8)
                        break;
                    myMisStart = new MisStart(myMsg.msgbyte);
                    break;

                default:
                    break;

            }

        }