SimpleSharpBLE 1.2.1-dev.106

This is a prerelease version of SimpleSharpBLE.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package SimpleSharpBLE --version 1.2.1-dev.106
                    
NuGet\Install-Package SimpleSharpBLE -Version 1.2.1-dev.106
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimpleSharpBLE" Version="1.2.1-dev.106" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimpleSharpBLE" Version="1.2.1-dev.106" />
                    
Directory.Packages.props
<PackageReference Include="SimpleSharpBLE" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SimpleSharpBLE --version 1.2.1-dev.106
                    
#r "nuget: SimpleSharpBLE, 1.2.1-dev.106"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SimpleSharpBLE@1.2.1-dev.106
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SimpleSharpBLE&version=1.2.1-dev.106&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SimpleSharpBLE&version=1.2.1-dev.106&prerelease
                    
Install as a Cake Tool

SimpleBLE

SimpleSharpBLE

Build Bluetooth once. Ship it everywhere.

SimpleSharpBLE brings SimpleBLE to C# and .NET on Windows, macOS, Linux, Android, iOS/iPadOS, and Mac Catalyst. Discover and connect Bluetooth peripherals, read and write GATT values, subscribe to notifications, and host local GATT services through one API, with async methods and NativeAOT support included.

Why SimpleSharpBLE

  • One cross-platform API: Keep your Bluetooth apps, tools, and services the same on Windows, macOS, Linux, Android, iOS, and Mac Catalyst.
  • Native underneath: Use WinRT, CoreBluetooth, BlueZ, and Android Bluetooth through one maintained stack.
  • Built for real products: Act as a central or a peripheral on every supported platform.
  • Commercially supported: Ship proprietary applications with commercial licensing and direct technical support from the team that builds SimpleBLE.

Support and resources

Get started

Use .NET 10 or newer:

dotnet add package SimpleSharpBLE

The package includes the native SimpleBLE library for every supported platform, so nothing is compiled during installation.

Scan for five seconds and print what was found:

using SimpleSharpBLE;

var adapter = Adapter.GetAdapters()[0];

adapter.ScanFound += (_, e) =>
{
    using var peripheral = e.Peripheral;
    Console.WriteLine($"{peripheral.Identifier} [{peripheral.Address}] {peripheral.Rssi} dBm");
};
adapter.ScanFor(TimeSpan.FromSeconds(5));

Permissions

On Android, declare the Bluetooth permissions in your app's manifest and request them at runtime before using an adapter. BLUETOOTH_ADVERTISE is only needed to host a GATT service:

<uses-permission
    android:name="android.permission.BLUETOOTH_SCAN"
    android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />

Without neverForLocation, Android delivers scan results only to apps that also hold ACCESS_FINE_LOCATION. On iOS/iPadOS and Mac Catalyst, add an NSBluetoothAlwaysUsageDescription entry to your app's Info.plist; sandboxed Mac Catalyst apps also need the com.apple.security.device.bluetooth entitlement. The system asks the user the first time your app uses Bluetooth.

Scanning and events

An adapter raises the ScanStarted, ScanStopped, ScanFound, ScanUpdated, PoweredOn, and PoweredOff events; a peripheral raises Connected and Disconnected. Remove a handler with -=. Handlers run on the .NET thread pool, one at a time for each object, so hand longer work to your own tasks.

Use ScanStart() and ScanStop() when your application controls scan timing, and ScanGetResults() for the peripherals seen by the last scan. Adapters and peripherals, including the one each scan event carries, are IDisposable; the usage guide covers ownership.

Connect and use GATT

Read the battery level of a peripheral and follow its notifications:

const string BatteryService = "0000180f-0000-1000-8000-00805f9b34fb";
const string BatteryLevel = "00002a19-0000-1000-8000-00805f9b34fb";

var peripheral = adapter.ScanGetResults().First(p => p.Identifier == "My Sensor");

peripheral.Disconnected += (_, _) => Console.WriteLine("Disconnected");
peripheral.Connect();

byte[] level = peripheral.Read(BatteryService, BatteryLevel);
Console.WriteLine($"Battery: {level[0]}%");

peripheral.Notify(BatteryService, BatteryLevel, value => Console.WriteLine($"Battery: {value[0]}%"));

Services lists the services, characteristics, capabilities, and descriptors of a connected peripheral. Read, WriteRequest, and WriteCommand access characteristic values; the Read and Write overloads that take a descriptor UUID access descriptors. Notify and Indicate call your function with each value as a byte[], and Unsubscribe stops them. Failures throw BleException with SimpleBLE's message and a BleErrorCode.

