コード例 #1
0
        public AisMessage CreateMessage(BitArray payload)
        {
            var type = payload.DecodeByte(0, 5);

            if (type != c_type)
            {
                throw new Exception(string.Format("Incorrect type, expected 19 but present:{0}", type));
            }

            var         timeStamp         = DateTime.UtcNow.ToFileTimeUtc();
            byte        repeatIndicator   = payload.DecodeByte(6, 7);
            uint        mmsi              = payload.DecodeUInt32(8, 37);
            float       sog               = (float)payload.DecodeUInt32(46, 55) / 10;
            bool        posAccuracy       = payload.DecodeBool(56);
            float       longtitude        = (float)payload.DecodeFloat(57, 84) / 600000;
            float       latitude          = (float)payload.DecodeFloat(85, 111) / 600000;
            float       cog               = (float)payload.DecodeUInt32(112, 123) / 10;
            ushort      heading           = payload.DecodeUShort(124, 132);
            byte        utcSeconds        = payload.DecodeByte(133, 138);
            string      vesselName        = payload.DecodeString(143, 262).Trim();
            ShipType    shipType          = (ShipType)payload.DecodeByte(263, 270);
            uint        bow               = payload.DecodeUInt32(271, 279);
            uint        stern             = payload.DecodeUInt32(280, 288);
            byte        port              = payload.DecodeByte(289, 294);
            byte        starboard         = payload.DecodeByte(295, 300);
            EpfdFixType positionFixType   = (EpfdFixType)payload.DecodeByte(301, 304);
            bool        raim              = payload.DecodeBool(305);
            bool        dataTerminalReady = payload.DecodeBool(306);
            bool        assigned          = payload.DecodeBool(307);
            byte        spare             = payload.DecodeByte(308, 311);

            return(new ClassBExtendedPositionReportMessage(
                       type,
                       timeStamp,
                       repeatIndicator,
                       mmsi,
                       sog,
                       posAccuracy,
                       longtitude,
                       latitude,
                       cog,
                       heading,
                       utcSeconds,
                       vesselName,
                       shipType,
                       bow,
                       stern,
                       port,
                       starboard,
                       positionFixType,
                       raim,
                       dataTerminalReady,
                       assigned,
                       spare));
        }
コード例 #2
0
        public AisMessage CreateMessage(BitArray payload)
        {
            var type = payload.DecodeByte(0, 5);

            if (type != c_type)
            {
                throw new Exception(string.Format("Incorrect type, expected 18 but present:{0}", type));
            }

            var  timeStamp       = DateTime.UtcNow.ToFileTimeUtc();
            byte repeatIndicator = payload.DecodeByte(6, 7);
            uint mmsi            = payload.DecodeUInt32(8, 37);


            float      sog         = (float)payload.DecodeUInt32(46, 55) / 10;
            bool       posAccuracy = payload.DecodeBool(56);
            float      longtitude  = (float)payload.DecodeFloat(57, 84) / 600000;
            float      latitude    = (float)payload.DecodeFloat(85, 111) / 600000;
            float      cog         = (float)payload.DecodeUInt32(112, 123) / 10;
            ushort     heading     = payload.DecodeUShort(124, 132);
            byte       utcSeconds  = payload.DecodeByte(133, 138);
            CsUnitType csUnit      = payload.DecodeBool(141) ? CsUnitType.ClassBCarrierSense : CsUnitType.ClassBSotdma;
            bool       display     = payload.DecodeBool(142);
            bool       dsc         = payload.DecodeBool(143);
            bool       band        = payload.DecodeBool(144);
            bool       message22   = payload.DecodeBool(145);
            bool       assigned    = payload.DecodeBool(146);
            bool       raim        = payload.DecodeBool(147);
            uint       radioStatus = payload.DecodeUInt32(148, 167);

            return(new ClassBPositionReportMessage(
                       type,
                       timeStamp,
                       repeatIndicator,
                       mmsi,
                       sog,
                       posAccuracy,
                       longtitude,
                       latitude,
                       cog,
                       heading,
                       utcSeconds,
                       raim,
                       radioStatus,
                       csUnit,
                       display,
                       dsc,
                       band,
                       message22,
                       assigned));
        }
