예제 #1
0
 public Demuxer(MSDUManager msduManager)
 {
     temporaryStorage = new Dictionary <int, OpenSatelliteProject.GRB.MSDU>();
     buffer           = new byte[0];
     lastAPID         = -1;
     lastFrame        = -1;
     FrameLoss        = 0;
     LengthFails      = 0;
     CRCFails         = 0;
     FrameJumps       = 0;
     Bugs             = 0;
     Packets          = 0;
     this.msduManager = msduManager;
 }
예제 #2
0
        public static void Main(string[] args)
        {
            try {
                Process thisProc = Process.GetCurrentProcess();
                thisProc.PriorityClass = ProcessPriorityClass.RealTime;
            } catch (Exception e) {
                UIConsole.Error($"Failed changing process priority: {e}");
            }

            fileHandlerManager = new FileHandlerManager();
            msduManager        = new MSDUManager(fileHandlerManager);
            channel5           = new ChannelManager(msduManager);
            channel6           = new ChannelManager(msduManager);
            // cn = new Connector();

            channel5.Start();
            channel6.Start();
            msduManager.Start();
            fileHandlerManager.Start();

            UIConsole.GlobalEnableDebug = true;

            /*cn = new Connector ();
             * cn.ChannelDataAvailable += data => {
             *  data = data.Take(2042).ToArray();
             *  int vcid = (data[1] & 0x3F);
             *  if (vcid == 5) {
             *      channel5.NewPacket(data);
             *  } else if (vcid == 6) {
             *      channel6.NewPacket(data);
             *  } else {
             *      UIConsole.Error($"Unknown VCID for GRB: {vcid}");
             *  }
             * };
             * cn.Start ();
             */
            udpReceiver = new UdpReceiver();
            udpReceiver.ChannelDataAvailable += data => {
                data = data.Take(2042).ToArray();
                int vcid = (data[1] & 0x3F);
                if (vcid == 5)
                {
                    channel5.NewPacket(data);
                }
                else if (vcid == 6)
                {
                    channel6.NewPacket(data);
                }
                else if (vcid == 63)
                {
                    // Fill Frame
                }
                else
                {
                    UIConsole.Error($"Unknown VCID for GRB: {vcid}");
                }
            };
            udpReceiver.Start();

            while (true)
            {
                Thread.Sleep(1000);
                Thread.Yield();
            }
        }
예제 #3
0
 public ChannelManager(MSDUManager msduManager)
 {
     packets = new ConcurrentQueue <byte[]>();
     running = false;
     demuxer = new Demuxer(msduManager);
 }