Beispiel #1
0
        public AprsFrame(Ax25Frame ax25Frame)
        {
            this.ax25Frame = ax25Frame;

            // first byte of the ax25 info field is the data type ID
            // from the table on page 17 of http://www.aprs.org/doc/APRS101.PDF
        }
Beispiel #2
0
        static void Main()
        {
            CallField call1 = Ax25Frame.DecodeCallsign(StringToByteArray("9A 60 98 A8 8A 40 EA"));
            CallField call2 = Ax25Frame.DecodeCallsign(StringToByteArray("9A 60 98 A8 8A 40 6A"));
            //byte b = (byte)'M';
            //BitArray ba = new BitArray(new[] { b });
            //Console.WriteLine(ba.ToOnesAndZeroes());

            //string frame = "C0    00         AA A2 A4 AC AA A2 60  9A 60 98 A8 8A 40 E0  AE 92 88 8A 62 40 62   AE 92 88 8A 64 40 65                        03 F0   27 77 59 44 6C 20 1C 5B 2F 3E 0D  C0";
            string frame = "C0    00         AA A2 A4 AC AA A2 60  9A 60 98 A8 8A 40 EA  AE 92 88 8A 62 40 62   AE 92 88 8A 64 40 65                          03 F0   27 77 59 44 6C 20 1C 5B 2F 3E 0D  C0";

            //              C0    00         AA A2 A4 AC AA A2 60  9A 60 98 A8 8A 40 EA  AE 92 88 8A 62 40 62   AE 92 88 8A 64 40 65                          03 F0   27 77 59 44 6C 20 1C 5B 2F 3E 0D  C0
            //              C0    00         AA A2 A4 AC AA A2 60  9A 60 98 A8 8A 40 6A  AE 92 88 8A 62 40 62   AE 92 88 8A 64 40 64   9A 60 98 A8 8A 40 73   03 F0   27 77 59 44 6C 20 1C 5B 2F 3E 0D  C0
            //                                                     M0LTE-5           **                                           **
            //              C0    00         AA A2 A4 AC AA A2 E0  9A 60 98 A8 8A 40 EA  AE 92 88 8A 62 40 E2   AE 92 88 8A 64 40 E4 9A 60 98 A8 8A 40 F3 03 F0 27 77 59 44 6C 20 1C 5B 2F 3E 0D C0

            byte[] frameBytes = StringToByteArray(frame);

            Ax25Frame.TryParse(frameBytes, out Ax25Frame f);
            byte[] kf = f.ToKissFrame();
            string s2 = kf.ToHexString();

            Ax25Frame.TryParse(StringToByteArray(s2), out Ax25Frame f2);

            //Process(frameBytes);

            Debugger.Break();
        }
Beispiel #3
0
        public static ParseResult TryParse(byte[] kissFrame, out Ax25Frame ax25Frame)
        {
            ax25Frame = null;

            if (kissFrame[0] != 0xc0 || kissFrame[1] != 0x00)
            {
                return(new ParseResult {
                    FailReason = String.Format("Not a KISS frame, expected c0 00, got {0:X2} {1:X2}", kissFrame[0], kissFrame[1])
                });
            }

            if (kissFrame.Last() != 0xc0)
            {
                return(new ParseResult {
                    FailReason = String.Format("Frame looks incomplete, expected c0 at end, got {0:X2}", kissFrame.Last())
                });
            }

            ax25Frame        = new Ax25Frame();
            ax25Frame.Source = DecodeCallsign(getSourceBytes(kissFrame));
            ax25Frame.Dest   = DecodeCallsign(getDestBytes(kissFrame));

            byte[][] digis = getDigis(kissFrame);
            foreach (byte[] digiField in digis)
            {
                CallField call = DecodeCallsign(digiField);
                Debug.WriteLine(call);
                ax25Frame.Digis.Add(call);
            }

            ax25Frame.InfoBytes = getInfo(kissFrame);
            ax25Frame.Info      = Encoding.ASCII.GetString(ax25Frame.InfoBytes);

            return(new ParseResult {
                Result = true
            });
        }