XBee C# library API reference

Show / Hide Table of Contents

Class BluetoothInterface

Class that handles the connection with the XBee module through Bluetooth Low Energy.

Inheritance
System.Object
BluetoothInterface
Implements
IConnectionInterface
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.Xamarin.Connection.Bluetooth
Assembly: XBeeLibrary.Xamarin.dll
Syntax
public class BluetoothInterface : IConnectionInterface

Constructors

| Improve this Doc View Source

BluetoothInterface(IDevice)

Class constructor. Instantiates a new BluetoothInterface object with the given device.

Declaration
public BluetoothInterface(IDevice device)
Parameters
Type Name Description
Plugin.BLE.Abstractions.Contracts.IDevice device

Bluetooth device.

See Also
Plugin.BLE.Abstractions.Contracts.IDevice
| Improve this Doc View Source

BluetoothInterface(Guid)

Class constructor. Instantiates a new BluetoothInterface object with the given Bluetooth device GUID.

Declaration
public BluetoothInterface(Guid deviceGuid)
Parameters
Type Name Description
System.Guid deviceGuid

The Bluetooth device GUID.

See Also
System.Guid
| Improve this Doc View Source

BluetoothInterface(String)

Class constructor. Instantiates a new BluetoothInterface object with the given Bluetooth device GUID.

Declaration
public BluetoothInterface(string deviceAddress)
Parameters
Type Name Description
System.String deviceAddress

The address or GUID of the Bluetooth device. It must follow the format 00112233AABB or 00:11:22:33:AA:BB for the address or 01234567-0123-0123-0123-0123456789AB for the GUID.

Exceptions
Type Condition
System.ArgumentException

If deviceAddress does not follow the format 00112233AABB or 00:11:22:33:AA:BB or 01234567-0123-0123-0123-0123456789AB.

Properties

| Improve this Doc View Source

IsOpen

Returns whether the connection interface is open or not.

Declaration
public bool IsOpen { get; }
Property Value
Type Description
System.Boolean
See Also
Close()
Open()
| Improve this Doc View Source

Stream

Returns the bluetooth connection interface stream to read and write data.

Declaration
public DataStream Stream { get; }
Property Value
Type Description
DataStream
See Also
DataStream

Methods

| Improve this Doc View Source

Close()

Closes the connection interface associated with this bluetooth device.

Declaration
public void Close()
Exceptions
Type Condition
XBeeException

If there is any XBee error.

See Also
IsOpen
Open()
| Improve this Doc View Source

GetConnectionType()

Returns the connection type of this bluetooth XBee interface.

Declaration
public ConnectionType GetConnectionType()
Returns
Type Description
ConnectionType

The connection type of this bluetooth XBee interface.

See Also
ConnectionType
| Improve this Doc View Source

Open()

Opens the connection interface associated with this Bluetooth device.

Declaration
public void Open()
Exceptions
Type Condition
System.Exception

If there is any problem opening the connection with this bluetooth device.

XBeeException

If there is any XBee error.

See Also
IsOpen
Close()
| Improve this Doc View Source

ReadData(Byte[])

Reads data from the bluetooth connection interface and stores it in the provided byte array returning the number of read bytes.

Declaration
public 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)
| Improve this Doc View Source

ReadData(Byte[], Int32, Int32)

Reads the given number of bytes at the given offset from the bluetooth connection interface and stores it in the provided byte array returning the number of read bytes.

Declaration
public 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
ReadData(Byte[])
| Improve this Doc View Source

SetEncryptionKeys(Byte[], Byte[], Byte[])

Sets the encryption keys and starts to encrypt the communication with the module.

Declaration
public void SetEncryptionKeys(byte[] key, byte[] txNonce, byte[] rxNonce)
Parameters
Type Name Description
System.Byte[] key

Session key.

System.Byte[] txNonce

TX nonce used as prefix of the counter block.

System.Byte[] rxNonce

RX nonce used as prefix of the counter block.

| Improve this Doc View Source

WriteData(Byte[])

Writes the given data in the bluetooth connection interface.

Declaration
public 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)
| Improve this Doc View Source

WriteData(Byte[], Int32, Int32)

Writes the given data in the bluetooth connection interface.

Declaration
public 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.

Exceptions
Type Condition
XBeeException

If there is any XBee error.

See Also
WriteData(Byte[])

Implements

IConnectionInterface

See Also

IConnectionInterface
Product page More documentation Official site About Digi Contact us Support
©2019, 2020, Digi International Inc. All rights reserved.
Digi International Inc.