{"id":19686072,"url":"https://github.com/nordicsemiconductor/ios-memfault-library","last_synced_at":"2025-04-29T06:31:15.872Z","repository":{"id":71091338,"uuid":"520494252","full_name":"NordicSemiconductor/IOS-Memfault-Library","owner":"NordicSemiconductor","description":"nRF Memfault Library + Example App","archived":false,"fork":false,"pushed_at":"2023-12-15T12:00:33.000Z","size":2952,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-05T13:51:23.975Z","etag":null,"topics":["ble","bluetooth","bluetooth-low-energy","ios","macos","memfault","nordic","nordic-bluetooth","nordic-semiconductor","nordicsemi"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NordicSemiconductor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-08-02T12:43:37.000Z","updated_at":"2025-03-04T11:40:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa9ec1a9-5379-4246-93cb-67b5d2d15509","html_url":"https://github.com/NordicSemiconductor/IOS-Memfault-Library","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NordicSemiconductor%2FIOS-Memfault-Library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NordicSemiconductor%2FIOS-Memfault-Library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NordicSemiconductor%2FIOS-Memfault-Library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NordicSemiconductor%2FIOS-Memfault-Library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NordicSemiconductor","download_url":"https://codeload.github.com/NordicSemiconductor/IOS-Memfault-Library/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251450656,"owners_count":21591407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ble","bluetooth","bluetooth-low-energy","ios","macos","memfault","nordic","nordic-bluetooth","nordic-semiconductor","nordicsemi"],"created_at":"2024-11-11T18:25:53.751Z","updated_at":"2025-04-29T06:31:15.076Z","avatar_url":"https://github.com/NordicSemiconductor.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iOS nRF Memfault Library + Example App\n\nA Swift-based library for iOS/iPadOS/macOS can connects to a Bluetooth LE device supporting the Memfault Diagnostic Service, downloads data Chunks and uploads them to [the Memfault Console](https://docs.memfault.com).\n\nThe device is expected to support the Memfault Diagnostic Service, [as defined here](https://memfault.notion.site/Memfault-Diagnostic-GATT-Service-MDS-ffd5a430062649cd9bf6edbf64e2563b).\n\n# Library\n\n## Minimum OS Requirements\n\n* iOS: 15.0\n* macOS: 12.0\n\nIn all cases, **the Library requires an active Internet connection**. If an Error is encountered when uploading a Chunk of Data, **the BLE connection to the device will be dropped immediately** to ensure the least amount of Chunks of Data are lost.\n\n## Basic Usage\n\n```swift\n\nlet memfaultManager = MemfaultManager()\n// Connects to the Device and begins automagically streaming / uploading data.\nawait memfaultManager.connect(to: device)\n\n// To stop / disconnect.\nawait memfaultManager.disconnect(from: device)\n```\n\nMemfault's APIs take a `BluetoothDevice`, which is a very simple protocol requiring only the UUID String of a Device. A `CBPeripheral` extension is provided as part of the library, so you're free to pass-in your scanned `CBPeripheral` with no issues. \n\n## Advanced Usage\n\nIt is possible to listen to all state changes \u0026 errors as they occur from the Memfault Library, like so:\n\n```swift\n\nlet memfaultManager = MemfaultManager()\n\nlet connectionStream = await memfaultManager.connect(to: device)\ndo {\n    for try await newEvent in connectionStream {\n        switch newEvent.event {\n            // Logic for each Event.\n        }\n    }\n} catch {\n    // Error handling.\n}\n\n// Disconnect when needed.\nawait memfaultManager.disconnect(from: device)\n```\n\nFurthermore, it's also possible to manually ask the framework to upload a specific Chunk if an error were to happen:\n\n```swift\ntry await memfaultManager.upload(chunk, with: chunkAuth)\n```\n\nThis requires passing-in the `MemfaultChunkAuth` struct, which is received through an autentication event from the connection stream (`AsyncSequence`).\n\n# Example App\n\nThe aforementioned Advanced Usage is what enables a UI-based app to inform the user of what the underlying Memfault Library is doing, as well as providing manual control of connection / disconnection and forcing a Memfault Chunk of Data to be uploaded in case an error occurs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnordicsemiconductor%2Fios-memfault-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnordicsemiconductor%2Fios-memfault-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnordicsemiconductor%2Fios-memfault-library/lists"}