예제 #1
0
        /*
         * 12:02:25.513 T 0DF11300 00 BD 36 FF FF F9 13 56
         * 2021-10-27T12:02:25.513 3   0 255 127251 Rate of Turn:  SID = 0; Rate = -0.09225 deg/s
         * 2021-10-27T12:02:25.513 3 000 255 127251 : 00 bd 36 ff ff f9 13 56
         *
         * 12:02:25.513 T 09F80102 41 B8 3D E9 EB F9 13 56
         * 2021-10-27T12:02:25.513 2   2 255 129025 Position, Rapid Update:(-381831103)   Latitude = -38.1831103(1444149739) ; Longitude = 144.4149739
         * 2021-10-27T12:02:25.513 2 002 255 129025 : 41 b8 3d e9 eb f9 13 56
         *
         * 12:02:25.513 T 0DF80502 E0 2B 00 ED 49 00 5C 73
         * 12:02:25.513 T 0DF80502 E1 0D C0 DB 1F 72 A2 76
         * 12:02:25.513 T 0DF80502 E2 B3 FA 00 08 49 79 89
         * 12:02:25.513 T 0DF80502 E3 A6 0A 14 30 4C 75 FF
         * 12:02:25.513 T 0DF80502 E4 FF FF FF FF 12 FC 13
         * 12:02:25.513 T 0DF80502 E5 46 00 8C 00 8A FD FF
         * 12:02:25.513 T 0DF80502 E6 FF 00 FF FF FF FF FF
         * 2021-10-27T12:02:25.513 3 002 255 129029 : e0 2b 00 ed 49 00 5c 73
         * 2021-10-27T12:02:25.513 3 002 255 129029 : e1 0d c0 db 1f 72 a2 76
         * 2021-10-27T12:02:25.513 3 002 255 129029 : e2 b3 fa 00 08 49 79 89
         * 2021-10-27T12:02:25.513 3 002 255 129029 : e3 a6 0a 14 30 4c 75 ff
         * 2021-10-27T12:02:25.513 3 002 255 129029 : e4 ff ff ff ff 12 fc 13
         * 2021-10-27T12:02:25.513 3 002 255 129029 : e5 46 00 8c 00 8a fd ff
         * 2021-10-27T12:02:25.513 3   2 255 129029 GNSS Position Data:  SID = 0(date 49ed = 18925) ; Date = 2021.10.25(time d735c00 = 225664000) ; Time = 06:16:06.04000(fab376a2721fdbc0 = -381831103324890176) (-381831103) ; Latitude = -38.1831103(140aa68979490800 = 1444149739901224960) (1444149739) ; Longitude = 144.4149739; Altitude = -9.090000 m; GNSS type = GPS+GLONASS; Method = GNSS fix; Integrity = No integrity checking; Number of SVs = 19; HDOP = 0.70; PDOP = 1.40; Geoidal Separation = -6.30 m; Reference Stations = 0
         * 2021-10-27T12:02:25.513 3 002 255 129029 : e6 ff 00 ff ff ff ff ff
         *
         * 12:02:25.513 T 1DF11A02 00 F8 FF FF F6 07 FF FF
         * 2021-10-27T12:02:25.513 7   2 255 127258 Magnetic Variation:  SID = 0; Source = WMM 2020; Age of service = Unknown; Variation = 11.7 deg
         * 2021-10-27T12:02:25.513 7 002 255 127258 : 00 f8 ff ff f6 07 ff ff
         */

        public static object Process(byte[] frame)
        {
            var cf = new CANFrameNMEA(frame.Take(4).Reverse().ToArray());

            var msginfo = NMEA2000msgs.msgs.Where(a => a.Item1 == cf.PDU);

            var msg = Activator.CreateInstance(msginfo.First().Item2) as INMEA2000;

            msg.SetPacketData(frame.Skip(4).ToArray());

            return(null);
        }
예제 #2
0
        public static void runme(string file = @"C:\Users\mich1\OneDrive\2021-10-25 17-16-05.can")
        {
            Regex reg = new Regex("^T(.{8})(.)(.+)(....)$");

            var lines = File.ReadAllLines(file);

            foreach (var line in lines)
            {
                var match = reg.Match(line);
                if (match.Success)
                {
                    // ts prio src dst  pgn
                    var cf = new CANFrameNMEA((match.Groups[1].Value.HexStringToByteArray().Reverse().ToArray()));

                    //       {4} {5} {6} {7}
                    Console.WriteLine("{0} {1} {2} {3}", DateTime.Now.ToString("hh:mm:ss.fff"), "T", match.Groups[1].Value, (match.Groups[3].Value.HexStringToSpacedHex()), cf.Priority, cf.DataPage, cf.PDU, cf.SourceAddress);
                }
            }
        }