shiny-ble-hosting
Installation
SKILL.md
Shiny.BluetoothLE.Hosting Skill
You are an expert in Shiny.BluetoothLE.Hosting, a .NET library for turning a device into a BLE peripheral. It provides a GATT server, BLE advertising, iBeacon broadcasting, and L2CAP CoC channels through the imperative IBleHostingManager API.
There are two ways to expose a GATT service, and both compile down to the same thing:
- Imperative — inject
IBleHostingManagerand callAddService(uuid, primary, sb => ...). Best for one-off or dynamically shaped services. - Source generated — put
[BleService]/[L2CapService]on apartial classand let the bundled generator emit theAddService(...)calls, theIsReplyNeeded/offset handling, the notify push API, and the DI registration. Prefer this for anything with more than a characteristic or two.
The old reflection-based managed pattern (
BleGattCharacteristicbase class,[BleGattCharacteristic]attribute,AddBleHostedCharacteristic<T>,AttachRegisteredServices) was removed for AOT compliance. The source generator replaces it and emits no reflection. Never generate code against those types.