/// <summary> /// Class constructor. Instantiates a new <see cref="DataReader"/> object for the given connection /// interface using the given XBee operating mode and XBee device. /// </summary> /// <param name="connectionInterface">Connection interface to read data from.</param> /// <param name="mode">XBee operating mode.</param> /// <param name="xbeeDevice">Reference to the XBee device containing this <see cref="DataReader"/> /// object.</param> /// <exception cref="ArgumentNullException">If <c><paramref name="connectionInterface"/> == null</c>.</exception> /// <seealso cref="IConnectionInterface"/> /// <seealso cref="XBeeDevice"/> /// <seealso cref="OperatingMode"/> public DataReader(IConnectionInterface connectionInterface, OperatingMode mode, AbstractXBeeDevice xbeeDevice) { this.connectionInterface = connectionInterface ?? throw new ArgumentNullException("Connection interface cannot be null."); this.mode = mode; this.xbeeDevice = xbeeDevice; logger = LogManager.GetLogger <DataReader>(); parser = new XBeePacketParser(); XBeePacketsQueue = new XBeePacketsQueue(); // Create the task. task = new Task(() => { Run(); }, TaskCreationOptions.LongRunning); }
/** * Class constructor. Instantiates a new {@code DataReader} object for the * given connection interface using the given XBee operating mode and XBee * device. * * @param connectionInterface Connection interface to read data from. * @param mode XBee operating mode. * @param xbeeDevice Reference to the XBee device containing this * {@code DataReader} object. * * @throws ArgumentNullException if {@code connectionInterface == null} or * {@code mode == null}. * * @see IConnectionInterface * @see com.digi.xbee.api.XBeeDevice * @see com.digi.xbee.api.models.OperatingMode */ public DataReader(IConnectionInterface connectionInterface, OperatingMode mode, XBeeDevice xbeeDevice) { if (connectionInterface == null) { throw new ArgumentNullException("Connection interface cannot be null."); } if (mode == null) { throw new ArgumentNullException("Operating mode cannot be null."); } this.connectionInterface = connectionInterface; this.mode = mode; this.xbeeDevice = xbeeDevice; this.logger = LogManager.GetLogger <DataReader>(); parser = new XBeePacketParser(); xbeePacketsQueue = new XBeePacketsQueue(); }