{"id":32148693,"url":"https://github.com/deepsealabs/libdc-swift","last_synced_at":"2026-02-21T17:03:45.669Z","repository":{"id":247061785,"uuid":"824927951","full_name":"deepsealabs/libdc-swift","owner":"deepsealabs","description":"Libdivecomputer support for Swift applications.","archived":false,"fork":false,"pushed_at":"2026-01-24T06:48:09.000Z","size":47811,"stargazers_count":9,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-11T06:55:14.420Z","etag":null,"topics":["bluetooth-low-energy","dive-computer","diving","libdivecomputer","scuba","swift"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepsealabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"latishab","buy_me_a_coffee":"latishab_"}},"created_at":"2024-07-06T10:06:40.000Z","updated_at":"2026-01-24T06:48:13.000Z","dependencies_parsed_at":"2026-01-02T03:04:47.682Z","dependency_job_id":null,"html_url":"https://github.com/deepsealabs/libdc-swift","commit_stats":null,"previous_names":["latishab/libdc-swift","deepsealabs/libdc-swift"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/deepsealabs/libdc-swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsealabs%2Flibdc-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsealabs%2Flibdc-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsealabs%2Flibdc-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsealabs%2Flibdc-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepsealabs","download_url":"https://codeload.github.com/deepsealabs/libdc-swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepsealabs%2Flibdc-swift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29688217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T15:51:39.154Z","status":"ssl_error","status_checked_at":"2026-02-21T15:49:03.425Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bluetooth-low-energy","dive-computer","diving","libdivecomputer","scuba","swift"],"created_at":"2025-10-21T09:02:10.782Z","updated_at":"2026-02-21T17:03:45.656Z","avatar_url":"https://github.com/deepsealabs.png","language":"C","funding_links":["https://github.com/sponsors/latishab","https://buymeacoffee.com/latishab_"],"categories":[],"sub_categories":[],"readme":"# LibDC-Swift\n\n![GitHub forks](https://img.shields.io/github/forks/deepsealabs/libdc-swift?style=social)\n![GitHub stars](https://img.shields.io/github/stars/deepsealabs/libdc-swift?style=social)\n![License](https://img.shields.io/github/license/deepsealabs/libdc-swift)\n\nA Swift framework for communicating with dive computers via Bluetooth Low Energy (BLE). Built on top of [libdivecomputer](https://www.libdivecomputer.org/), this package provides a modern Swift API for iOS and macOS applications to interact with various dive computers.\n\n## Features\n\n- 🔍 **BLE Device Scanning and Management:** Discover and manage BLE-enabled dive computers.\n- 📱 **Broad Device Support:** Works with popular dive computer brands such as Suunto, Shearwater, Mares, Pelagic, and others.\n- 📥 **Efficient Dive Log Retrieval:** Retrieve dive logs using a fingerprint system to avoid re-downloading previously fetched dives.\n- 📊 **Comprehensive Data Parsing:** Parse raw dive data and transform it into usable models.\n- 🛠 **Robust Error Handling and Logging:** Built-in mechanisms for tracking and reporting errors.\n- ⏱ **Progress Tracking \u0026 Background Support:** Integrated progress updates, and background execution for iOS.\n- 🔄 **Seamless SwiftUI Integration:** Designed to work naturally with SwiftUI for real-time UI updates.\n\n## Requirements\n\n- iOS 15.0+ / macOS 12.0+\n- Swift 5.10+\n- Xcode 15.0+\n\n## Installation\n\nAdd LibDC-Swift to your project using Swift Package Manager:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/deepsealabs/libdc-swift\", from: \"1.3.0\")\n]\n```\n\n## Quick Start\n\nBefore interacting with any dive computer features, set up the shared dive computer context. Once connected to a device (using, for example, `DeviceConfiguration.openBLEDevice(name:deviceAddress:)`), you can retrieve dive logs using the `DiveLogRetriever` class. The following snippet demonstrates a simplified SwiftUI integration:\n\n```swift\nimport SwiftUI\nimport CoreBluetooth\nimport LibDCSwift\n\nstruct ConnectedDeviceView: View {\n    let device: CBPeripheral\n    @ObservedObject var bluetoothManager: CoreBluetoothManager\n    @ObservedObject var diveViewModel: DiveDataViewModel\n\n    var body: some View {\n        VStack {\n            // UI elements showing device info and dive logs...\n            Button(\"Get Dive Logs\") {\n                retrieveDiveLogs()\n            }\n            if bluetoothManager.isRetrievingLogs {\n                ProgressView(\"Downloading...\")\n            }\n        }\n    }\n    \n    private func retrieveDiveLogs() {\n        // Ensure we have a valid device pointer\n        guard let devicePtr = bluetoothManager.openedDeviceDataPtr else {\n            print(\"❌ Device not connected\")\n            return\n        }\n        \n        bluetoothManager.isRetrievingLogs = true\n        bluetoothManager.currentRetrievalDevice = device\n        \n        DiveLogRetriever.retrieveDiveLogs(\n            from: devicePtr,\n            device: device,\n            viewModel: diveViewModel,\n            bluetoothManager: bluetoothManager,\n            onProgress: { current, total in\n                DispatchQueue.main.async {\n                    diveViewModel.updateProgress(count: current + 1)\n                }\n            },\n            completion: { success in\n                DispatchQueue.main.async {\n                    if success {\n                        print(\"✅ Dive logs successfully retrieved!\")\n                    } else {\n                        print(\"❌ Failed to retrieve dive logs.\")\n                    }\n                    bluetoothManager.clearRetrievalState()\n                }\n            }\n        )\n    }\n}\n```\n\n## Device Configuration \u0026 Dive Log Retrieval\n\nThe framework is built around two core classes:\n\n- **DeviceConfiguration:**  \n  Provides functionality to:\n  - Retrieve known BLE service UUIDs for device discovery.\n  - Connect to dive computers using stored configuration or descriptor-based identification.\n  - Create parsers for dive data based on the device family and model.\n\n- **DiveLogRetriever:**  \n  Handles the retrieval of dive logs from a connected dive computer. It leverages:\n  - A C-compatible callback mechanism to process individual dive logs.\n  - Progress updates (which can be used to update the UI in real time).\n  - Integration with background tasks to keep the download process alive even when the app is in the background.\n\n## Supported Devices\n\nLibDC-Swift supports all dive computer brands with BLE connectivity as defined by [libdivecomputer](https://www.libdivecomputer.org/). Some supported families include:\n\n- Suunto EON Steel/Core\n- Shearwater Perdix/Tern\n- Mares Icon HD\n- Pelagic i330R/DSX\n- ...and more (see code documentation for the complete list)\n\n## Documentation\n\nFor complete documentation, advanced usage examples, and further integration details, please visit our [Wiki](https://github.com/deepsealabs/libdc-swift/wiki). Topics include:\n\n- Detailed setup and configuration\n- Advanced usage scenarios and error handling\n- Logging and progress tracking mechanisms\n- Contribution guidelines\n\n## Contributing\n\nContributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for more information.\n\n## License\n\nThis project is licensed under the GNU Lesser General Public License v2.1 – see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\nLibDC-Swift builds upon [libdivecomputer](https://www.libdivecomputer.org/), providing Swift bindings and additional functionality to power modern iOS and macOS applications.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepsealabs%2Flibdc-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepsealabs%2Flibdc-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepsealabs%2Flibdc-swift/lists"}