Medical Peripheral Bluetooth Connectivity Framework
Develop a fault-tolerant CoreBluetooth communication framework for continuous biosensor data capture in medical iOS apps.
Use this template when connecting proprietary wearable medical hardware (such as continuous glucose monitors or pulse oximeters) to an iOS companion app. It standardizes connection state machines, background telemetry, and packet validation.
Role: Lead iOS Embedded Systems Engineer specializing in CoreBluetooth medical device peripherals, background telemetry, and fault-tolerant clinical telemetry.
Context
- Medical hardware device: {{medical_device_type}}
- GATT service configuration: {{ble_service_uuid_structure}}
- Data throughput requirement: {{throughput_latency_target}}
- Device energy constraint: {{power_consumption_budget}}
- Safety mitigation protocol: {{patient_safety_failover}}
- iOS execution mode: {{ios_background_mode}}
Task
Formulate a production-grade CoreBluetooth connection and streaming architecture for {{medical_device_type}} that guarantees continuous data collection within {{power_consumption_budget}} and handles disconnect anomalies via {{patient_safety_failover}}.
Method
- Define the CBCentralManager state machine, outlining handling for poweredOff, unauthorized, and resetting states.
- Map the GATT discovery sequence for {{ble_service_uuid_structure}}, prioritizing primary service discovery before reading characteristics or descriptors.
- Structure MTU negotiation and packet chunking to meet the criteria defined in {{throughput_latency_target}} without packet loss.
- Design background execution routines configured for {{ios_background_mode}}, utilizing State Preservation and Restoration (CBCentralManagerOptionRestoreIdentifierKey).
- Specify on-device checksum validation and CRC verification routines to detect corrupted packets before parsing clinical values.
- Construct the automated reconnection algorithm featuring exponential backoff and localized user alerts during persistent dropouts.
- Detail the safety execution pathway defined by {{patient_safety_failover}} to alert the patient immediately if critical telemetry drops.
Constraints
- MUST implement CoreBluetooth State Preservation and Restoration for {{ios_background_mode}}.
- MUST NOT parse or persist unvalidated GATT byte arrays without CRC validation.
- Minimize battery drain to respect {{power_consumption_budget}} constraints.
- Never perform heavy data parsing or decryption routines on the CoreBluetooth delegate queue.
Output format
- Bluetooth State Machine Specification (Detailed transition logic across Discovery, Pairing, Streaming, Disconnected)
- GATT Service & Characteristic Mapping (Table: UUID Name, Type, Property [Read/Notify/Write], Payload Size)
- Background Telemetry & Reconnection Strategy (Step-by-step description of restoration keys, background wakeups, and backoff)
- Packet Parsing & Validation Pipeline (Data flow diagram in ASCII or markdown text)
- Clinical Safety & Failover Protocol (3-4 explicit directives for dropped connections and degraded signal)
Self-review
- Verify that State Restoration delegate methods are explicitly handled.
- Confirm the GATT configuration accounts for all characteristics in {{ble_service_uuid_structure}}.
- Ensure {{patient_safety_failover}} triggers reliably during peripheral unresponsiveness.
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.