{"id":33167557,"url":"https://github.com/don/BluetoothSerial","last_synced_at":"2025-11-20T18:01:03.104Z","repository":{"id":8354201,"uuid":"9916342","full_name":"don/BluetoothSerial","owner":"don","description":"Cordova (PhoneGap) Plugin for Serial Communication over Bluetooth","archived":false,"fork":false,"pushed_at":"2024-04-18T07:27:15.000Z","size":9742,"stargazers_count":1086,"open_issues_count":83,"forks_count":670,"subscribers_count":68,"default_branch":"master","last_synced_at":"2025-10-03T06:52:36.337Z","etag":null,"topics":["bluetooth","bluetooth-low-energy","cordova-plugin"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"DarkStorm652/DarkBot","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/don.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2013-05-07T16:25:19.000Z","updated_at":"2025-09-14T07:59:59.000Z","dependencies_parsed_at":"2024-01-07T21:03:07.011Z","dependency_job_id":"8c33bf88-fa3d-4420-886a-ce095bbcbeea","html_url":"https://github.com/don/BluetoothSerial","commit_stats":{"total_commits":238,"total_committers":15,"mean_commits":"15.866666666666667","dds":"0.25210084033613445","last_synced_commit":"86017ed84ec8fcf0e98c27f11ff698f6f9e0e8c7"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/don/BluetoothSerial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/don%2FBluetoothSerial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/don%2FBluetoothSerial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/don%2FBluetoothSerial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/don%2FBluetoothSerial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/don","download_url":"https://codeload.github.com/don/BluetoothSerial/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/don%2FBluetoothSerial/sbom","scorecard":{"id":351431,"data":{"date":"2025-08-11","repo":{"name":"github.com/don/BluetoothSerial","commit":"86017ed84ec8fcf0e98c27f11ff698f6f9e0e8c7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/27 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":"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":"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":"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":"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":"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T08:23:02.394Z","repository_id":8354201,"created_at":"2025-08-18T08:23:02.401Z","updated_at":"2025-08-18T08:23:02.401Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285484486,"owners_count":27179744,"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","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","bluetooth-low-energy","cordova-plugin"],"created_at":"2025-11-16T00:00:45.513Z","updated_at":"2025-11-20T18:01:03.093Z","avatar_url":"https://github.com/don.png","language":"Objective-C","readme":"# Bluetooth Serial Plugin for PhoneGap\n\nThis plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.\n\nAndroid and Windows Phone use Classic Bluetooth.  iOS uses Bluetooth Low Energy.\n\n## Supported Platforms\n\n* Android\n* iOS with [RedBearLab](http://redbearlab.com) BLE hardware, [Adafruit Bluefruit LE](http://www.adafruit.com/products/1697), [Laird BL600](http://www.lairdtech.com/Products/Embedded-Wireless-Solutions/Bluetooth-Radio-Modules/BL600-Series/#.VBI7AS5dUzI), [BlueGiga](https://bluegiga.zendesk.com/entries/29185293--BGScript-spp-over-ble-AT-command-SPP-implementation-for-BLE), or [HC-02](http://www.hc01.com/productdetail?productid=20180314021)\n* Windows Phone 8\n* Browser (Testing only. See [comments](https://github.com/don/BluetoothSerial/blob/master/src/browser/bluetoothSerial.js).)\n\n[Supporting other Bluetooth Low Energy hardware](#supporting-other-ble-hardware)\n\n## Limitations\n\n * The phone must initiate the Bluetooth connection\n * iOS Bluetooth Low Energy requires iPhone 4S, iPhone5, iPod 5, or iPad3+\n * Will *not* connect Android to Android[*](https://github.com/don/BluetoothSerial/issues/50#issuecomment-66405396)\n * Will *not* connect iOS to iOS[*](https://github.com/don/BluetoothSerial/issues/75#issuecomment-52591397)\n\n# Installing\n\nInstall with Cordova cli\n\n    $ cordova plugin add cordova-plugin-bluetooth-serial\n\nNote that this plugin's id changed from `com.megster.cordova.bluetoothserial` to `cordova-plugin-bluetooth-serial` as part of the migration from the [Cordova plugin repo](http://plugins.cordova.io/) to [npm](https://www.npmjs.com/).\n\n# Examples\n\nThere are some [sample projects](https://github.com/don/BluetoothSerial/tree/master/examples) included with the plugin.\n\n# API\n\n## Methods\n\n- [bluetoothSerial.connect](#connect)\n- [bluetoothSerial.connectInsecure](#connectInsecure)\n- [bluetoothSerial.disconnect](#disconnect)\n- [bluetoothSerial.write](#write)\n- [bluetoothSerial.available](#available)\n- [bluetoothSerial.read](#read)\n- [bluetoothSerial.readUntil](#readuntil)\n- [bluetoothSerial.subscribe](#subscribe)\n- [bluetoothSerial.unsubscribe](#unsubscribe)\n- [bluetoothSerial.subscribeRawData](#subscriberawdata)\n- [bluetoothSerial.unsubscribeRawData](#unsubscriberawdata)\n- [bluetoothSerial.clear](#clear)\n- [bluetoothSerial.list](#list)\n- [bluetoothSerial.isEnabled](#isenabled)\n- [bluetoothSerial.isConnected](#isconnected)\n- [bluetoothSerial.readRSSI](#readrssi)\n- [bluetoothSerial.showBluetoothSettings](#showbluetoothsettings)\n- [bluetoothSerial.enable](#enable)\n- [bluetoothSerial.discoverUnpaired](#discoverunpaired)\n- [bluetoothSerial.setDeviceDiscoveredListener](#setdevicediscoveredlistener)\n- [bluetoothSerial.clearDeviceDiscoveredListener](#cleardevicediscoveredlistener)\n- [bluetoothSerial.setName](#setname)\n- [bluetoothSerial.setDiscoverable](#setdiscoverable)\n\n## connect\n\nConnect to a Bluetooth device.\n\n    bluetoothSerial.connect(macAddress_or_uuid, connectSuccess, connectFailure);\n\n### Description\n\nFunction `connect` connects to a Bluetooth device.  The callback is long running.  Success will be called when the connection is successful.  Failure is called if the connection fails, or later if the connection disconnects. An error message is passed to the failure callback.\n\n#### Android\nFor Android, `connect` takes a MAC address of the remote device.\n\n#### iOS\nFor iOS, `connect` takes the UUID of the remote device.  Optionally, you can pass an **empty string** and the plugin will connect to the first BLE peripheral.\n\n#### Windows Phone\nFor Windows Phone, `connect` takes a MAC address of the remote device. The MAC address can optionally surrounded with parenthesis. e.g. `(AA:BB:CC:DD:EE:FF)`\n\n\n### Parameters\n\n- __macAddress_or_uuid__: Identifier of the remote device.\n- __connectSuccess__: Success callback function that is invoked when the connection is successful.\n- __connectFailure__: Error callback function, invoked when error occurs or the connection disconnects.\n\n## connectInsecure\n\nConnect insecurely to a Bluetooth device.\n\n    bluetoothSerial.connectInsecure(macAddress, connectSuccess, connectFailure);\n\n### Description\n\nFunction `connectInsecure` works like [connect](#connect), but creates an insecure connection to a Bluetooth device.  See the [Android docs](http://goo.gl/1mFjZY) for more information.\n\n#### Android\nFor Android, `connectInsecure` takes a macAddress of the remote device.\n\n#### iOS\n`connectInsecure` is **not supported** on iOS.\n\n#### Windows Phone\n`connectInsecure` is **not supported** on Windows Phone.\n\n### Parameters\n\n- __macAddress__: Identifier of the remote device.\n- __connectSuccess__: Success callback function that is invoked when the connection is successful.\n- __connectFailure__: Error callback function, invoked when error occurs or the connection disconnects.\n\n\n## disconnect\n\nDisconnect.\n\n    bluetoothSerial.disconnect([success], [failure]);\n\n### Description\n\nFunction `disconnect` disconnects the current connection.\n\n### Parameters\n\n- __success__: Success callback function that is invoked after the connection is disconnected. [optional]\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n## write\n\nWrites data to the serial port.\n\n    bluetoothSerial.write(data, success, failure);\n\n### Description\n\nFunction `write` data to the serial port. Data can be an ArrayBuffer, string, array of integers, or a Uint8Array.\n\nInternally string, integer array, and Uint8Array are converted to an ArrayBuffer. String conversion assume 8bit characters.\n\n### Parameters\n\n- __data__: ArrayBuffer of data\n- __success__: Success callback function that is invoked when the connection is successful. [optional]\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    // string\n    bluetoothSerial.write(\"hello, world\", success, failure);\n\n    // array of int (or bytes)\n    bluetoothSerial.write([186, 220, 222], success, failure);\n\n    // Typed Array\n    var data = new Uint8Array(4);\n    data[0] = 0x41;\n    data[1] = 0x42;\n    data[2] = 0x43;\n    data[3] = 0x44;\n    bluetoothSerial.write(data, success, failure);\n\n    // Array Buffer\n    bluetoothSerial.write(data.buffer, success, failure);\n\n## available\n\nGets the number of bytes of data available.\n\n    bluetoothSerial.available(success, failure);\n\n### Description\n\nFunction `available` gets the number of bytes of data available.  The bytes are passed as a parameter to the success callback.\n\n### Parameters\n\n- __success__: Success callback function that is invoked when the connection is successful. [optional]\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.available(function (numBytes) {\n        console.log(\"There are \" + numBytes + \" available to read.\");\n    }, failure);\n\n## read\n\nReads data from the buffer.\n\n    bluetoothSerial.read(success, failure);\n\n### Description\n\nFunction `read` reads the data from the buffer. The data is passed to the success callback as a String.  Calling `read` when no data is available will pass an empty String to the callback.\n\n### Parameters\n\n- __success__: Success callback function that is invoked with the number of bytes available to be read.\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.read(function (data) {\n        console.log(data);\n    }, failure);\n\n## readUntil\n\nReads data from the buffer until it reaches a delimiter.\n\n    bluetoothSerial.readUntil('\\n', success, failure);\n\n### Description\n\nFunction `readUntil` reads the data from the buffer until it reaches a delimiter.  The data is passed to the success callback as a String.  If the buffer does not contain the delimiter, an empty String is passed to the callback. Calling `read` when no data is available will pass an empty String to the callback.\n\n### Parameters\n\n- __delimiter__: delimiter\n- __success__: Success callback function that is invoked with the data.\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.readUntil('\\n', function (data) {\n        console.log(data);\n    }, failure);\n\n## subscribe\n\nSubscribe to be notified when data is received.\n\n    bluetoothSerial.subscribe('\\n', success, failure);\n\n### Description\n\nFunction `subscribe` registers a callback that is called when data is received.  A delimiter must be specified.  The callback is called with the data as soon as the delimiter string is read.  The callback is a long running callback and will exist until `unsubscribe` is called.\n\n### Parameters\n\n- __delimiter__: delimiter\n- __success__: Success callback function that is invoked with the data.\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    // the success callback is called whenever data is received\n    bluetoothSerial.subscribe('\\n', function (data) {\n        console.log(data);\n    }, failure);\n\n## unsubscribe\n\nUnsubscribe from a subscription.\n\n    bluetoothSerial.unsubscribe(success, failure);\n\n### Description\n\nFunction `unsubscribe` removes any notification added by `subscribe` and kills the callback.\n\n### Parameters\n\n- __success__: Success callback function that is invoked when the connection is successful. [optional]\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.unsubscribe();\n\n## subscribeRawData\n\nSubscribe to be notified when data is received.\n\n    bluetoothSerial.subscribeRawData(success, failure);\n\n### Description\n\nFunction `subscribeRawData` registers a callback that is called when data is received. The callback is called immediately when data is received. The data is sent to callback as an ArrayBuffer. The callback is a long running callback and will exist until `unsubscribeRawData` is called.\n\n### Parameters\n\n- __success__: Success callback function that is invoked with the data.\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    // the success callback is called whenever data is received\n    bluetoothSerial.subscribeRawData(function (data) {\n        var bytes = new Uint8Array(data);\n        console.log(bytes);\n    }, failure);\n\n## unsubscribeRawData\n\nUnsubscribe from a subscription.\n\n    bluetoothSerial.unsubscribeRawData(success, failure);\n\n### Description\n\nFunction `unsubscribeRawData` removes any notification added by `subscribeRawData` and kills the callback.\n\n### Parameters\n\n- __success__: Success callback function that is invoked when the connection is successful. [optional]\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.unsubscribeRawData();\n\n## clear\n\nClears data in the buffer.\n\n    bluetoothSerial.clear(success, failure);\n\n### Description\n\nFunction `clear` removes any data from the receive buffer.\n\n### Parameters\n\n- __success__: Success callback function that is invoked when the connection is successful. [optional]\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n## list\n\nLists bonded devices\n\n    bluetoothSerial.list(success, failure);\n\n### Description\n\n#### Android\n\nFunction `list` lists the paired Bluetooth devices.  The success callback is called with a list of objects.\n\nExample list passed to success callback.  See [BluetoothDevice](http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#getName\\(\\)) and [BluetoothClass#getDeviceClass](http://developer.android.com/reference/android/bluetooth/BluetoothClass.html#getDeviceClass\\(\\)).\n\n    [{\n        \"class\": 276,\n        \"id\": \"10:BF:48:CB:00:00\",\n        \"address\": \"10:BF:48:CB:00:00\",\n        \"name\": \"Nexus 7\"\n    }, {\n        \"class\": 7936,\n        \"id\": \"00:06:66:4D:00:00\",\n        \"address\": \"00:06:66:4D:00:00\",\n        \"name\": \"RN42\"\n    }]\n\n#### iOS\n\nFunction `list` lists the discovered Bluetooth Low Energy peripheral.  The success callback is called with a list of objects.\n\nExample list passed to success callback for iOS.\n\n    [{\n        \"id\": \"CC410A23-2865-F03E-FC6A-4C17E858E11E\",\n        \"uuid\": \"CC410A23-2865-F03E-FC6A-4C17E858E11E\",\n        \"name\": \"Biscuit\",\n        \"rssi\": -68\n    }]\n\nThe advertised RSSI **may** be included if available.\n\n#### Windows Phone\n\nFunction `list` lists the paired Bluetooth devices.  The success callback is called with a list of objects.\n\nExample list passed to success callback for Windows Phone.\n\n    [{\n        \"id\": \"(10:BF:48:CB:00:00)\",\n        \"name\": \"Nexus 7\"\n    }, {\n        \"id\": \"(00:06:66:4D:00:00)\",\n        \"name\": \"RN42\"\n    }]\n\n### Note\n\n`id` is the generic name for `uuid` or [mac]`address` so that code can be platform independent.\n\n### Parameters\n\n- __success__: Success callback function that is invoked with a list of bonded devices.\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.list(function(devices) {\n        devices.forEach(function(device) {\n            console.log(device.id);\n        })\n    }, failure);\n\n## isConnected\n\nReports the connection status.\n\n    bluetoothSerial.isConnected(success, failure);\n\n### Description\n\nFunction `isConnected` calls the success callback when connected to a peer and the failure callback when *not* connected.\n\n### Parameters\n\n- __success__: Success callback function, invoked when device connected.\n- __failure__: Error callback function, invoked when device is NOT connected.\n\n### Quick Example\n\n    bluetoothSerial.isConnected(\n        function() {\n            console.log(\"Bluetooth is connected\");\n        },\n        function() {\n            console.log(\"Bluetooth is *not* connected\");\n        }\n    );\n\n## isEnabled\n\nReports if bluetooth is enabled.\n\n    bluetoothSerial.isEnabled(success, failure);\n\n### Description\n\nFunction `isEnabled` calls the success callback when bluetooth is enabled and the failure callback when bluetooth is *not* enabled.\n\n### Parameters\n\n- __success__: Success callback function, invoked when Bluetooth is enabled.\n- __failure__: Error callback function, invoked when Bluetooth is NOT enabled.\n\n### Quick Example\n\n    bluetoothSerial.isEnabled(\n        function() {\n            console.log(\"Bluetooth is enabled\");\n        },\n        function() {\n            console.log(\"Bluetooth is *not* enabled\");\n        }\n    );\n\n## readRSSI\n\nReads the RSSI from the connected peripheral.\n\n    bluetoothSerial.readRSSI(success, failure);\n\n### Description\n\nFunction `readRSSI` calls the success callback with the rssi.\n\n**BLE only** *This function is experimental and the API may change*\n\n### Parameters\n\n- __success__: Success callback function that is invoked with the rssi value.\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.readRSSI(\n        function(rssi) {\n            console.log(rssi);\n        }\n    );\n\n## showBluetoothSettings\n\nShow the Bluetooth settings on the device.\n\n    bluetoothSerial.showBluetoothSettings(success, failure);\n\n### Description\n\nFunction `showBluetoothSettings` opens the Bluetooth settings on the operating systems.\n\n#### iOS\n\n`showBluetoothSettings` is not supported on iOS.\n\n### Parameters\n\n- __success__: Success callback function [optional]\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.showBluetoothSettings();\n\n## enable\n\nEnable Bluetooth on the device.\n\n    bluetoothSerial.enable(success, failure);\n\n### Description\n\nFunction `enable` prompts the user to enable Bluetooth.\n\n#### Android\n\n`enable` is only supported on Android and does not work on iOS or Windows Phone.\n\nIf `enable` is called when Bluetooth is already enabled, the user will not prompted and the success callback will be invoked.\n\n### Parameters\n\n- __success__: Success callback function, invoked if the user enabled Bluetooth.\n- __failure__: Error callback function, invoked if the user does not enabled Bluetooth.\n\n### Quick Example\n\n    bluetoothSerial.enable(\n        function() {\n            console.log(\"Bluetooth is enabled\");\n        },\n        function() {\n            console.log(\"The user did *not* enable Bluetooth\");\n        }\n    );\n\n## discoverUnpaired\n\nDiscover unpaired devices\n\n    bluetoothSerial.discoverUnpaired(success, failure);\n\n### Description\n\n#### Android\n\nFunction `discoverUnpaired` discovers unpaired Bluetooth devices. The success callback is called with a list of objects similar to `list`, or an empty list if no unpaired devices are found.\n\nExample list passed to success callback.\n\n    [{\n        \"class\": 276,\n        \"id\": \"10:BF:48:CB:00:00\",\n        \"address\": \"10:BF:48:CB:00:00\",\n        \"name\": \"Nexus 7\"\n    }, {\n        \"class\": 7936,\n        \"id\": \"00:06:66:4D:00:00\",\n        \"address\": \"00:06:66:4D:00:00\",\n        \"name\": \"RN42\"\n    }]\n\nThe discovery process takes a while to happen. You can register notify callback with [setDeviceDiscoveredListener](#setdevicediscoveredlistener).\nYou may also want to show a progress indicator while waiting for the discover proces to finish, and the sucess callback to be invoked.\n\nCalling `connect` on an unpaired Bluetooth device should begin the Android pairing process.\n\n#### iOS\n\n`discoverUnpaired` is not supported on iOS. iOS uses Bluetooth Low Energy and `list` discovers devices without pairing.\n\n#### Windows Phone\n\n`discoverUnpaired` is not supported on Windows Phone.\n\n### Parameters\n\n- __success__: Success callback function that is invoked with a list of unpaired devices.\n- __failure__: Error callback function, invoked when error occurs. [optional]\n\n### Quick Example\n\n    bluetoothSerial.discoverUnpaired(function(devices) {\n        devices.forEach(function(device) {\n            console.log(device.id);\n        })\n    }, failure);\n\n## setDeviceDiscoveredListener\n\nRegister a notify callback function to be called during bluetooth device discovery. For callback to work, discovery process must\nbe started with [discoverUnpaired](#discoverunpaired).\nThere can be only one registered callback.\n\nExample object passed to notify callback.\n\n    {\n        \"class\": 276,\n        \"id\": \"10:BF:48:CB:00:00\",\n        \"address\": \"10:BF:48:CB:00:00\",\n        \"name\": \"Nexus 7\"\n    }\n\n#### iOS \u0026 Windows Phone\n\nSee [discoverUnpaired](#discoverunpaired).\n\n### Parameters\n\n- __notify__: Notify callback function that is invoked when device is discovered during discovery process.\n\n### Quick Example\n\n    bluetoothSerial.setDeviceDiscoveredListener(function(device) {\n\t\tconsole.log('Found: '+device.id);\n    });\n\n## clearDeviceDiscoveredListener\n\nClears notify callback function registered with [setDeviceDiscoveredListener](#setdevicediscoveredlistener).\n\n### Quick Example\n\n    bluetoothSerial.clearDeviceDiscoveredListener();\n\n## setName\n\nSets the human readable device name that is broadcasted to other devices.\n\n    bluetoothSerial.setName(newName);\n\n#### Android\nFor Android, `setName` takes a String for the new name.\n\n#### iOS\nNot currently implemented.\n\n#### Windows Phone\nNot currently implemented.\n\n### Parameters\n\n- __newName__: Desired name of device.\n\n### Quick Example\n\n    bluetoothSerial.setName(\"Really cool name\");\n\n## setDiscoverable\n\nMakes the device discoverable by other devices.\n\n    bluetoothSerial.setDiscoverable(discoverableDuration);\n\n#### Android\nFor Android, `setDiscoverable` takes an int for the number of seconds device should be discoverable. A time of 0 will make it permanently discoverable.\n\n#### iOS\nNot currently implemented.\n\n#### Windows Phone\nNot currently implemented.\n\n### Parameters\n\n- __discoverableDuration__: Desired number of seconds device should be discoverable for.\n\n### Quick Example\n\n    bluetoothSerial.setDiscoverable(0);\n\n# Misc\n\n## Where does this work?\n\n### Android\n\nCurrent development is done with Cordova 4.2 on Android 5. Theoretically this code runs on PhoneGap 2.9 and greater.  It should support Android-10 (2.3.2) and greater, but I only test with Android 4.x+.\n\nDevelopment Devices include\n * Nexus 5 with Android 5\n * Samsung Galaxy Tab 10.1 (GT-P7510) with Android 4.0.4 (see [Issue #8](https://github.com/don/BluetoothSerial/issues/8))\n * Google Nexus S with Android 4.1.2\n * Nexus 4 with Android 5\n * Samsung Galaxy S4 with Android 4.3\n\nOn the Arduino side I test with [Sparkfun Mate Silver](https://www.sparkfun.com/products/10393) and the [Seeed Studio Bluetooth Shield](http://www.seeedstudio.com/depot/bluetooth-shield-p-866.html?cPath=19_21). The code should be generic and work with most hardware.\n\nI highly recommend [Adafruit's Bluefruit EZ-Link](http://www.adafruit.com/products/1588).\n\n### iOS\n\n**NOTE: Currently iOS only works with RedBear Labs Hardware, Adafruit Bluefruit LE, Laird BL600, and BlueGiga UART services**\n\nThis plugin was originally developed with Cordova 3.4 using iOS 7.x on an iPhone 5s connecting to a [RedBearLab BLEMini](http://redbearlab.com/blemini). Ensure that you have update the BLE Mini firmware to at least [Biscuit-UART_20130313.bin](https://github.com/RedBearLab/Biscuit/tree/master/release).\n\nMost development is now done with iOS 8 with Cordova 4.2 using [RedBear Lab BLE Shield](http://redbearlab.com/bleshield/) or [Adafruit Bluefruit LE Friend](https://www.adafruit.com/product/2267).\n\n### Supporting other BLE hardware\n\nFor Bluetooth Low Energy, this plugin supports some hardware running known UART-like services, but can support any Bluetooth Low Energy hardware with a \"serial like\" service. This means a transmit characteristic that is writable and a receive characteristic that supports notification.\n\nEdit [BLEdefines.h](src/ios/BLEDefines.h) and adjust the UUIDs for your service.\n\nSee [Issue 141](https://github.com/don/BluetoothSerial/issues/141#issuecomment-161500473) for details on how to add support for Amp'ed RF Technology BT43H.\n\n## Props\n\n### Android\n\nMost of the Bluetooth implementation was borrowed from the Bluetooth Chat example in the Android SDK.\n\n### iOS\n\nThe iOS code uses RedBearLab's [BLE_Framework](https://github.com/RedBearLab/iOS/tree/master/BLEFramework/BLE).\n\n### API\n\nThe API for available, read, readUntil was influenced by the [BtSerial Library for Processing for Arduino](https://github.com/arduino/BtSerial)\n\n## Wrong Bluetooth Plugin?\n\nIf you don't need **serial** over Bluetooth, try the [PhoneGap Bluetooth Plugin for Android](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/Android/Bluetooth/2.2.0) or perhaps [phonegap-plugin-bluetooth](https://github.com/tanelih/phonegap-bluetooth-plugin).\n\nIf you need generic Bluetooth Low Energy support checkout my [Cordova BLE Plugin](https://github.com/don/cordova-plugin-ble-central).\n\nIf you need BLE for RFduino checkout my [RFduino Plugin](https://github.com/don/cordova-plugin-rfduino).\n\n## What format should the Mac Address be in?\nAn example a properly formatted mac address is ``AA:BB:CC:DD:EE:FF``\n\n## Feedback\n\nTry the code. If you find an problem or missing feature, file an issue or create a pull request.\n","funding_links":[],"categories":["Hardware Com"],"sub_categories":["Bluetooth"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdon%2FBluetoothSerial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdon%2FBluetoothSerial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdon%2FBluetoothSerial/lists"}