예제 #1
0
        /**
         * Notifies subscribed IO sample listeners that a new IO sample packet has
         * been received.
         *
         * @param ioSample The received IO sample.
         * @param remoteDevice The remote XBee device that sent the sample.
         *
         * @see com.digi.xbee.api.RemoteXBeeDevice
         * @see com.digi.xbee.api.io.IOSample
         */
        private void NotifyIOSampleReceived(RemoteXBeeDevice remoteDevice, IOSample ioSample)
        {
            logger.Debug(connectionInterface.ToString() + "IO sample received.");

            try
            {
                lock (IOSampleReceived)
                {
                    var handler = IOSampleReceived;
                    if (handler != null)
                    {
                        var args = new IOSampleReceivedEventArgs(remoteDevice, ioSample);

                        handler.GetInvocationList().AsParallel().ForAll((action) =>
                        {
                            action.DynamicInvoke(this, args);
                        });
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
            }
        }
예제 #2
0
        /**
         * Notifies subscribed IO sample listeners that a new IO sample packet has
         * been received.
         *
         * @param ioSample The received IO sample.
         * @param remoteDevice The remote XBee device that sent the sample.
         *
         * @see com.digi.xbee.api.RemoteXBeeDevice
         * @see com.digi.xbee.api.io.IOSample
         */
        private void NotifyIOSampleReceived(RemoteXBeeDevice remoteDevice, IOSample ioSample)
        {
            logger.Debug(connectionInterface.ToString() + "IO sample received.");

            try
            {
                lock (IOSampleReceived)
                {
                    var handler = IOSampleReceived;
                    if (handler != null)
                    {
                        var args = new IOSampleReceivedEventArgs(remoteDevice, ioSample);

                        handler.GetInvocationList().AsParallel().ForAll((action) =>
                        {
                            action.DynamicInvoke(this, args);
                        });
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
            }
        }