Bluez.NET.Server
0.0.2
See the version list below for details.
dotnet add package Bluez.NET.Server --version 0.0.2
NuGet\Install-Package Bluez.NET.Server -Version 0.0.2
<PackageReference Include="Bluez.NET.Server" Version="0.0.2" />
<PackageVersion Include="Bluez.NET.Server" Version="0.0.2" />
<PackageReference Include="Bluez.NET.Server" />
paket add Bluez.NET.Server --version 0.0.2
#r "nuget: Bluez.NET.Server, 0.0.2"
#:package Bluez.NET.Server@0.0.2
#addin nuget:?package=Bluez.NET.Server&version=0.0.2
#tool nuget:?package=Bluez.NET.Server&version=0.0.2
Overview
.NET BlueZ Server is a powerful library designed to facilitate the creation of Bluetooth Low Energy (BLE) peripherals and efficiently manage centrals on Linux using .NET Core. Leveraging the capabilities of BlueZ under the hood, this library offers a seamless API that preserves the object structure of BlueZ while streamlining D-Bus communication for a more developer-friendly experience.
Key features
- BLE Peripheral Creation
- Adapter Management
- Central Management
- Pair device
- Remove Device
- Get all paired devices
- Get central object path on Read and Write request
Example
Create BLE peripheral
ServerContext _CurrentServerContext = new ServerContext();
await BleAdvertisement.RegisterAdvertisement(_CurrentServerContext);
await BleGattApplication.RegisterGattApplication(_CurrentServerContext);
DeviceManager.SetDevicePropertyListenerAsync(_CurrentServerContext, OnDeviceConnectedAsync);
Listen Central property change
private async void OnDeviceConnectedAsync(IDevice1 device, PropertyChanges changes)
{
foreach (var change in changes.Changed)
{
Console.WriteLine($"{change.Key}:{change.Value}");
}
}
Get BLE Adapter
AdapterManager.GetAdapter(_CurrentServerContext);
Turn ON/OFF BLE Adapter
var isAdapterOn = AdapterManager.SetAdapterPowerOn(_CurrentServerContext);
var isAdapterOff = AdapterManager.SetAdapterPowerOff(_CurrentServerContext);
Get paired devices
var devices = await DeviceManager.GetDeviceListAsync(_CurrentServerContext);
Remove paired device
await DeviceManager.RemoveDeviceAsync(_CurrentServerContext, iDevice);
Get Device from Address
var device = await DeviceManager.GetDeviceAsync(_CurrentServerContext, address);
Get Device from object path
var device = await DeviceManager.GetDeviceByObject(_CurrentServerContext, address);
Pair device
var paired = await device.GetPairedAsync();
if (!paired)
{
var response = await DeviceManager.PairDeviceAsync(_CurrentServerContext,device);
}
Useful references
| Resource | Link |
|---|---|
| BlueZ GATT API documentation | https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/gatt-api.txt |
| Presentation BLE on Linux | https://elinux.org/images/3/32/Doing_Bluetooth_Low_Energy_on_Linux.pdf |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.