{"id":15019760,"url":"https://github.com/jancee/wjx-react-native-ble","last_synced_at":"2026-01-20T13:01:55.358Z","repository":{"id":57398565,"uuid":"111664756","full_name":"jancee/wjx-react-native-ble","owner":"jancee","description":"A useful BLE component for React Native, compatible with android and ios.","archived":false,"fork":false,"pushed_at":"2018-04-04T08:44:36.000Z","size":131,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-16T05:36:00.788Z","etag":null,"topics":["android","ble","ios","peripherals","react-native"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jancee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-22T09:40:52.000Z","updated_at":"2018-04-24T01:17:27.000Z","dependencies_parsed_at":"2022-09-04T03:21:31.769Z","dependency_job_id":null,"html_url":"https://github.com/jancee/wjx-react-native-ble","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jancee/wjx-react-native-ble","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancee%2Fwjx-react-native-ble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancee%2Fwjx-react-native-ble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancee%2Fwjx-react-native-ble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancee%2Fwjx-react-native-ble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jancee","download_url":"https://codeload.github.com/jancee/wjx-react-native-ble/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancee%2Fwjx-react-native-ble/sbom","scorecard":{"id":504908,"data":{"date":"2025-08-11","repo":{"name":"github.com/jancee/wjx-react-native-ble","commit":"1d3fc33751dc263b4778bb028cdfd942fd8d3b25"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"73 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-j4mr-9xw3-c9jx","Warn: Project is vulnerable to: GHSA-7p89-p6hx-q4fw","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f9cm-qmx5-m98h","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-qx2f-477c-35rq","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-446m-mv8f-q348","Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4","Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g","Warn: Project is vulnerable to: GHSA-gwg9-rgvj-4h5j","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-7mc5-chhp-fmc3","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-4cpg-3vgw-4877","Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7","Warn: Project is vulnerable to: GHSA-gff7-g5r8-mg8m","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-5v72-xg48-5rpm","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-h6q6-9hqw-rwfv","Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q","Warn: Project is vulnerable to: GHSA-crh6-fp67-6883","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T23:04:04.156Z","repository_id":57398565,"created_at":"2025-08-19T23:04:04.156Z","updated_at":"2025-08-19T23:04:04.156Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28603404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T12:01:53.233Z","status":"ssl_error","status_checked_at":"2026-01-20T12:01:46.545Z","response_time":117,"last_error":"SSL_read: 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":["android","ble","ios","peripherals","react-native"],"created_at":"2024-09-24T19:54:02.370Z","updated_at":"2026-01-20T13:01:55.339Z","avatar_url":"https://github.com/jancee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/wjx-react-native-ble.svg)](https://badge.fury.io/js/wjx-react-native-ble)\n\n[Click Here, 中文介绍](./README.zh.MD)'\n\n## wjx-react-native-ble\n\n## Supported Platforms\n- iOS 8+\n- Android (API 19+)\n\n## Install\nBoth approaches are described below.\n\n### Link Native Library with `react-native link`\n\n```shell\nreact-native link wjx-react-native-ble\n```\n\nAfter this step:\n * iOS should be linked properly.\n * Android will need one more step, you need to edit `android/app/build.gradle`:\n```gradle\n// file: android/app/build.gradle\n...\n\nandroid {\n    ...\n\n    defaultConfig {\n        ...\n        minSdkVersion 18 // \u003c--- make sure this is 18 or greater\n        ...\n    }\n    ...\n}\n```\n\n### Link Native Library Manually\n\n#### iOS\n- Open the node_modules/wjx-react-native-ble/ios folder and drag BleManager.xcodeproj into your Libraries group.\n- Check the \"Build Phases\"of your project and add \"libBleManager.a\" in the \"Link Binary With Libraries\" section.\n\n#### Android\n##### Update Gradle Settings\n\n```gradle\n// file: android/settings.gradle\n...\n\ninclude ':wjx-react-native-ble'\nproject(':wjx-react-native-ble').projectDir = new File(rootProject.projectDir, '../node_modules/wjx-react-native-ble/android')\n```\n##### Update Gradle Build\n\n```gradle\n// file: android/app/build.gradle\n...\n\nandroid {\n    ...\n\n    defaultConfig {\n        ...\n        minSdkVersion 18 // \u003c--- make sure this is 18 or greater\n        ...\n    }\n    ...\n}\n\ndependencies {\n    ...\n    compile project(':wjx-react-native-ble')\n}\n```\n##### Update Android Manifest\n\n```xml\n// file: android/app/src/main/AndroidManifest.xml\n...\n    \u003cuses-permission android:name=\"android.permission.BLUETOOTH\"/\u003e\n    \u003cuses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/\u003e\n    \u003cuses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" /\u003e\n...\n```\n\n##### Register React Package\n```java\n...\nimport it.innove.BleManagerPackage; // \u003c--- import\n\npublic class MainApplication extends Application implements ReactApplication {\n\n    ...\n\n    @Override\n    protected List\u003cReactPackage\u003e getPackages() {\n        return Arrays.\u003cReactPackage\u003easList(\n            new MainReactPackage(),\n            new BleManagerPackage() // \u003c------ add the package\n        );\n    }\n\n    ...\n}\n```\n## Note\n- Remember to use the `start` method before anything.\n- If you have problem with old devices try avoid to connect/read/write to a peripheral during scan.\n- Android API \u003e= 23 require the ACCESS_COARSE_LOCATION permission to scan for peripherals. React Native \u003e= 0.33 natively support PermissionsAndroid like in the example.\n- Before write, read or start notification you need to call `retrieveServices` method\n\n## Example\nLook in the [example](https://github.com/innoveit/wjx-react-native-ble/tree/master/example) project.\n\n## Methods\n\n### start(options)\nInit the module.\nReturns a `Promise` object.\n\n__Arguments__\n- `options` - `JSON`\n\nThe parameter is optional the configuration keys are:\n- `showAlert` - `Boolean` - [iOS only] Show or hide the alert if the bluetooth is turned off during initialization\n- `restoreIdentifierKey` - `String` - [iOS only] Unique key to use for CoreBluetooth state restoration\n- `forceLegacy` - `Boolean` - [Android only] Force to use the LegacyScanManager\n\n__Examples__\n```js\nBleManager.start({showAlert: false})\n  .then(() =\u003e {\n    // Success code\n    console.log('Module initialized');\n  });\n\n```\n\n### scan(serviceUUIDs, seconds, allowDuplicates, scanningOptions)\nScan for availables peripherals.\nReturns a `Promise` object.\n\n__Arguments__\n- `serviceUUIDs` - `Array of String` - the UUIDs of the services to looking for. On Android the filter works only for 5.0 or newer.\n- `seconds` - `Integer` - the amount of seconds to scan.\n- `allowDuplicates` - `Boolean` - [iOS only] allow duplicates in device scanning\n- `scanningOptions` - `JSON` - [Android only] after Android 5.0, user can control specific ble scan behaviors:\n  - `numberOfMatches` - `Number` - corresponding to [`setNumOfMatches`](https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setNumOfMatches(int))\n  - `matchMode` - `Number` - corresponding to [`setMatchMode`](https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setMatchMode(int))\n  - `scanMode` - `Number` - corresponding to [`setScanMode`](https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder.html#setScanMode(int))\n\n\n__Examples__\n```js\nBleManager.scan([], 5, true)\n  .then(() =\u003e {\n    // Success code\n    console.log('Scan started');\n  });\n\n```\n\n### stopScan()\nStop the scanning.\nReturns a `Promise` object.\n\n__Examples__\n```js\nBleManager.stopScan()\n  .then(() =\u003e {\n    // Success code\n    console.log('Scan stopped');\n  });\n\n```\n\n### connect(peripheralId)\nAttempts to connect to a peripheral. In many case if you can't connect you have to scan for the peripheral before.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral to connect.\n\n__Examples__\n```js\nBleManager.connect('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')\n  .then(() =\u003e {\n    // Success code\n    console.log('Connected');\n  })\n  .catch((error) =\u003e {\n    // Failure code\n    console.log(error);\n  });\n```\n\n### disconnect(peripheralId)\nDisconnect from a peripheral.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral to disconnect.\n\n__Examples__\n```js\nBleManager.disconnect('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')\n  .then(() =\u003e {\n    // Success code\n    console.log('Disconnected');\n  })\n  .catch((error) =\u003e {\n    // Failure code\n    console.log(error);\n  });\n```\n\n### enableBluetooth() [Android only]\nCreate the request to the user to activate the bluetooth.\nReturns a `Promise` object.\n\n__Examples__\n```js\nBleManager.enableBluetooth()\n  .then(() =\u003e {\n    // Success code\n    console.log('The bluetooh is already enabled or the user confirm');\n  })\n  .catch((error) =\u003e {\n    // Failure code\n    console.log('The user refuse to enable bluetooth');\n  });\n```\n\n### checkState()\nForce the module to check the state of BLE and trigger a BleManagerDidUpdateState event.\n\n__Examples__\n```js\nBleManager.checkState();\n```\n\n### startNotification(peripheralId, serviceUUID, characteristicUUID)\nStart the notification on the specified characteristic, you need to call `retrieveServices` method before.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral.\n- `serviceUUID` - `String` - the UUID of the service.\n- `characteristicUUID` - `String` - the UUID of the characteristic.\n\n__Examples__\n```js\nBleManager.startNotification('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')\n  .then(() =\u003e {\n    // Success code\n    console.log('Notification started');\n  })\n  .catch((error) =\u003e {\n    // Failure code\n    console.log(error);\n  });\n```\n\n### stopNotification(peripheralId, serviceUUID, characteristicUUID)\nStop the notification on the specified characteristic.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral.\n- `serviceUUID` - `String` - the UUID of the service.\n- `characteristicUUID` - `String` - the UUID of the characteristic.\n\n### read(peripheralId, serviceUUID, characteristicUUID)\nRead the current value of the specified characteristic, you need to call `retrieveServices` method before.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral.\n- `serviceUUID` - `String` - the UUID of the service.\n- `characteristicUUID` - `String` - the UUID of the characteristic.\n\n__Examples__\n```js\nBleManager.read('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')\n  .then((readData) =\u003e {\n    // Success code\n    console.log('Read: ' + readData);\n  })\n  .catch((error) =\u003e {\n    // Failure code\n    console.log(error);\n  });\n```\n\n### write(peripheralId, serviceUUID, characteristicUUID, data, maxByteSize)\nWrite with response to the specified characteristic, you need to call `retrieveServices` method before.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral.\n- `serviceUUID` - `String` - the UUID of the service.\n- `characteristicUUID` - `String` - the UUID of the characteristic.\n- `data` - `Byte array` - the data to write.\n- `maxByteSize` - `Integer` - specify the max byte size before splitting message\n\n__Data preparation__\n\nIf your data is not in byte array format you should convert it first. For strings you can use `convert-string` or other npm package in order to achieve that.\nInstall the package first:\n```shell\nnpm install convert-string\n```\nThen use it in your application:\n```js\n// Import/require in the beginning of the file\nimport { stringToBytes } from 'convert-string';\n// Convert data to byte array before write/writeWithoutResponse\nconst data = stringToBytes(yourStringData);\n```\nFeel free to use other packages or google how to convert into byte array if your data has other format.\n\n__Examples__\n```js\nBleManager.write('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', data)\n  .then(() =\u003e {\n    // Success code\n    console.log('Write: ' + data);\n  })\n  .catch((error) =\u003e {\n    // Failure code\n    console.log(error);\n  });\n```\n\n### writeWithoutResponse(peripheralId, serviceUUID, characteristicUUID, data, maxByteSize, queueSleepTime)\nWrite without response to the specified characteristic, you need to call `retrieveServices` method before.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral.\n- `serviceUUID` - `String` - the UUID of the service.\n- `characteristicUUID` - `String` - the UUID of the characteristic.\n- `data` - `Byte array` - the data to write.\n- `maxByteSize` - `Integer` - (Optional) specify the max byte size\n- `queueSleepTime` - `Integer` - (Optional) specify the wait time before each write if the data is greater than maxByteSize\n\n__Data preparation__\n\nIf your data is not in byte array format check info for the write function above.\n\n__Example__\n```js\nBleManager.writeWithoutResponse('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', data)\n  .then(() =\u003e {\n    // Success code\n    console.log('Writed: ' + data);\n  })\n  .catch((error) =\u003e {\n    // Failure code\n    console.log(error);\n  });\n```\n\n### readRSSI(peripheralId)\nRead the current value of the RSSI.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral.\n\n__Examples__\n```js\nBleManager.readRSSI('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')\n  .then((rssi) =\u003e {\n    // Success code\n    console.log('Current RSSI: ' + rssi);\n  })\n  .catch((error) =\u003e {\n    // Failure code\n    console.log(error);\n  });\n```\n\n### retrieveServices(peripheralId)\nRetrieve the peripheral's services and characteristics.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral.\n\n__Examples__\n```js\nBleManager.retrieveServices('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX')\n  .then((peripheralInfo) =\u003e {\n    // Success code\n    console.log('Peripheral info:', peripheralInfo);\n  });  \n```\n\n### getConnectedPeripherals(serviceUUIDs)\nReturn the connected peripherals.\nReturns a `Promise` object.\n\n__Arguments__\n- `serviceUUIDs` - `Array of String` - the UUIDs of the services to looking for.\n\n__Examples__\n```js\nBleManager.getConnectedPeripherals([])\n  .then((peripheralsArray) =\u003e {\n    // Success code\n    console.log('Connected peripherals: ' + peripheralsArray.length);\n  });\n\n```\n\n### getDiscoveredPeripherals()\nReturn the discovered peripherals after a scan.\nReturns a `Promise` object.\n\n__Examples__\n```js\nBleManager.getDiscoveredPeripherals([])\n  .then((peripheralsArray) =\u003e {\n    // Success code\n    console.log('Discovered peripherals: ' + peripheralsArray.length);\n  });\n\n```\n\n### removePeripheral(peripheralId)\nRemoves a disconnected peripheral from the cached list.\nIt is useful if the device is turned off, because it will be re-discovered upon turning on again.\nReturns a `Promise` object.\n\n__Arguments__\n- `peripheralId` - `String` - the id/mac address of the peripheral.\n\n### isPeripheralConnected(peripheralId, serviceUUIDs)\nCheck whether a specific peripheral is connected and return `true` or `false`.\nReturns a `Promise` object.\n\n__Examples__\n```js\nBleManager.isPeripheralConnected('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', [])\n  .then((isConnected) =\u003e {\n    if (isConnected) {\n      console.log('Peripheral is connected!');\n    } else {\n      console.log('Peripheral is NOT connected!');\n    }\n  });\n\n```\n\n## Events\n### BleManagerStopScan\nThe scanning for peripherals is ended.\n\n__Arguments__\n- `none`\n\n__Examples__\n```js\nbleManagerEmitter.addListener(\n    'BleManagerStopScan',\n    () =\u003e {\n        // Scanning is stopped\n    }\n);\n```\n\n###  BleManagerDidUpdateState\nThe BLE change state.\n\n__Arguments__\n- `state` - `String` - the new BLE state ('on'/'off').\n\n__Examples__\n```js\nbleManagerEmitter.addListener(\n    'BleManagerDidUpdateState',\n    (args) =\u003e {\n        // The new state: args.state\n    }\n);\n```\n\n###  BleManagerDiscoverPeripheral\nThe scanning find a new peripheral.\n\n__Arguments__\n- `id` - `String` - the id of the peripheral\n- `name` - `String` - the name of the peripheral\n- `rssi` - ` Number` - the RSSI value\n- `advertising` - `JSON` - the advertising payload, according to platforms:\n    - [Android] contains the raw `bytes` and  `data` (Base64 encoded string)\n    - [iOS] contains a JSON object with different keys according to [Apple's doc](https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/advertisement_data_retrieval_keys?language=objc), here are some examples:\n      - `kCBAdvDataChannel` - `Number`\n      - `kCBAdvDataIsConnectable` - `Number`\n      - `kCBAdvDataLocalName` - `String`\n      - `kCBAdvDataManufacturerData` - `JSON` - contains the raw `bytes` and  `data` (Base64 encoded string)\n\n__Examples__\n```js\nbleManagerEmitter.addListener(\n    'BleManagerDiscoverPeripheral',\n    (args) =\u003e {\n        // The id: args.id\n        // The name: args.name\n    }\n);\n```\n\n###  BleManagerDidUpdateValueForCharacteristic\nA characteristic notify a new value.\n\n__Arguments__\n- `peripheral` - `String` - the id of the peripheral\n- `characteristic` - `String` - the UUID of the characteristic\n- `value` - `String` - the read value in Hex format\n\n###  BleManagerConnectPeripheral\nA peripheral was connected.\n\n__Arguments__\n- `peripheral` - `String` - the id of the peripheral\n\n###  BleManagerDisconnectPeripheral\nA peripheral was disconnected.\n\n__Arguments__\n- `peripheral` - `String` - the id of the peripheral\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjancee%2Fwjx-react-native-ble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjancee%2Fwjx-react-native-ble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjancee%2Fwjx-react-native-ble/lists"}