Interface IConnectionInterface
This interface represents a protocol independent connection with an XBee device.
Namespace: XBeeLibrary.Core.Connection
Assembly: XBeeLibrary.Core.dll
Syntax
public interface IConnectionInterface
Remarks
As an important point, the class implementing this interface must always notify whenever new data is available to read. Not doing this will make the DataReader class to wait forever for new data.
Properties
IsOpen
Returns whether the connection interface is open or not.
Declaration
bool IsOpen { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Stream
Returns the connection interface stream to read and write data.
Declaration
DataStream Stream { get; }
Property Value
Type | Description |
---|---|
DataStream |
See Also
Methods
Close()
Attempts to close the connection interface.
Declaration
void Close()
See Also
GetConnectionType()
Returns the connection type of this XBee interface.
Declaration
ConnectionType GetConnectionType()
Returns
Type | Description |
---|---|
ConnectionType | The connection type of this XBee interface. |
See Also
Open()
Attempts to open the connection interface.
Declaration
void Open()
See Also
ReadData(Byte[])
Reads data from the connection interface and stores it in the provided byte array returning the number of read bytes.
Declaration
int ReadData(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The byte array to store the read data. |
Returns
Type | Description |
---|---|
System.Int32 | The number of bytes read. |
See Also
ReadData(Byte[], Int32, Int32)
Reads the given number of bytes at the given offset from the connection interface and stores it in the provided byte array returning the number of read bytes.
Declaration
int ReadData(byte[] data, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The byte array to store the read data. |
System.Int32 | offset | The start offset in data array at which the data is written. |
System.Int32 | length | Maximum number of bytes to read. |
Returns
Type | Description |
---|---|
System.Int32 | The number of bytes read. |
See Also
SetEncryptionKeys(Byte[], Byte[], Byte[])
Sets the keys used for encryption and decryption.
Declaration
void SetEncryptionKeys(byte[] key, byte[] txNonce, byte[] rxNonce)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | key | Encryption key. |
System.Byte[] | txNonce | Transmission nonce. |
System.Byte[] | rxNonce | Reception nonce. |
WriteData(Byte[])
Writes the given data in the connection interface.
Declaration
void WriteData(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to be written in the connection interface. |
See Also
WriteData(Byte[], Int32, Int32)
Writes the given data in the connection interface.
Declaration
void WriteData(byte[] data, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to be written in the connection interface. |
System.Int32 | offset | The start offset in the data to write. |
System.Int32 | length | The number of bytes to write. |