Digi IoT Library for .NET MAUI API reference

Show / Hide Table of Contents

Class DigiBLEManager

Class used to manage Bluetooth events and permissions.

Inheritance
object
DigiBLEManager
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DigiIoTDigiIoT.MauiModels
Assembly: DigiIoT.Maui.dll
Syntax
public class DigiBLEManager

Constructors

DigiBLEManager()

Class constructior. Instantiates a new BluetoothManager object.

Declaration
public DigiBLEManager()

Properties

IsScanning

Indicates whether Bluetooth is scanning or not.

Declaration
public bool IsScanning { get; }
Property Value
Type Description
bool

Methods

GetBluetoothState()

Returns the current Bluetooth state.

Declaration
public static Task<BluetoothState> GetBluetoothState()
Returns
Type Description
TaskBluetoothState

The Bluetooth state

IsBluetoothEnabled()

Returns whether the Bluetooth adapter is enabled or not.

Declaration
public static Task<bool> IsBluetoothEnabled()
Returns
Type Description
Taskbool

true if Bluetooth is enabled, false otherwise.

IsGPSEnabled()

Returns whether the GPS is enabled or not.

Declaration
public static bool IsGPSEnabled()
Returns
Type Description
bool

true if the GPS is enabled, false otherwise.

RequestBluetoothPermission()

Requests Bluetooth permisions.

Declaration
public static Task<bool> RequestBluetoothPermission()
Returns
Type Description
Taskbool

true if permission was granted, false otherwise.

RequestLocationPermission()

Requests location permisions.

Declaration
public static Task<bool> RequestLocationPermission()
Returns
Type Description
Taskbool

true if permission was granted, false otherwise.

StartScanning()

Starts the scan process to look for BLE devices.

Declaration
public void StartScanning()

StopScanning()

Stops the BLE scanning process.

Declaration
public void StopScanning()

ValidateBluetoothStatus()

Validates that Bluetooth is operative in the device. This means that necessary interfaces and permissions are enabled and granted. The method requests for permissions to the user if necessary.

Declaration
public static void ValidateBluetoothStatus()
Exceptions
Type Condition
DigiIoTException

If any required interface is not enabled or necessary permission was not granted.

Events

BluetoothStateChanged

Event called when the Bluetooth interface state changed.

Declaration
public event DigiBLEManager.BluetoothStateChangedHandler BluetoothStateChanged
Event Type
Type Description
DigiBLEManagerBluetoothStateChangedHandler

ConnectionLost

Event called when the Bluetooth connection was lost.

Declaration
public event DigiBLEManager.ConnectionLostHandler ConnectionLost
Event Type
Type Description
DigiBLEManagerConnectionLostHandler

DeviceAdvertised

Event called when a Bluetooth device has been advertised.

Declaration
public event DigiBLEManager.DeviceAdvertisedHandler DeviceAdvertised
Event Type
Type Description
DigiBLEManagerDeviceAdvertisedHandler

ScanStarted

Event called when the Bluetooth scan process has started.

Declaration
public event DigiBLEManager.ScanStartedHandler ScanStarted
Event Type
Type Description
DigiBLEManagerScanStartedHandler

ScanStopped

Event called when the Bluetooth scan process has stopped.

Declaration
public event DigiBLEManager.ScanStoppedHandler ScanStopped
Event Type
Type Description
DigiBLEManagerScanStoppedHandler
Product page More documentation Official site About Digi Contact us Support
©2023, Digi International Inc. All rights reserved.
Digi International Inc.