XBee C# library API reference

Show / Hide Table of Contents

Class DataReader

Thread that constantly reads data from an input stream.

Inheritance
System.Object
DataReader
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 connectionInterface == null.

See Also
IConnectionInterface
XBeeDevice
OperatingMode

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
XBeePacketsQueue

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 null if the packet is not a known frame (APIFrameType) or if it does not contain information of the source device.

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 apiPacket == null.

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
OperatingMode

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
BluetoothDataReceivedEventArgs

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
DataReceivedEventArgs

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
ExplicitDataReceivedEventArgs

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
IOSampleReceivedEventArgs

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
IPDataReceivedEventArgs

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
MicroPythonDataReceivedEventArgs

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
ModemStatusReceivedEventArgs

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
SerialDataReceivedEventArgs

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
SMSReceivedEventArgs

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
UserDataRelayReceivedEventArgs

XBeePacketReceived

Represents the method that will handle the packet received event.

Declaration
public event EventHandler<PacketReceivedEventArgs> XBeePacketReceived
Event Type
Type Description
System.EventHandler<PacketReceivedEventArgs>
See Also
PacketReceivedEventArgs
Product page More documentation Official site About Digi Contact us Support
©2019 Digi International Inc. All rights reserved.
Digi International Inc.