Beispiel #1
0
        // Setup the system to server mode
        private void InitializeServerMode()
        {
            lidar = new Lidar(config);
            lidarStatus.Hide();
            lidarStatusLabel.Hide();
            ReplaceIP.Hide();
            IPAddress serverLocalIP;

            using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0)) {
                socket.Connect("8.8.8.8", 65530);
                serverLocalIP = (socket.LocalEndPoint as IPEndPoint).Address;
            }

            clearLog.Location          = new Point(clearLog.Location.X, clearLog.Location.Y - 40);
            saveLog.Location           = new Point(saveLog.Location.X, saveLog.Location.Y - 40);
            serverStatus.Location      = new Point(serverStatus.Location.X, serverStatus.Location.Y - 35);
            serverStatusLabel.Location = new Point(serverStatusLabel.Location.X, serverStatusLabel.Location.Y - 35);
            serverIP.Location          = new Point(serverIP.Location.X, serverIP.Location.Y - 40);
            serverIPLabel.Location     = new Point(serverIPLabel.Location.X, serverIPLabel.Location.Y - 40);
            tableLayoutPanel1.SetColumnSpan(btnTerminal, 3);
            tableLayoutPanel1.SetColumn(btnTerminal, 0);

            receiveSocket = new ServerSocket(serverLocalIP, serverPort, ReceiveResults);
            receiveSocket.StartListening();

            pingThread = new Thread(ServerPing);
            pingThread.IsBackground = true;
            pingThread.Start();
        }
Beispiel #2
0
        private void InitializeDriverMode()
        {
            serverIP.Text = config.getServerIp();
            string lidarIP   = config.getLidarIp();
            string lidarPort = config.getLidarPort();

            lidar = new Lidar(config, lidarIP, int.Parse(lidarPort));
            if (config.getControllerComName() != "כבוי")
            {
                SerialPortConnection();
            }
            if (config.getGPSComName() != "כבוי")
            {
                gps = new GPS(config);
                gps.StartListening(GpsStatus);
                gpsStatusLabel.Text      = gps.getStatus();
                gpsStatusLabel.ForeColor = gps.isFix ? Color.DarkGreen : Color.Red;
            }
            else
            {
                activeAlert.Columns.RemoveAt(1);
                log.Columns.RemoveAt(2);
            }
            if (config.getInterntAdapter() != "כבוי")
            {
                new Thread(configServerConnection).Start();
            }
        }
Beispiel #3
0
 // Decoding the received configuration
 private void DecodeConfigFromDriver(string strConfig)
 {
     /* configArr[0]  = Config key word
      * configArr[1]  = Vehicle Width
      * configArr[2]  = Sensor Height Setup
      * configArr[3]  = Sensor Angle Setup
      * configArr[4]  = Sensor Scan Resolution
      * configArr[5]  = Sensor Start Angle Scanning
      * configArr[6]  = Sensor Stop Angle Scanning
      * configArr[7]  = Side Low Alert
      * configArr[8]  = Side High Alert
      * configArr[9]  = Front Low Alert
      * configArr[10] = Front High Alert
      * configArr[11] = Hole Low Alert
      * configArr[12] = Hole High Alert
      * configArr[13] = Minimum Height Detected
      */
     string[] configArr = strConfig.Split(' ');
     if (configArr.Count() == 14)
     {
         config.setVehicleWidth(int.Parse(configArr[1]));
         config.setSensorHeightSetup(int.Parse(configArr[2]));
         config.setAngleSetup(int.Parse(configArr[3]));
         config.setResolution(float.Parse(configArr[4]));
         config.setStartAngle(int.Parse(configArr[5]));
         config.setStopAngle(int.Parse(configArr[6]));
         config.setSideLowAlert(int.Parse(configArr[7]));
         config.setSideHighAlert(int.Parse(configArr[8]));
         config.setFrontLowAlert(int.Parse(configArr[9]));
         config.setFrontHighAlert(int.Parse(configArr[10]));
         config.setHoleLowAlert(int.Parse(configArr[11]));
         config.setHoleHighAlert(int.Parse(configArr[12]));
         config.setMinimumHeightDetected(int.Parse(configArr[13]));
         Invoke(new MethodInvoker(DistLabelSetup));
     }
     lidar = new Lidar(config);
 }
Beispiel #4
0
 public Terminal(Lidar lidar)
 {
     InitializeComponent();
     this.lidar = lidar;
     openSubMenu(new LidarTerminal(lidar));
 }
Beispiel #5
0
 public LidarTerminal(Lidar lidar)
 {
     InitializeComponent();
     this.lidar = lidar;
 }