Host a GATT service

Create a local peripheral from an adapter, add services and characteristics, then start advertising:

using SimpleSharpBLE.Local;

var host = adapter.CreateLocalPeripheral();
host.AddAdvertisedService(BatteryService);

var service = host.AddService(BatteryService);
var battery = service.AddCharacteristic(
    BatteryLevel, CharacteristicCapability.Read | CharacteristicCapability.Notify);
battery.Value = [100];

host.ClientConnected += (_, e) => Console.WriteLine($"{e.Address} connected");
host.Start();

Setting Value updates the stored value and publishes it to subscribers. Characteristics raise Written, Subscribed, and Unsubscribed, and a ReadHandler computes a value for each read. Configure services before Start(); call Stop() before changing them.

Use a Dongl

A Dongl is a USB Bluetooth adapter made for SimpleBLE. On Windows, macOS, and Linux its backend is on by default; use the adapters of the Dongl backend:

var adapter = Backend.GetDongl().Adapters[0];

Config holds the Dongl, BlueZ, WinRT, and Android backend settings; set them before the first call that reaches a backend. Pairing through a Dongl happens without the operating system: register a callback with SetPasskeyRequestCallback(), SetPasskeyDisplayCallback(), or SetNumericComparisonCallback() from Advanced.Dongl before Connect().

MAUI and mobile

On Android, initialize SimpleSharpBLE once on the main thread, after the permissions are granted and Bluetooth is on:

Java.Lang.JavaSystem.LoadLibrary("simpleble");
Advanced.Android.Initialize(Java.Interop.JniEnvironment.Runtime.InvocationPointer,
    Android.App.Application.Context.Handle);

On iOS/iPadOS and Mac Catalyst, set SupportedOSPlatformVersion to at least 15.8 and 16.0 respectively; the package links its native libraries into your app. In MAUI, call the Async counterparts, such as ScanForAsync, ConnectAsync, and ReadAsync, to keep the UI thread free, and update the UI from events with MainThread.BeginInvokeOnMainThread. The usage guide covers each platform's setup, and the Android example is a complete app.

Platforms

Platform Architectures Requirements
macOS 14 or newer arm64 Bluetooth permission for the app that runs your code
Windows 10 or newer x64, arm64
Linux with glibc x64, arm64 BlueZ and the D-Bus library
Android 12 or newer arm64, x64 Nearby devices permission
iOS/iPadOS 15.8 or newer arm64, including the simulator NSBluetoothAlwaysUsageDescription
Mac Catalyst 16.0 or newer arm64 NSBluetoothAlwaysUsageDescription

See the usage guide for Bluetooth permissions and platform details.

Versions

SimpleSharpBLE follows SimpleBLE's release versions. dotnet add package installs the latest stable release, and development builds of the main branch are published as pre-releases:

dotnet add package SimpleSharpBLE --prerelease

License

SimpleSharpBLE follows the SimpleBLE license, the Business Source License 1.1 (BUSL-1.1). It is free for non-commercial use, and commercial use needs a commercial license. We offer free commercial licenses for small projects and early-stage companies: email us or leave us a message to discuss your use case. Commercial licenses carry no royalties or revenue sharing; see the licensing page for terms.


SimpleBLE is a project powered by The California Open Source Company.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.1-dev.122 0 10/20/2026
1.2.1-dev.121 0 10/20/2026
1.2.1-dev.116 0 10/20/2026
1.2.1-dev.115 0 10/20/2026
1.2.1-dev.114 0 10/19/2026
1.2.1-dev.106 73 10/19/2026
1.2.1-dev.105 83 10/19/2026
1.2.1-dev.104 90 10/18/2026
1.2.1-dev.103 99 10/18/2026
1.2.1-dev.100 90 10/18/2026
1.2.1-dev.94 93 10/17/2026
1.2.1-dev.90 94 10/17/2026
1.2.1-dev.89 90 10/17/2026
1.2.1-dev.88 90 10/17/2026
1.2.1-dev.87 86 10/17/2026
1.2.1-dev.84 89 10/17/2026
1.2.1-dev.83 89 10/17/2026
1.2.1-dev.82 98 10/16/2026
1.2.1-dev.81 96 10/16/2026
1.2.0 149 9/28/2026
Loading failed