From f0d2e0f281190822965e0d293f358bc734915662 Mon Sep 17 00:00:00 2001 From: intent-kacper-cyranowski Date: Wed, 31 Jul 2024 23:50:54 +0200 Subject: [PATCH] chore: add changelog entry and update documentation --- CHANGELOG.md | 12 ++++++++++++ docs/GETTING_STARTED.md | 13 +++++++------ docs/index.html | 29 ++++++++++++++++------------- package.json | 2 +- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69a49e79..e7e3dc89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## [3.3.0] - XXXX-XX-XX + +### Changed + +- internal `_manager` property isn't enumerable anymore. This change will hide it from the `console.log`, `JSON.stringify` and other similar methods. +- `BleManager` is now a singleton. It will be created only once and reused across the app. This change will allow users to declare instance in React tree (hooks and components). This change should not affect the existing codebase, where `BleManager` is created once and used across the app. + +### Fixed + +- Timeout parameter in connect method on Android causing the connection to be closed after the timeout period even if connection was established. +- Missing `serviceUUIDs` data after `discoverAllServicesAndCharacteristics` method call + ## [3.2.1] - 2024-07-9 ### Changed diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 63c0f553..2d5e4277 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -2,8 +2,11 @@ react-native-ble-plx -This guide is an introduction to BLE stack and APIs exported by this library. All examples -will be based on CC2541 SensorTag. +This guide is an introduction to BLE stack and APIs exported by this library. For further information you can refer to + +- tutorials and API reference available in this documentation, +- [GitHub wiki](https://github.com/dotintent/react-native-ble-plx/wiki), +- example app available in the repository. ### Install and prepare package @@ -15,7 +18,7 @@ In the case of react native CLI you need to configure two environments: ### Creating BLE Manager -First step is to create BleManager instance which is an entry point to all available APIs. It should be declared **OUTSIDE the life cycle of React**. Make sure to create it after application started its execution. We can keep it as a static reference by either creating our own abstraction (ex.1) or by simply creating a new instance (ex.2). +First step is to create BleManager instance which is an entry point to all available APIs. Make sure to create it after application started its execution. We can keep it as a static reference by either creating our own abstraction (ex.1) or by simply creating a new instance (ex.2). #### Ex.1 @@ -42,9 +45,7 @@ import { BleManager } from 'react-native-ble-plx' export const manager = new BleManager() ``` -Only _one_ instance of BleManager is allowed. When you don't need any BLE functionality you can destroy created instance by calling `manager.destroy()` function. You can then recreate `BleManager` later on. - -Note that you may experience undefined behavior when calling a function on one `BleManager` and continuing with another instance. A frequently made error is to create a new instance of the manager for every re-render of a React Native Component. +When you don't need any BLE functionality you can destroy created instance by calling `manager.destroy()` function. You can then recreate `BleManager` later on. ### Ask for permissions diff --git a/docs/index.html b/docs/index.html index 5135673a..f33f4ade 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1975,8 +1975,12 @@

react-native-ble-plx

-

This guide is an introduction to BLE stack and APIs exported by this library. All examples -will be based on CC2541 SensorTag.

+

This guide is an introduction to BLE stack and APIs exported by this library. For further information you can refer to

+

Install and prepare package

In the case of Expo, you will need to prepare a plugin config, detailed information can be found here: https://github.com/dotintent/react-native-ble-plx?tab=readme-ov-file#expo-sdk-43 In the case of react native CLI you need to configure two environments:

@@ -1985,7 +1989,7 @@

Install and prepare package

  • Android
  • Creating BLE Manager

    -

    First step is to create BleManager instance which is an entry point to all available APIs. It should be declared OUTSIDE the life cycle of React. Make sure to create it after application started its execution. We can keep it as a static reference by either creating our own abstraction (ex.1) or by simply creating a new instance (ex.2).

    +

    First step is to create BleManager instance which is an entry point to all available APIs. Make sure to create it after application started its execution. We can keep it as a static reference by either creating our own abstraction (ex.1) or by simply creating a new instance (ex.2).

    Ex.1

    import { BleManager } from 'react-native-ble-plx'
     
    @@ -2003,8 +2007,7 @@ 

    Ex.2

    import { BleManager } from 'react-native-ble-plx'
     
     export const manager = new BleManager()
    -

    Only one instance of BleManager is allowed. When you don't need any BLE functionality you can destroy created instance by calling manager.destroy() function. You can then recreate BleManager later on.

    -

    Note that you may experience undefined behavior when calling a function on one BleManager and continuing with another instance. A frequently made error is to create a new instance of the manager for every re-render of a React Native Component.

    +

    When you don't need any BLE functionality you can destroy created instance by calling manager.destroy() function. You can then recreate BleManager later on.

    Ask for permissions

    Check if you requested following permissions