Example #1
0
        //--------
        //-------- Event methods
        //--------

        /// <summary>
        /// Add a listener, to be notified of arrivals, departures, and exceptions.
        /// </summary>
        /// <param name="dmel"> Listener of monitor events. </param>
        public virtual void addDeviceMonitorEventListener(DeviceMonitorEventListener dmel)
        {
            if (dmel != null)
            {
                this.listeners.Add(dmel);
            }
        }
Example #2
0
        /// <summary>
        /// Notify the listeners of the departure event
        /// </summary>
        /// <param name="address"> Vector of Long objects representing the address of
        /// departed devices. </param>
        protected internal virtual void fireDepartureEvent(DSPortAdapter adapter, List <long> address)
        {
            DeviceMonitorEvent dme = new DeviceMonitorEvent(DeviceMonitorEvent.DEPARTURE, this, adapter, address);

            for (int i = 0; i < listeners.Count; i++)
            {
                DeviceMonitorEventListener listener = (DeviceMonitorEventListener)listeners[i];
                listener.deviceDeparture(dme);
            }
        }
Example #3
0
        /// <summary>
        /// Notify the listeners of the arrival event
        /// </summary>
        /// <param name="address"> Vector of Long objects representing the address of new
        /// arrivals. </param>
        protected internal virtual void fireArrivalEvent(DSPortAdapter adapter, List <long> address)
        {
            DeviceMonitorEvent dme = new DeviceMonitorEvent(DeviceMonitorEvent.ARRIVAL, this, adapter, address);

            for (int i = 0; i < listeners.Count; i++)
            {
                DeviceMonitorEventListener listener = (DeviceMonitorEventListener)listeners[i];
                listener.deviceArrival(dme);
            }
        }