Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ class BleUtilsModule(private val reactContext: ReactApplicationContext) :
val bond = Arguments.createMap()
bond.putString("state", bondStateStr)
bond.putString("preState", prevBondStateStr)
// EXTRA_UNBOND_REASON is not exposed by the public Android SDK.
val reasonExtra = "android.bluetooth.device.extra.REASON"
if (bondState == BluetoothDevice.BOND_NONE && intent.hasExtra(reasonExtra)) {
bond.putInt("reason", intent.getIntExtra(reasonExtra, BluetoothDevice.ERROR))
}

val peripheral = Peripheral(device!!)
val map = peripheral.asWritableMap()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/react-native-ble-utils",
"version": "0.1.6",
"version": "0.1.7",
"description": "ble uilts",
"source": "./src/index.tsx",
"main": "./dist/commonjs/index.js",
Expand Down
2 changes: 2 additions & 0 deletions src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export interface Peripheral {
export interface BondState {
state: string;
preState: string;
/** Android EXTRA_UNBOND_REASON, when supplied by the system. */
reason?: number;
}

export interface AdvertisingData {
Expand Down
Loading