Skip to content

Commit

Permalink
Adjusted heading levels
Browse files Browse the repository at this point in the history
  • Loading branch information
Steppschuh committed Jan 30, 2020
1 parent d9f60ec commit a061d9e
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,31 @@ Replace `master-SNAPSHOT` with the a release version number or a commit hash to

### Overview

This library provides all commonly used Bluetooth GATT server functionality through [RxJava][rxjava] powered interfaces. There's a default implementation avaialble for each of those interfaces, so that you don't have to manually deal with all the request and response handling that is usually required when providing Android's `BluetoothGattServerCallback`.
This library provides all commonly used Bluetooth GATT server functionality through [RxJava][rxjava] powered interfaces. There's a default implementation available for each of those interfaces, so that you don't have to manually deal with all the request and response handling that is usually required when providing Android's `BluetoothGattServerCallback`.

It also introduces a few wrappers to make it more convenient to work with the BLE related stuff, for instance:

- `RxBleValue` instead of raw `byte[]` arrays with offsets
- `RxBleServerRequest` and `RxBleServerResponse` instead of the overloaded callback parameters
- Further extended for characteristic and descriptor reads and writes

### Usage

#### GATT Server
### GATT Server

The `RxBleServer` interface provides the functionality of Android's `BluetoothGattServer`. It's capable of providing and advertising services as well as connecting and disconnecting clients.

To get an instance of the default implementation, use the `ServerBuilder`.

You can customize the default implementation by extending `BaseServer`.

##### Providing & Advertising
#### Providing & Advertising

To actually open the server and make it visible to remote clients, there are two methods that you should subscribe to: `Completable provideServices()` and `Completable advertise(UUID)`.
To actually open the server and make it visible to remote clients, there are two methods that you should subscribe to: `provideServices()` and `advertise(UUID)`.

You can provide a GATT server without advertising any service UUID. You can also advertise a service UUID that you don't actually provide a GATT server for. While most of the time you might want to do both, that may not always be the case. You could, for instance, stop advertising while a given client is connected. For convenience, there's also a merged version: `Completable provideServicesAndAdvertise(UUID)`.
You can provide a GATT server without advertising any service UUID. You can also advertise a service UUID that you don't actually provide a GATT server for. While most of the time you might want to do both, that may not always be the case. You could, for instance, stop advertising while a given client is connected. For convenience, there's also a merged version: `provideServicesAndAdvertise(UUID)`.

These methods will return a `Completable` that never terminates (unless an error accurs, e.g. when Bluetooth is disabled). You need to manually dispose the `Completable` subscriptions to stop the server (e.g. when your application lifecycle comes to an end).

#### GATT Services
### GATT Services

The `RxBleService` interface provides the functionality of Android's `BluetoothGattService`. It's basically just a container for one ore more characteristics.

Expand All @@ -68,7 +66,7 @@ RxBleService service = new ServiceBuilder(EXAMPLE_SERVICE_UUID)

You can customize the default implementation by extending `BaseService`.

#### GATT Characteristics
### GATT Characteristics

The `RxBleCharacteristic` interface provides the functionality of Android's `BluetoothGattCharacteristic`. It can hold a value, zero or more descriptors, permissions and properties.

Expand All @@ -88,7 +86,7 @@ RxBleCharacteristic characteristic = new CharacteristicBuilder(EXAMPLE_CHARACTER

You can customize the default implementation by extending `BaseCharacteristic`.

#### GATT Descriptors
### GATT Descriptors

The `RxBleDescriptor` interface provides the functionality of Android's `BluetoothGattDescriptor`. It can hold a value and permissions.

Expand All @@ -109,7 +107,7 @@ RxBleDescriptor descriptor = new CharacteristicUserDescription("Example characte

You can customize the default implementation by extending `BaseDescriptor`.

#### Value Providers
### Value Providers

Both `RxBleCharacteristic` and `RxBleDescriptor` extend the `RxBleSharedValueProvider` as well as the `RxBleClientValueProvider` interface. That means they have methods to get or set values, and to observe value changes (e.g. if set by a write request from a remote client).

Expand All @@ -127,7 +125,7 @@ valueProvider.getValueChanges(someClientOfInterest)

Note that the difference between these two is not just a `.filter()` by device, different clients can actually read and write different values on the same `RxBleClientValueProvider`.

#### Clients
### Clients

The `RxBleClient` interface provides the functionality of Android's `BluetoothDevice`. It represents a remote device that connected to the server. Client instances will be automatically created by the library for your once they start connecting.

Expand Down

0 comments on commit a061d9e

Please sign in to comment.