Class DataReader
Thread that constantly reads data from an input stream.
Inheritance
Inherited Members
Namespace: XBeeLibrary.Core.Connection
Assembly: XBeeLibrary.Core.dll
Syntax
public class DataReader
Remarks
Depending on the XBee operating mode, read data is notified as is to the subscribed listeners or is parsed to a packet using the packet parser and then notified to subscribed listeners.
Constructors
DataReader(IConnectionInterface, OperatingMode, AbstractXBeeDevice)
Class constructor. Instantiates a new DataReader object for the given connection interface using the given XBee operating mode and XBee device.
Declaration
public DataReader(IConnectionInterface connectionInterface, OperatingMode mode, AbstractXBeeDevice xbeeDevice)
Parameters
Type | Name | Description |
---|---|---|
IConnectionInterface | connectionInterface | Connection interface to read data from. |
OperatingMode | mode | XBee operating mode. |
AbstractXBeeDevice | xbeeDevice | Reference to the XBee device containing this DataReader object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
See Also
Properties
IsRunning
Indicates whether the data reader is running or not.
Declaration
public bool IsRunning { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
XBeePacketsQueue
Returns the queue of read XBee packets.
Declaration
public XBeePacketsQueue XBeePacketsQueue { get; }
Property Value
Type | Description |
---|---|
XBeePacketsQueue | The queue of read XBee packets. |
See Also
Methods
GetRemoteXBeeDeviceFromPacket(XBeeAPIPacket)
Returns the remote XBee device from where the given package was sent from.
Declaration
public RemoteXBeeDevice GetRemoteXBeeDeviceFromPacket(XBeeAPIPacket apiPacket)
Parameters
Type | Name | Description |
---|---|---|
XBeeAPIPacket | apiPacket | The packet sent from the remote device. |
Returns
Type | Description |
---|---|
RemoteXBeeDevice | The remote XBee device that sends the given packet. It may be |
Remarks
This is for internal use only.
If the package does not contain information about the source, this method returns null
(for example, ModemStatusPacket).
First the device that sent the provided package is looked in the network of the local XBee device. If the remote device is not in the network, it is automatically added only if the packet contains information about the origin of the package.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
XBeeException | If any error occurred while adding the device to the network. |
SetXBeeReaderMode(OperatingMode)
Sets the XBee operating mode of this data reader.
Declaration
public void SetXBeeReaderMode(OperatingMode mode)
Parameters
Type | Name | Description |
---|---|---|
OperatingMode | mode | The new xBee operating mode. |
See Also
StopReader()
Stops the data reader thread.
Declaration
public void StopReader()
Events
BluetoothDataReceived
Represents the method that will handle the Bluetooth data received event.
Declaration
public event EventHandler<BluetoothDataReceivedEventArgs> BluetoothDataReceived
Event Type
Type | Description |
---|---|
System.EventHandler<BluetoothDataReceivedEventArgs> |
See Also
DataReceived
Represents the method that will handle the data received event.
Declaration
public event EventHandler<DataReceivedEventArgs> DataReceived
Event Type
Type | Description |
---|---|
System.EventHandler<DataReceivedEventArgs> |
See Also
ExplicitDataReceived
Represents the method that will handle the explicit data received event.
Declaration
public event EventHandler<ExplicitDataReceivedEventArgs> ExplicitDataReceived
Event Type
Type | Description |
---|---|
System.EventHandler<ExplicitDataReceivedEventArgs> |
See Also
IOSampleReceived
Represents the method that will handle the IO sample packet received event.
Declaration
public event EventHandler<IOSampleReceivedEventArgs> IOSampleReceived
Event Type
Type | Description |
---|---|
System.EventHandler<IOSampleReceivedEventArgs> |
See Also
IPDataReceived
Represents the method that will handle the IP data received event.
Declaration
public event EventHandler<IPDataReceivedEventArgs> IPDataReceived
Event Type
Type | Description |
---|---|
System.EventHandler<IPDataReceivedEventArgs> |
See Also
MicroPythonDataReceived
Represents the method that will handle the MicroPython data received event.
Declaration
public event EventHandler<MicroPythonDataReceivedEventArgs> MicroPythonDataReceived
Event Type
Type | Description |
---|---|
System.EventHandler<MicroPythonDataReceivedEventArgs> |
See Also
ModemStatusReceived
Represents the method that will handle the Modem status event.
Declaration
public event EventHandler<ModemStatusReceivedEventArgs> ModemStatusReceived
Event Type
Type | Description |
---|---|
System.EventHandler<ModemStatusReceivedEventArgs> |
See Also
SerialDataReceived
Represents the method that will handle the serial data received event.
Declaration
public event EventHandler<SerialDataReceivedEventArgs> SerialDataReceived
Event Type
Type | Description |
---|---|
System.EventHandler<SerialDataReceivedEventArgs> |
See Also
SMSReceived
Represents the method that will handle the SMS received event.
Declaration
public event EventHandler<SMSReceivedEventArgs> SMSReceived
Event Type
Type | Description |
---|---|
System.EventHandler<SMSReceivedEventArgs> |
See Also
UserDataRelayReceived
Represents the method that will handle the User Data Relay received event.
Declaration
public event EventHandler<UserDataRelayReceivedEventArgs> UserDataRelayReceived
Event Type
Type | Description |
---|---|
System.EventHandler<UserDataRelayReceivedEventArgs> |
See Also
XBeePacketReceived
Represents the method that will handle the packet received event.
Declaration
public event EventHandler<PacketReceivedEventArgs> XBeePacketReceived
Event Type
Type | Description |
---|---|
System.EventHandler<PacketReceivedEventArgs> |