cordova-plugin-ble-central
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -0,1 +1,6 @@ | ||
= 1.2.5 = | ||
Add setPin method for Android #718 Thanks untilbit | ||
Give the user feedback after an MTU size request #715 Thanks agren | ||
Add requestConnectionPriority for Android #714 #713 Thanks agren vamshik113 | ||
= 1.2.4 = | ||
@@ -2,0 +7,0 @@ Add sequence numbers to notifications on Android to handle out of order notifications. Android #625 #656 Thanks timburke |
{ | ||
"name": "cordova-plugin-ble-central", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Bluetooth Low Energy (BLE) Central Plugin", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -68,2 +68,3 @@ # Bluetooth Low Energy (BLE) Central Plugin for Apache Cordova | ||
- [ble.stopScan](#stopscan) | ||
- [ble.stopScan](#setpin) | ||
- [ble.connect](#connect) | ||
@@ -73,2 +74,3 @@ - [ble.autoConnect](#autoconnect) | ||
- [ble.requestMtu](#requestmtu) | ||
- [ble.requestConnectionPriority](#requestconnectionpriority) | ||
- [ble.read](#read) | ||
@@ -248,2 +250,18 @@ - [ble.write](#write) | ||
## setPin | ||
Set device pin | ||
ble.setPin(pin, [success], [failure]); | ||
### Description | ||
Function `setPin` sets the pin when device requires it. | ||
### Parameters | ||
- __pin__: Pin of the device as a string | ||
- __success__: Success callback function that is invoked when the function is invoked. [optional] | ||
- __failure__: Error callback function, invoked when error occurs. [optional] | ||
## connect | ||
@@ -321,4 +339,5 @@ | ||
When performing a write request operation (write without response), the data sent is truncated to the MTU size. | ||
This function may be used to request (on Android) a larger MTU size to be able to send more data at once. | ||
This can be useful when performing a write request operation (write without response), the data sent is truncated to the MTU size. | ||
The resulting MTU size is sent to the success callback. The requested and resulting MTU sizes are not necessarily equal. | ||
@@ -333,2 +352,34 @@ ### Supported Platforms | ||
- __mtu__: MTU size | ||
- __success__: Success callback function that is invoked when the MTU size request is successful. The resulting MTU size is passed as an integer. | ||
- __failure__: Error callback function, invoked when error occurs. [optional] | ||
### Quick Example | ||
ble.requestMtu(device_id, new_mtu, | ||
function(mtu){ | ||
alert("MTU set to: " + mtu); | ||
}, | ||
function(failure){ | ||
alert("Failed to request MTU."); | ||
} | ||
); | ||
## requestConnectionPriority | ||
requestConnectionPriority | ||
ble.requestConnectionPriority(device_id, priority, [success], [failure]); | ||
### Description | ||
When Connecting to a peripheral android can request for the connection priority for better communication. | ||
### Supported Platforms | ||
* Android | ||
### Parameters | ||
- __device_id__: UUID or MAC address of the peripheral | ||
- __priority__: high or balanced or low | ||
- __success__: Success callback function that is invoked when the connection is successful. [optional] | ||
@@ -335,0 +386,0 @@ - __failure__: Error callback function, invoked when error occurs. [optional] |
@@ -153,2 +153,6 @@ // (c) 2014-2016 Don Coleman | ||
setPin: function (pin, success, failure) { | ||
cordova.exec(success, failure, 'BLE', 'setPin', [pin]); | ||
}, | ||
requestMtu: function (device_id, mtu, success, failure) { | ||
@@ -158,2 +162,6 @@ cordova.exec(success, failure, 'BLE', 'requestMtu', [device_id, mtu]); | ||
requestConnectionPriority: function (device_id, connectionPriority, success, failure) { | ||
cordova.exec(success, failure, 'BLE', 'requestConnectionPriority', [device_id, connectionPriority]) | ||
}, | ||
refreshDeviceCache: function(deviceId, timeoutMillis, success, failure) { | ||
@@ -266,2 +274,8 @@ var successWrapper = function(peripheral) { | ||
setPin: function (pin) { | ||
return new Promise(function (resolve, reject) { | ||
module.exports.setPin(pin, resolve, reject); | ||
}); | ||
}, | ||
read: function(device_id, service_uuid, characteristic_uuid) { | ||
@@ -268,0 +282,0 @@ return new Promise(function(resolve, reject) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
313783
2060
1041