コード例 #3
0
        public AisMessage CreateMessage(BitArray payload)
        {
            var type = payload.DecodeByte(0, 5);

            if (type != c_type1)
            {
                throw new Exception($"Incorrect type, expected 4 but present:{type}");
            }

            var         timeStamp       = DateTime.UtcNow.ToFileTimeUtc();
            byte        repeatIndicator = payload.DecodeByte(6, 7);
            uint        mmsi            = payload.DecodeUInt32(8, 37);
            uint        year            = payload.DecodeUInt32(38, 51);
            byte        month           = payload.DecodeByte(52, 55);
            byte        day             = payload.DecodeByte(56, 60);
            byte        hour            = payload.DecodeByte(61, 65);
            byte        minute          = payload.DecodeByte(66, 71);
            byte        second          = payload.DecodeByte(72, 77);
            bool        posAccuracy     = payload.DecodeBool(78);
            float       longtitude      = (float)payload.DecodeFloat(79, 106) / 600000;
            float       latitude        = (float)payload.DecodeFloat(107, 133) / 600000;
            EpfdFixType positionFixType = (EpfdFixType)payload.DecodeByte(134, 137);
            bool        raim            = payload.DecodeBool(148);
            uint        radioStatus     = payload.DecodeUInt32(149, 167);



            return(new BaseStationReportMessage(
                       type,
                       timeStamp,
                       repeatIndicator,
                       mmsi,
                       year,
                       month,
                       day,
                       hour,
                       minute,
                       second,
                       posAccuracy,
                       longtitude,
                       latitude,
                       positionFixType,
                       raim,
                       radioStatus));
        }
コード例 #4
0
        public AisMessage CreateMessage(BitArray payload)
        {
            var type = payload.DecodeByte(0, 5);

            if (type != c_type1 && type != c_type2 && type != c_type3)
            {
                throw new Exception(string.Format("Incorrect type, expected 1,2,3 but present:{0}", type));
            }

            var               timeStamp        = DateTime.UtcNow.ToFileTimeUtc();
            byte              repeatIndicator  = payload.DecodeByte(6, 7);
            uint              mmsi             = payload.DecodeUInt32(8, 37);
            NavigationStatus  navStatus        = (NavigationStatus)payload.DecodeByte(38, 41);
            int               rot              = payload.DecodeInt32(42, 49);
            float             sog              = (float)payload.DecodeUInt32(50, 59) / 10;
            bool              posAccuracy      = payload.DecodeBool(60);
            float             longtitude       = (float)payload.DecodeFloat(61, 88) / 600000;
            float             latitude         = (float)payload.DecodeFloat(89, 115) / 600000;
            float             cog              = (float)payload.DecodeUInt32(116, 127) / 10;
            ushort            heading          = payload.DecodeUShort(128, 136);
            byte              utcSeconds       = payload.DecodeByte(137, 142);
            ManeuverIndicator manuevrIndicator = (ManeuverIndicator)payload.DecodeByte(143, 144);
            byte              spare            = payload.DecodeByte(145, 147);
            bool              raim             = payload.DecodeBool(148);
            uint              radioStatus      = payload.DecodeUInt32(149, 167);

            return(new ClassAPositionReportMessage(
                       type,
                       timeStamp,
                       repeatIndicator,
                       mmsi,
                       navStatus,
                       rot,
                       sog,
                       posAccuracy,
                       longtitude,
                       latitude,
                       cog,
                       heading,
                       utcSeconds,
                       manuevrIndicator,
                       spare,
                       raim,
                       radioStatus));
        }
コード例 #5
0
        public AisMessage CreateMessage(BitArray payload)
        {
            var type = payload.DecodeByte(0, 5);

            if (type != c_type1)
            {
                throw new Exception(string.Format("Incorrect type, expected 27 but present:{0}", type));
            }

            var              timeStamp       = DateTime.UtcNow.ToFileTimeUtc();
            byte             repeatIndicator = payload.DecodeByte(6, 7);
            uint             mmsi            = payload.DecodeUInt32(8, 37);
            bool             posAccuracy     = payload.DecodeBool(38);
            bool             raim            = payload.DecodeBool(39);
            NavigationStatus navStatus       = (NavigationStatus)payload.DecodeByte(40, 43);
            float            longtitude      = (float)payload.DecodeFloat(44, 61) / 600000;
            float            latitude        = (float)payload.DecodeFloat(62, 78) / 600000;
            float            sog             = (float)payload.DecodeUInt32(79, 84) / 10;
            float            cog             = (float)payload.DecodeUInt32(85, 93) / 10;
            bool             gnss            = payload.DecodeBool(94);
            bool             spare           = payload.DecodeBool(95);



            return(new ClassAPositionReportLongRangeMessage(
                       type,
                       timeStamp,
                       repeatIndicator,
                       mmsi,
                       posAccuracy,
                       raim,
                       navStatus,
                       longtitude,
                       latitude,
                       sog,
                       cog,
                       gnss,
                       spare));
        }