Ejemplo n.º 1
0
        public Lidar(Configuration config, string newIP, int port)
        {
            PORT        = port;
            this.config = config;
            IP          = IPAddress.Parse(newIP);
            IPAddress my = LocalIP.GetLocalIP(LOCAL_IP_TYPE.LIDAR);

            socket = new SocketSync(my, IP, PORT);
        }
Ejemplo n.º 2
0
        private void checkLidar_Click(object sender, EventArgs e)
        {
            Lidar.IP = IPAddress.Parse(epLidar.Text.ToString());
            PingReply pingReplay = PingReply.Send(LocalIP.GetLocalIP(LOCAL_IP_TYPE.LIDAR), Lidar.IP);
            bool      isSuccess  = pingReplay.Status.ToString().Equals("Success");
            string    text       = isSuccess ? "החיבור לחיישן תקין" : "החיישן לא נמצא";

            MessageBox.Show(text, "תוצאות הבדיקה", MessageBoxButtons.OK,
                            isSuccess ? MessageBoxIcon.Information : MessageBoxIcon.Error,
                            MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
        }
Ejemplo n.º 3
0
 // Create Socket Connection with the server.
 // And send to the server configuration for correct display
 private void configServerConnection()
 {
     try {
         bool   isSucceeded           = false;
         int    vehicleWidth          = config.getVehicleWidth();
         int    height                = config.getSensorHeightSetup();
         int    setUpAngle            = config.getAngleSetup();
         float  resolution            = config.getResolution();
         int    startAngle            = config.getStartAngle();
         int    stopAngle             = config.getStopAngle();
         int    sideL                 = config.getSideLowAlert();
         int    sideH                 = config.getSideHighAlert();
         int    FrontL                = config.getFrontLowAlert();
         int    FrontH                = config.getFrontHighAlert();
         int    HoleL                 = config.getHoleLowAlert();
         int    HoleH                 = config.getHoleHighAlert();
         int    minimumHeightDetected = config.getMinimumHeightDetected();
         string srvConfig             = "Config " + vehicleWidth + " " + height + " " +
                                        setUpAngle + " " + resolution + " " + startAngle + " " +
                                        stopAngle + " " + sideL + " " + sideH + " " + FrontL + " " +
                                        FrontH + " " + HoleL + " " + HoleH + " " + minimumHeightDetected;
         IPAddress server = IPAddress.Parse(config.getServerIp());
         IPAddress my     = LocalIP.GetLocalIP(LOCAL_IP_TYPE.INTERNET);
         if (my == null || server == null)
         {
             throw new ProtocolViolationException();
         }
         sendSocket  = new SocketSync(my, server, serverPort, ServerTimeOut);
         isSucceeded = sendSocket.Connect();
         if (isSucceeded)
         {
             isSucceeded = sendSocket.Send(srvConfig, false);
         }
         ServerTimeOut(!isSucceeded);
     } catch (Exception e) {
         Console.WriteLine(e);
     }
 }