コード例 #1
0
        private void BroadcastTimerOnElapsed(object arg)
        {
            UdpManager tempUdpManager = UdpManager.GetInstance();

            tempUdpManager.Send(IPAddress.Broadcast, BroadcastPort, contentTcp);
            tempUdpManager.Send(IPAddress.Broadcast, BroadcastPort, contentUdp);
        }
コード例 #2
0
        public void Start()
        {
            UdpManager tempUdpManager = UdpManager.GetInstance();

            _udpClient = new UdpClient(new IPEndPoint(tempUdpManager.HostIpAddress, receiveImgPort));
            _udpClient.Client.ReceiveBufferSize = 10000000;
            _receiveThread = new Thread(Receive);
            _receiveThread.IsBackground = true;
            _receiveThread.Start();
        }
コード例 #3
0
            public void Init()
            {
                //Set the local UDP port
                UdpManager tempUdpManager = UdpManager.GetInstance();

                tempUdpManager.InitUdp(localPort, UdpReceiveCommand);

                //Generate the broadcast info
                _contentTcp = ("Server" + Separator + tempUdpManager.HostIpAddress + Separator + TcpServer.GetInstance().ServerPort + Separator + Environment.NewLine);

                //Set the timer
                TimerManager tempTimerManager = TimerManager.GetInstance();

                _timerGuid = tempTimerManager.AddTimer(BroadcastTimerOnElapsed, null, 0, 1000);
            }
コード例 #4
0
ファイル: Program.cs プロジェクト: twoentartian/TDPS2017
        static void Main(string[] args)
        {
            #region Camera
            RaspberryCamera tempCamera = RaspberryCamera.GetInstance();
            tempCamera.StartStreaming(pictureSize, fps);
            Console.WriteLine("Init Camera --- success");
            #endregion

            #region Init UDP manager

            Console.Write("Init UDP manager");
            UdpManager tempUdpManager = UdpManager.GetInstance();
            tempUdpManager.InitUdp(LocalUdpPort, InterNetwork.UdpListenTaskDelegate);
            Console.WriteLine(" --- success");

            #endregion

            #region Init Serial Manager

            Console.Write("Init SERIAL manager ");
            SerialManager tempSerialManager = SerialManager.GetInstance();
            while (true)
            {
                string[] ports    = SerialManager.GetAllVaildPorts();
                bool     signFind = false;
                foreach (string i in ports)
                {
                    if (i.Contains("USB"))
                    {
                        SerialManager.SerialPortWithGuid portWithGuid = tempSerialManager.Add(i, BaudRate, Parity.None, RaspberrySerial.TargetDataReceivedEventHandler);
                        RaspberrySerial.PortGuid = portWithGuid.Guid;
                        RaspberrySerial.StartReceive(portWithGuid.Serial);
                        Console.Write("Select" + i);
                        signFind = true;
                        break;
                    }
                }
                if (!signFind)
                {
                    Console.WriteLine("The system is waiting for a serial port device");
                    Thread.Sleep(1000);
                }
                else
                {
                    break;
                }
            }
            Console.WriteLine(" --- success");
            #endregion
            if (Debugger.IsAttached)
            {
                while (true)
                {
                    Thread.Sleep(1000);
                }
            }

            Console.ReadLine();
            tempCamera.StopStreaming();
            StateManager.GetInstance().FindServer = false;
            tempSerialManager.GetPort(RaspberrySerial.PortGuid).Serial.Dispose();
            Environment.Exit(0);
        }
コード例 #5
0
        public void BroadcastToInterNetwork(string data)
        {
            UdpManager tempUdpManager = UdpManager.GetInstance();

            tempUdpManager.Send(IPAddress.Broadcast, BroadcastPort, data);
        }