Medical Peripheral CoreBluetooth Integration Specification
Architect reliable CoreBluetooth background streaming and packet parsing for Class II medical hardware.
Use this template when building an iOS connectivity driver for Bluetooth LE pulse oximeters, ECG monitors, or continuous glucose sensors. It details state restoration, characteristic parsing, and secure local buffering.
Role: Lead iOS Firmware & CoreBluetooth Systems Engineer specializing in regulated medical peripheral connectivity and BLE drivers.
Context
- Medical hardware device: {{medical_device_model}}
- Target BLE Service and Characteristic UUIDs: {{ble_service_uuids}}
- Continuous vital metric definitions: {{vital_metric_definitions}}
- Disconnect recovery policy: {{connection_retry_policy}}
- Proprietary packet binary encoding: {{hardware_packet_encoding}}
- Local enclave storage destination: {{hipaa_enclave_storage_target}}
Task
Author an end-to-end technical engineering specification for integrating {{medical_device_model}} via CoreBluetooth, ensuring uninterrupted vital sign streaming, state restoration, and encrypted packet ingestion.
Method
- Specify CBCentralManager instantiation including CBCentralManagerOptionRestoreIdentifierKey configuration.
- Define peripheral discovery, RSSI filtering, and secure bonding flows targeting {{ble_service_uuids}}.
- Architect the CBPeripheralDelegate packet parsing engine decoding {{hardware_packet_encoding}} into {{vital_metric_definitions}}.
- Design the reconnection state machine implementing {{connection_retry_policy}} to handle out-of-range events.
- Detail the background execution preservation strategy to process vital telemetry when the app is suspended or terminated.
- Specify the buffering pipeline streaming decoded metrics into {{hipaa_enclave_storage_target}}.
- Establish hardware telemetry diagnostics to detect packet drops, checksum failures, and peripheral battery degradation.
Constraints
- MUST implement CBCentralManager state restoration to guarantee background reconnection across app reboots.
- MUST NOT process unvalidated raw binary packets without cyclic redundancy checks (CRC).
- Bluetooth read/write latency MUST NOT exceed 250 milliseconds during active vital streaming.
- Memory allocations inside peripheral(_:didUpdateValueFor:error:) MUST remain strictly zero-allocation on the main thread.
- Output length MUST remain bounded between 650 and 950 words.
Output format
Provide the specification formatted under these standard section titles:
- CBCentralManager Architecture & State Restoration
- GATT Service Discovery & Security Pairing
- Binary Packet Parsing & CRC Verification Engine
- Reconnection Lifecycle & Fault Tolerance
- Local Enclave Ingestion & Metric Storage
Self-review
- Verify that all Service UUIDs in {{ble_service_uuids}} are mapped to distinct characteristic handlers.
- Ensure the background restoration logic explicitly addresses iOS memory termination scenarios.
- Confirm that payload conversion from {{hardware_packet_encoding}} to {{vital_metric_definitions}} has defined validation bounds.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.