{"id":15018567,"url":"https://github.com/nativescript-community/ble","last_synced_at":"2026-02-15T23:01:10.435Z","repository":{"id":37494649,"uuid":"50354816","full_name":"nativescript-community/ble","owner":"nativescript-community","description":"Connect to and interact with Bluetooth LE peripherals.","archived":false,"fork":false,"pushed_at":"2025-10-05T17:31:07.000Z","size":7353,"stargazers_count":199,"open_issues_count":31,"forks_count":80,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-10-05T19:24:01.685Z","etag":null,"topics":["ble","bluetooth","bluetooth-le","nativescript","nativescript-plugin"],"latest_commit_sha":null,"homepage":"https://nativescript-community.github.io/ble/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nativescript-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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":["farfromrefug"]}},"created_at":"2016-01-25T14:13:29.000Z","updated_at":"2025-10-05T17:31:11.000Z","dependencies_parsed_at":"2024-12-11T05:00:36.344Z","dependency_job_id":"57f286b7-2c46-4565-b2d0-0a719ecb1e73","html_url":"https://github.com/nativescript-community/ble","commit_stats":{"total_commits":527,"total_committers":31,"mean_commits":17.0,"dds":"0.40607210626185963","last_synced_commit":"74d49630f9ce350a9ded8b43bc0a512016406ff4"},"previous_names":["eddyverbruggen/nativescript-bluetooth"],"tags_count":70,"template":false,"template_full_name":null,"purl":"pkg:github/nativescript-community/ble","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativescript-community%2Fble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativescript-community%2Fble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativescript-community%2Fble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativescript-community%2Fble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nativescript-community","download_url":"https://codeload.github.com/nativescript-community/ble/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativescript-community%2Fble/sbom","scorecard":{"id":44177,"data":{"date":"2025-08-04","repo":{"name":"github.com/nativescript-community/ble","commit":"0c7e1ecbda1dbbeb4ebad32f52dca061ab83296d"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":2.5,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/nativescript-community/ble/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/nativescript-community/ble/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/nativescript-community/ble/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/nativescript-community/ble/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/nativescript-community/ble/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/nativescript-community/ble/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:80: update your workflow using https://app.stepsecurity.io/secureworkflow/nativescript-community/ble/release.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"89 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-vvj3-85vf-fgmw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-hwj9-h5mp-3pm3","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-jxvf-m3x5-mxwq","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-x4c5-c7rf-jjgv","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-p7v2-p9m8-qqg7","Warn: Project is vulnerable to: GHSA-7x97-j373-85x5","Warn: Project is vulnerable to: GHSA-7m48-wc93-9g85","Warn: Project is vulnerable to: GHSA-qqvq-6xgj-jw8g","Warn: Project is vulnerable to: GHSA-6r2x-8pq8-9489","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-4www-5p9h-95mh","Warn: Project is vulnerable to: GHSA-9gqv-wp59-fq42","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-c76h-2ccp-4975","Warn: Project is vulnerable to: GHSA-cxrh-j4jr-qwg3","Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6","Warn: Project is vulnerable to: GHSA-x574-m823-4x7w","Warn: Project is vulnerable to: GHSA-4r4m-qw57-chr8","Warn: Project is vulnerable to: GHSA-xcj6-pq6g-qj4x","Warn: Project is vulnerable to: GHSA-356w-63v5-8wf4","Warn: Project is vulnerable to: GHSA-859w-5945-r5v3","Warn: Project is vulnerable to: GHSA-5j4c-8p2g-v4jx","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T22:19:34.320Z","repository_id":37494649,"created_at":"2025-08-14T22:19:34.320Z","updated_at":"2025-08-14T22:19:34.320Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29491998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"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":["ble","bluetooth","bluetooth-le","nativescript","nativescript-plugin"],"created_at":"2024-09-24T19:52:07.584Z","updated_at":"2026-02-15T23:01:10.383Z","avatar_url":"https://github.com/nativescript-community.png","language":"TypeScript","readme":"\u003c!-- ⚠️ This README has been generated from the file(s) \"blueprint.md\" ⚠️--\u003e\u003c!-- ⚠️ This README has been generated from the file(s) \"blueprint.md\" ⚠️--\u003e\n\u003c!--  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      DO NOT EDIT THIS READEME DIRECTLY! Edit \"bluesprint.md\" instead.\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --\u003e\n\u003ch1 align=\"center\"\u003e@nativescript-community/ble\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\t\t\u003ca href=\"https://npmcharts.com/compare/@nativescript-community/ble?minimal=true\"\u003e\u003cimg alt=\"Downloads per month\" src=\"https://img.shields.io/npm/dm/@nativescript-community/ble.svg\" height=\"20\"/\u003e\u003c/a\u003e\r\n\u003ca href=\"https://www.npmjs.com/package/@nativescript-community/ble\"\u003e\u003cimg alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/@nativescript-community/ble.svg\" height=\"20\"/\u003e\u003c/a\u003e\n\t\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eConnect to and interact with Bluetooth LE peripherals.\u003c/b\u003e\u003c/br\u003e\n  \u003csub\u003e\u003csub\u003e\n\u003c/p\u003e\n\n\u003cbr /\u003e\n\n\n\r\n[](#table-of-contents)\r\n\r\n\r\n[](#table-of-contents)\r\n\r\n## Table of Contents\n\n* [Installation](#installation)\r\n* [API](#api)\r\n\t\t* [Prerequisites](#prerequisites)\r\n\t\t* [Discovery](#discovery)\r\n\t\t* [Connectivity](#connectivity)\r\n\t\t* [Interaction](#interaction)\r\n\t\t* [Debugging](#debugging)\r\n\t* [isBluetoothEnabled](#isbluetoothenabled)\r\n\t* [Permissions (Android)](#permissions-android)\r\n\t* [requestLocationPermission](#requestlocationpermission)\r\n\t* [enable (Android only)](#enable-android-only)\r\n\t* [startScanning](#startscanning)\r\n\t\t* [seconds](#seconds)\r\n\t\t* [avoidDuplicates](#avoidduplicates)\r\n\t\t* [skipPermissionCheck](#skippermissioncheck)\r\n\t\t* [filters](#filters)\r\n\t\t* [onDiscovered](#ondiscovered)\r\n\t* [stopScanning](#stopscanning)\r\n\t* [connect](#connect)\r\n\t* [disconnect](#disconnect)\r\n\t* [read](#read)\r\n\t* [write](#write)\r\n\t* [writeWithoutResponse](#writewithoutresponse)\r\n\t* [startNotifying](#startnotifying)\r\n\t* [stopNotifying](#stopnotifying)\r\n\t* [Examples:](#examples)\r\n* [Demos and Development](#demos-and-development)\r\n\t* [Repo Setup](#repo-setup)\r\n\t* [Build](#build)\r\n\t* [Demos](#demos)\r\n* [Contributing](#contributing)\r\n\t* [Update repo ](#update-repo-)\r\n\t* [Update readme ](#update-readme-)\r\n\t* [Update doc ](#update-doc-)\r\n\t* [Publish](#publish)\r\n\t* [modifying submodules](#modifying-submodules)\r\n* [Questions](#questions)\n\n\r\n[](#installation)\r\n\r\n\r\n[](#installation)\r\n\r\n## Installation\nRun the following command from the root of your project:\n\n`ns plugin add @nativescript-community/ble`\n\n\r\n[](#api)\r\n\r\n\r\n[](#api)\r\n\r\n## API\nWant to dive in quickly? Check out [the demo app](https://github.com/nativescript-community/ble/tree/master/demo)! Otherwise, mix and match these functions as you see fit:\n\n#### Prerequisites\n- [isBluetoothEnabled](#isbluetoothenabled)\n- [requestLocationPermission](#requestLocationPermission)\n- [hasLocationPermission](#haslocationpermission)\n- [enable (Android only)](#enable-android-only)\n\n#### Discovery\n- [startScanning](#startscanning)\n- [stopScanning](#stopscanning)\n\n#### Connectivity\n- [connect](#connect)\n- [disconnect](#disconnect)\n\n#### Interaction\n- [read](#read)\n- [write](#write)\n- [startNotifying](#startnotifying)\n- [stopNotifying](#stopnotifying)\n\n#### Debugging\n- [setCharacteristicLogging](#setcharacteristiclogging)\n\n\n### isBluetoothEnabled\nReports if bluetooth is enabled.\n\n```typescript\n// require the plugin\nimport { Bluetooth } from '@nativescript-community/ble';\nvar bluetooth = new Bluetooth();\n\nbluetooth.isBluetoothEnabled().then(\n  function(enabled) {\n    console.log(\"Enabled? \" + enabled);\n  }\n);\n```\n### Permissions (Android)\n\nOn Android \u003e= 6 and \u003c 12 you need to request permissions to be able to interact with a Bluetooth peripheral (when the app is in the background) when targeting API level 23+. You need `BLUETOOTH` and `ACCESS_FINE_LOCATION`. You should read the doc [here](https://developer.android.com/develop/connectivity/bluetooth/bt-permissions)\n\nOn android \u003e= 12 you need new permissions. You should read the doc [here](https://developer.android.com/develop/connectivity/bluetooth/bt-permissions)\nNote that for `BLUETOOTH` and `BLUETOOTH_ADMIN` you don't require runtime permission; adding those to `AndroidManifest.xml` suffices.\n\nNote that `hasLocationPermission ` will return true when:\n* You're running this on iOS, or\n* You're targeting an API level lower than 23, or\n* You're using a device running Android \u003c 6, or\n* You've already granted permission.\n\n```typescript\nbluetooth.hasLocationPermission().then(\n  function(granted) {\n    // if this is 'false' you probably want to call 'requestLocationPermission' now\n    console.log(\"Has Location Permission? \" + granted);\n  }\n);\n```\n\n### requestLocationPermission\n__Since plugin version 1.2.0 the `startScanning` function will handle this internally so it's no longer mandatory to add permission checks to your code.__\n\n```typescript\n// if no permission was granted previously this will open a user consent screen\nbluetooth.requestLocationPermission().then(\n  function(granted) {\n    console.log(\"Location permission requested, user granted? \" + granted);\n  }\n);\n```\n\n### enable (Android only)\nThe promise will be rejected on iOS\n\n```typescript\n// This turns bluetooth on, will return false if the user denied the request.\nbluetooth.enable().then(\n  function(enabled) {\n    // use Bluetooth features if enabled is true \n  }\n);\n```\n\n### startScanning\nA few of the optional params require a bit of explanation:\n\n#### seconds\nScanning for peripherals drains the battery quickly, so you better not scan any longer than necessary. If a peripheral is in range and not engaged in another connection it usually pops up in under a second. If you don't pass in a number of seconds you will need to manually call `stopScanning`.\n\n#### avoidDuplicates\nSet this to true if you don't want duplicates with the same serviceUUID reported in \"onDiscovered\" callback.\nIf true, only the first discovered peripheral with the same serviceUUID will be reported.\n\n#### skipPermissionCheck\nSet this to true if you don't want the plugin to check (and request) the required Bluetooth permissions.\nParticularly useful if you're running this function on a non-UI thread (ie. a Worker).\nRelevant on Android only.\n\n#### filters\nIt's inefficient to scan for all available Bluetooth peripherals and have them report all services they offer.\nMoreover on Android if we don't use filters we must have location permissions and have GPS enabled\n\nIf you're only interested in finding a heartrate peripheral for instance, pass in service UUID `'180d'` like this: filters: [{serviceUUID:'180d'}]. If you add 2 or more (comma separated) services then only peripherals supporting ALL those services will match.\n\nNote that UUID's are ALWAYS strings; don't pass integers.\n\n#### onDiscovered\nWhile scanning the plugin will immediately report back uniquely discovered peripherals.\n\nThis function will receive an object representing the peripheral which contains these properties (and types):\n* `UUID: string`\n* `name: string`\n* `RSSI: number` (relative signal strength, can be used for distance measurement)\n* `services?:` (optional - this is set once connected to the peripheral)\n* `manufacturerId?: number` (optional)\n* `advertismentData?:  {\n    localName?:string\n    manufacturerData?: ArrayBuffer;\n    serviceUUIDs?: string[];\n    txPowerLevel?:number,\n    flags?:number\n  }` (optional)\n\n```typescript\nbluetooth.startScanning({\n  filters: [{serviceUUID:'180d'}],\n  seconds: 4,\n  onDiscovered: function (peripheral) {\n  \tconsole.log(\"Periperhal found with UUID: \" + peripheral.UUID);\n  }\n}).then(function() {\n  console.log(\"scanning complete\");\n}, function (err) {\n  console.log(\"error while scanning: \" + err);\n});\n```\n\n### stopScanning\nAt any time during a scan, being one where you passed in a number or seconds or not, you can stop the scan by calling this function.\n\nYou may for instance want to stop scanning when the peripheral you found in `startScanning`'s `onDiscovered` callback matches your criteria.\n\n```typescript\nbluetooth.stopScanning().then(function() {\n  console.log(\"scanning stopped\");\n});\n```\n\n### connect\nPass in the UUID of the peripheral you want to connect to and once a connection has been established the `onConnected` callback function will be invoked. This callback will received the peripheral object as before, but it's now enriched with a `services` property. An example of the returned peripheral object could be:\n\n```typescript\n  peripheral: {\n    UUID: '3424-542-4534-53454',\n    name: 'Polar P7 Heartrate Monitor',\n    RSSI: '-57',\n    services: [{    \n      UUID: '180d',\n      name: 'Heartrate service',\n      characteristics: [{\n        UUID: '34534-54353-234324-343',\n        name: 'Heartrate characteristic',\n        properties: {\n          read: true,\n          write: false,\n          writeWithoutResponse: false,\n          notify: true\n        }\n      }]\n    }]\n  }\n```\n\nHere's the `connect` function in action with an implementation of `onConnected` that simply dumps the entire peripheral object to the console:\n\n```typescript\nbluetooth.connect({\n  UUID: '04343-23445-45243-423434',\n  onConnected: function (peripheral) {\n  \tconsole.log(\"Periperhal connected with UUID: \" + peripheral.UUID);\n\n  \t// the peripheral object now has a list of available services:\n  \tperipheral.services.forEach(function(service) {\n  \t  console.log(\"service found: \" + JSON.stringify(service));\n   });\n  },\n  onDisconnected: function (peripheral) {\n  \tconsole.log(\"Periperhal disconnected with UUID: \" + peripheral.UUID);\n  }\n});\n```\n\nAlso note that `onDisconnected` function: if you try to interact with the peripheral after this event you risk crashing your app.\n\n\n### disconnect\nOnce done interacting with the peripheral be a good citizen and disconnect. This will allow other applications establishing a connection.\n\n```typescript\nbluetooth.disconnect({\n  UUID: '34234-5453-4453-54545'\n}).then(function() {\n  console.log(\"disconnected successfully\");\n}, function (err) {\n  // in this case you're probably best off treating this as a disconnected peripheral though\n  console.log(\"disconnection error: \" + err);\n});\n```\n\n### read\nIf a peripheral has a service that has a characteristic where `properties.read` is `true` then you can call the `read` function to retrieve the current state (value) of the characteristic.\n\nThe promise will receive an object like this:\n\n```typescript\n{\n  value: \u003cArrayBuffer\u003e, // an ArrayBuffer which you can use to decode (see example below)\n  ios: \u003c72\u003e, // the platform-specific binary value of the characteristic: NSData (iOS), byte[] (Android)\n  android: \u003c72\u003e, // the platform-specific binary value of the characteristic: NSData (iOS), byte[] (Android)\n  characteristicUUID: '434234-234234-234234-434'\n}\n```\n\nArmed with this knowledge, let's invoke the `read` function:\n\n```typescript\nbluetooth.read({\n  peripheralUUID: '34234-5453-4453-54545',\n  serviceUUID: '180d',\n  characteristicUUID: '3434-45234-34324-2343'\n}).then(function(result) {\n  // fi. a heartrate monitor value (Uint8) can be retrieved like this:\n  var data = new Uint8Array(result.value);\n  console.log(\"Your heartrate is: \" + data[1] + \" bpm\");  \n}, function (err) {\n  console.log(\"read error: \" + err);\n});\n```\n\n### write\nIf a peripheral has a service that has a characteristic where `properties.write` is `true` then you can call the `write` function to update the current state (value) of the characteristic.\n\nThe value may be a string or any array type value. If you pass a string you should pass the encoding too\n\n```typescript\nbluetooth.write({\n  peripheralUUID: '34134-5453-4453-54545',\n  serviceUUID: '180e',\n  characteristicUUID: '3424-45234-34324-2343',\n  value: [1]\n}).then(function(result) {\n  console.log(\"value written\");\n}, function (err) {\n  console.log(\"write error: \" + err);\n});\n```\n\n### writeWithoutResponse\nSame API as `write`, except that when the promise is invoked the value has not been written yet; it has only been requested to be written an no response will be received when it has.\n\n### startNotifying\nIf a peripheral has a service that has a characteristic where `properties.notify` is `true` then you can call the `startNotifying` function to retrieve the value changes of the characteristic.\n\nUsage is very much like `read`, but the result won't be sent to the promise, but to the `onNotify` callback function you pass in. This is because multiple notifications can be received and a promise can only resolve once. The value of the object sent to `onNotify` is the same as the one you get in the promise of `read`.\n\n```typescript\nbluetooth.startNotifying({\n  peripheralUUID: '34234-5453-4453-54545',\n  serviceUUID: '180d',\n  characteristicUUID: '3434-45234-34324-2343',\n  onNotify: function (result) {\n    // see the read example for how to decode ArrayBuffers\n\tconsole.log(\"read: \" + JSON.stringify(result));\n  }  \n}).then(function() {\n  console.log(\"subscribed for notifications\");\n});\n```\n\n### stopNotifying\nEnough is enough. When you're no longer interested in the values the peripheral is sending you do this:\n\n```typescript\nbluetooth.stopNotifying({\n  peripheralUUID: '34234-5453-4453-54545',\n  serviceUUID: '180d',\n  characteristicUUID: '3434-45234-34324-2343'\n}).then(function() {\n  console.log(\"unsubscribed for notifications\");\n}, function (err) {\n  console.log(\"unsubscribe error: \" + err);\n});\n```\n\n### Examples:\n\n- [Basic](demo-snippets/vue/Basic.vue)\n  - A basic example showing that overriding N gestures works, even in modals\n\n\r\n[](#demos-and-development)\r\n\r\n\r\n[](#demos-and-development)\r\n\r\n## Demos and Development\n\n\n### Repo Setup\n\nThe repo uses submodules. If you did not clone with ` --recursive` then you need to call\n```\ngit submodule update --init\n```\n\nThe package manager used to install and link dependencies must be `pnpm` or `yarn`. `npm` wont work.\n\nTo develop and test:\nif you use `yarn` then run `yarn`\nif you use `pnpm` then run `pnpm i`\n\n**Interactive Menu:**\n\nTo start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts.\n\n### Build\n\n```bash\nnpm run build.all\n```\nWARNING: it seems `yarn build.all` wont always work (not finding binaries in `node_modules/.bin`) which is why the doc explicitly uses `npm run`\n\n### Demos\n\n```bash\nnpm run demo.[ng|react|svelte|vue].[ios|android]\n\nnpm run demo.svelte.ios # Example\n```\n\nDemo setup is a bit special in the sense that if you want to modify/add demos you dont work directly in `demo-[ng|react|svelte|vue]`\nInstead you work in `demo-snippets/[ng|react|svelte|vue]`\nYou can start from the `install.ts` of each flavor to see how to register new demos \n\n\r\n[](#contributing)\r\n\r\n\r\n[](#contributing)\r\n\r\n## Contributing\n\n### Update repo \n\nYou can update the repo files quite easily\n\nFirst update the submodules\n\n```bash\nnpm run update\n```\n\nThen commit the changes\nThen update common files\n\n```bash\nnpm run sync\n```\nThen you can run `yarn|pnpm`, commit changed files if any\n\n### Update readme \n```bash\nnpm run readme\n```\n\n### Update doc \n```bash\nnpm run doc\n```\n\n### Publish\n\nThe publishing is completely handled by `lerna` (you can add `-- --bump major` to force a major release)\nSimply run \n```shell\nnpm run publish\n```\n\n### modifying submodules\n\nThe repo uses https:// for submodules which means you won't be able to push directly into the submodules.\nOne easy solution is t modify `~/.gitconfig` and add\n```\n[url \"ssh://git@github.com/\"]\n\tpushInsteadOf = https://github.com/\n```\n\n\r\n[](#questions)\r\n\r\n\r\n[](#questions)\r\n\r\n## Questions\n\nIf you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).\n\r\n[](#demos-and-development)\r\n\r\n## Demos and Development\n\n\n### Repo Setup\n\nThe repo uses submodules. If you did not clone with ` --recursive` then you need to call\n```\ngit submodule update --init\n```\n\nThe package manager used to install and link dependencies must be `pnpm` or `yarn`. `npm` wont work.\n\nTo develop and test:\nif you use `yarn` then run `yarn`\nif you use `pnpm` then run `pnpm i`\n\n**Interactive Menu:**\n\nTo start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts.\n\n### Build\n\n```bash\nnpm run build.all\n```\nWARNING: it seems `yarn build.all` wont always work (not finding binaries in `node_modules/.bin`) which is why the doc explicitly uses `npm run`\n\n### Demos\n\n```bash\nnpm run demo.[ng|react|svelte|vue].[ios|android]\n\nnpm run demo.svelte.ios # Example\n```\n\nDemo setup is a bit special in the sense that if you want to modify/add demos you dont work directly in `demo-[ng|react|svelte|vue]`\nInstead you work in `demo-snippets/[ng|react|svelte|vue]`\nYou can start from the `install.ts` of each flavor to see how to register new demos \n\n\r\n[](#contributing)\r\n\r\n## Contributing\n\n### Update repo \n\nYou can update the repo files quite easily\n\nFirst update the submodules\n\n```bash\nnpm run update\n```\n\nThen commit the changes\nThen update common files\n\n```bash\nnpm run sync\n```\nThen you can run `yarn|pnpm`, commit changed files if any\n\n### Update readme \n```bash\nnpm run readme\n```\n\n### Update doc \n```bash\nnpm run doc\n```\n\n### Publish\n\nThe publishing is completely handled by `lerna` (you can add `-- --bump major` to force a major release)\nSimply run \n```shell\nnpm run publish\n```\n\n### modifying submodules\n\nThe repo uses https:// for submodules which means you won't be able to push directly into the submodules.\nOne easy solution is t modify `~/.gitconfig` and add\n```\n[url \"ssh://git@github.com/\"]\n\tpushInsteadOf = https://github.com/\n```\n\r\n[](#questions)\r\n\r\n## Questions\n\nIf you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).","funding_links":["https://github.com/sponsors/farfromrefug"],"categories":["Plugins"],"sub_categories":["Utility Plugins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript-community%2Fble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnativescript-community%2Fble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript-community%2Fble/lists"}