Skip to content
Shiny.NET
Commercial SupportGuaranteed response times on Shiny bug fixes, straight from the maintainers. Plans from US$1,500 a year.See the plans

BluetoothLE Hosting

GitHub GitHub stars for shinyorg/shiny
Downloads NuGet downloads for Shiny.BluetoothLE.Hosting
Linux NuGet downloads for Shiny.BluetoothLE.Hosting.Linux
Frameworks
.NET
.NET MAUI
Operating Systems
Android
iOS
macOS
Windows
Linux

BluetoothLE Hosting allows your device to act as a BLE peripheral (server). You can advertise services, create GATT services with characteristics, and communicate with central devices that connect to you.

  • Advertise as a BLE peripheral
  • Create GATT services with read/write/notify characteristics via the imperative AddService builder
  • iBeacon broadcasting
  • L2CAP CoC channel listeners for high-throughput streaming, including a directory-backed file server centrals can upload to and download from
  • Cross-platform: iOS, macOS, Android, Linux (Windows hosting is currently stubbed)
Feature iOS macOS Android Windows Linux
Advertising Foreground + limited background Full Full — Full (BlueZ)
GATT Server Full Full Full — Full (BlueZ) - see notification limits
L2CAP CoC Full Full API 29+ — Full (BlueZ socket)
Changed files
  • MyApp/
Delegates/MyGattHostingService.cs
MyGattHostingService.cs
1using Shiny.BluetoothLE.Hosting;2​3namespace MyApp.Delegates;4​5public class MyGattHostingService(IBleHostingManager manager, ILogger<MyGattHostingService> logger) : IShinyStartupTask6{7    // TODO: replace with your own 128-bit UUIDs8    const string ServiceUuid = "SERVICE-UUID";9    const string CharacteristicUuid = "CHARACTERISTIC-UUID";10​11    public async void Start()12    {13        var access = await manager.RequestAccess(advertise: true, connect: true);14        if (access != AccessState.Available)15            return;16​17        await manager.AddService(ServiceUuid, primary: true, sb =>18        {19            sb.AddCharacteristic(CharacteristicUuid, cb =>20            {21                cb.SetRead(req => Task.FromResult(GattResult.Success(System.Text.Encoding.UTF8.GetBytes("Hello"))));22​23                cb.SetWrite(req =>24                {25                    logger.LogInformation("Received {Bytes} bytes", req.Data.Length);26                    if (req.IsReplyNeeded)27                        req.Respond(GattState.Success);28                    return Task.CompletedTask;29                }, WriteOptions.Write);30​31                cb.SetNotification(sub =>32                {33                    logger.LogInformation("Subscription change: {Sub}", sub.IsSubscribing);34                    return Task.CompletedTask;35                }, NotificationOptions.Notify);36            });37        });38​39        await manager.StartAdvertising(new AdvertisementOptions("MyApp", ServiceUuid));40    }41}
IBleHostingManager hostingManager; // injected
var access = await hostingManager.RequestAccess(advertise: true, connect: true);
// Start advertising with a local name and service UUIDs
await hostingManager.StartAdvertising(new AdvertisementOptions(
LocalName: "MyDevice",
ServiceUuids: new[] { "Your-Service-UUID" }
));
// Check advertising state
var isAdvertising = hostingManager.IsAdvertising;
// Stop advertising
hostingManager.StopAdvertising();
claude plugin marketplace add shinyorg/skills
claude plugin install shiny@shiny

One plugin installs all 48 Shiny skills. Your agent loads only the skill relevant to what you're building, so there's no cost to having them all available.

copilot plugin marketplace add https://github.com/shinyorg/skills
copilot plugin install shiny@shiny

One plugin installs all 48 Shiny skills. Your agent loads only the skill relevant to what you're building, so there's no cost to having them all available.

View shiny-ble-hosting Skill