Esempio n. 1
0
 /// <summary>
 /// Notifies listeners that a device left this Radar's network.
 /// </summary>
 /// <param name="device">The device.</param>
 protected void RaiseDeviceLeft(SocketDevice device)
 {
     if (DevicesChanged != null)
     {
         DevicesChanged(this, RadarEvent.DEVICE_LEFT, device);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Notifies listeners that a device entered this Radar's network.
 /// </summary>
 /// <param name="device">The device.</param>
 protected void RaiseDeviceEntered(SocketDevice device)
 {
     if (DevicesChanged != null)
     {
         DevicesChanged(this, RadarEvent.DEVICE_ENTERED, device);
     }
 }
Esempio n. 3
0
 public TCPServerConnection(SocketDevice networkDevice)
     : base(networkDevice)
 {
     tcpListener = new TcpListener(new IPEndPoint(IPAddress.Any, networkDevice.port));
     tcpListener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
     tcpListener.Start();
     running = true;
 }
Esempio n. 4
0
        private void CheckLeftDevices()
        {
            lastAddresses.RemoveWhere(a => knownAddresses.Contains(a));
            foreach (var address in lastAddresses)
            {
                SocketDevice left = new SocketDevice(address, port, EthernetConnectionType.TCP);
                RaiseDeviceLeft(left);
            }

            lastAddresses  = knownAddresses;
            knownAddresses = new HashSet <string>();
        }
Esempio n. 5
0
        private void OnRadarEvent(object sender, RadarEvent type, SocketDevice device)
        {
            logger.Log(type.ToString() + ": " + device.networkDeviceName);
            switch (type)
            {
            case RadarEvent.DEVICE_ENTERED:
                deviceManager.DeviceEntered(device);
                break;

            case RadarEvent.DEVICE_LEFT:
                deviceManager.DeviceLeft(device);
                break;
            }
        }
Esempio n. 6
0
        private void OnRadarEvent(object sender, RadarEvent type, SocketDevice device)
        {
            logger.Log(type.ToString() + ": " + device.networkDeviceName);
            switch (type)
            {
                case RadarEvent.DEVICE_ENTERED:
                    deviceManager.DeviceEntered(device);
                    break;

                case RadarEvent.DEVICE_LEFT:
                    deviceManager.DeviceLeft(device);
                    break;
            }
        }
Esempio n. 7
0
        private void CheckLeftDevices()
        {
            lastAddresses.RemoveWhere(a => knownAddresses.Contains(a));
            foreach (var address in lastAddresses)
            {
                SocketDevice left = new SocketDevice(address, port, EthernetConnectionType.TCP);
                RaiseDeviceLeft(left);
            }

            lastAddresses = knownAddresses;
            knownAddresses = new HashSet<string>();
        }
Esempio n. 8
0
 /// <summary>
 /// Notifies listeners that a device left this Radar's network.
 /// </summary>
 /// <param name="device">The device.</param>
 protected void RaiseDeviceLeft(SocketDevice device)
 {
     if (DevicesChanged != null)
         DevicesChanged(this, RadarEvent.DEVICE_LEFT, device);
 }
Esempio n. 9
0
 /// <summary>
 /// Notifies listeners that a device entered this Radar's network.
 /// </summary>
 /// <param name="device">The device.</param>
 protected void RaiseDeviceEntered(SocketDevice device)
 {
     if (DevicesChanged != null)
         DevicesChanged(this, RadarEvent.DEVICE_ENTERED, device);
 }