corebluetooth_skill

This skill helps you implement Core Bluetooth central and peripheral workflows, ensuring poweredOn state, proper discovery, connection, and GATT operations.
  • Swift

11

GitHub Stars

10

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill nonameplum/agent-skills --skill corebluetooth

  • AboutCoreBluetooth.md15.1 KB
  • BestPracticesforInteractingwithaRemotePeripheralDevice.md16.4 KB
  • BestPracticesforSettingUpYourLocalDeviceasaPeripheral.md13.6 KB
  • BluetoothStateRestorationAppReaunchRules.md3.4 KB
  • corebluetooth.md4.0 KB
  • CoreBluetoothBackgroundProcessingforiOSApps.md33.2 KB
  • CoreBluetoothOverview.md18.2 KB
  • PerformingCommonCentralRoleTasks.md23.6 KB
  • PerformingCommonPeripheralRoleTasks.md27.4 KB
  • SKILL.md2.5 KB

Overview

This skill documents Apple Core Bluetooth for building BLE and Bluetooth Classic features across Apple platforms using Swift. It summarizes central and peripheral workflows, background processing and state restoration rules, GATT operations, and L2CAP usage. The content focuses on practical checklists, common pitfalls, and mapping to Core Bluetooth APIs.

How this skill works

The skill explains how to create and manage CBCentralManager and CBPeripheralManager instances, wait for .poweredOn state, and perform scanning, connecting, advertising, and GATT discovery. It guides readers through handling delegates, retaining peripheral objects, subscribing to notifications, reading/writing characteristics, and choosing L2CAP when GATT is insufficient. It also covers background modes and state restoration behaviors for reliable lifecycle handling.

When to use it

  • When implementing a BLE central to discover and connect to remote peripherals.
  • When implementing a local peripheral to advertise services and accept central connections.
  • When you need reliable background scanning, connection restoration, or state preservation.
  • When streaming data via notifications or using write-without-response for low-latency transfers.
  • When L2CAP channels are required for custom high-throughput or non-GATT data flows.

Best practices

  • Gate all BLE operations on manager state .poweredOn and implement centralManagerDidUpdateState(_:).
  • Retain discovered CBPeripheral instances to avoid unexpected deallocation and lost connections.
  • Stop scanning as soon as the target peripheral is found to conserve power and CPU.
  • Set delegates early, discover services/characteristics in order, and handle asynchronous callbacks robustly.
  • Use notifications for streaming, write-without-response only when canSendWriteWithoutResponse is true.
  • Follow platform rules for background modes and implement state restoration to recover sessions.

Example use cases

  • A fitness app acting as a central to read heart rate and battery characteristics from strap sensors.
  • A hardware companion app advertising a custom service while acting as a peripheral for nearby controllers.
  • A background location tracker that restores BLE connections after an app relaunch.
  • A streaming audio or sensor pipeline using notifications for continuous data delivery.
  • A custom high-throughput link using L2CAP channels for non-GATT binary transport.

FAQ

Yes. Always wait for .poweredOn in the manager delegate before calling scanForPeripherals.

When should I use L2CAP instead of GATT?

Use L2CAP when your data model requires higher throughput, larger packets, or a non-characteristic protocol that GATT cannot efficiently handle.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational