Beispiel #1
0
        public byte[] gen_rtcm(type1002 obs)
        {
            byte[] buffer = new u8[300];

            uint len   = 0;
            uint i     = 0;
            uint nbit  = 0;
            uint nbyte = 0;

            rtcmpreamble pre = new rtcmpreamble();

            pre.Write(buffer);

            rtcmheader head = new rtcmheader();

            head.messageno = 1002;
            head.nsat      = (byte)obs.obs.Count;
            head.epoch     = (u32)obs.obs[0].tow;
            head.Write(buffer);

            nbit = obs.Write(buffer);

            /* padding to align 8 bit boundary */
            for (i = nbit; (i % 8) > 0; i++)
            {
                setbitu(buffer, i, 1, 0);
            }
            /* message length (header+data) (bytes) */
            if ((len = i / 8) >= 3 + 1024)
            {
                /*trace(2,"generate rtcm 3 message length error len=%d\n",rtcm->len-3);*/
                nbit = len = 0;
                return(null);
            }
            /* message length without header and parity */
            setbitu(buffer, 14, 10, len - 3);

            /* crc-24q */
            uint crc = crc24q(buffer, len, 0);

            setbitu(buffer, i, 24, crc);

            /* length total (bytes) */
            nbyte = len + 3;

            Array.Resize <byte>(ref buffer, (int)nbyte);

            return(buffer);
        }
Beispiel #2
0
        public byte[] gen_rtcm(type1002 obs)
        {
            byte[] buffer = new u8[300];

            uint len = 0;
            uint i = 0;
            uint nbit = 0;
            uint nbyte = 0;

            rtcmpreamble pre = new rtcmpreamble();
            pre.Write(buffer);

            rtcmheader head = new rtcmheader();
            head.messageno = 1002;
            head.nsat = (byte)obs.obs.Count;
            head.epoch = (u32)obs.obs[0].tow;
            head.Write(buffer);

            nbit = obs.Write(buffer);

            /* padding to align 8 bit boundary */
            for (i = nbit; (i % 8) > 0; i++)
                setbitu(buffer, i, 1, 0);
            /* message length (header+data) (bytes) */
            if ((len = i / 8) >= 3 + 1024)
            {
                /*trace(2,"generate rtcm 3 message length error len=%d\n",rtcm->len-3);*/
                nbit = len = 0;
                return null;
            }
            /* message length without header and parity */
            setbitu(buffer, 14, 10, len - 3);

            /* crc-24q */
            uint crc = crc24q(buffer, len, 0);
            setbitu(buffer, i, 24, crc);

            /* length total (bytes) */
            nbyte = len + 3;

            Array.Resize<byte>(ref buffer, (int)nbyte);

            return buffer;
        }