Skip to content

Commit

Permalink
Release v0.7.0
Browse files Browse the repository at this point in the history
Merge pull request #218 from OZEO-DOOZ/develop
  • Loading branch information
R0m4in-dooz authored Feb 4, 2022
2 parents c1e41ed + edfdf33 commit d8fa7b6
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/on_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
java-version: "12.x"
- uses: subosito/flutter-action@v1
with:
channel: "stable"
flutter-version: '2.5.3'
- name: Get dependencies
run: flutter packages get
- name: Check format
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.7.0

- added getter for `BleStatus`
- provisioning events now pass the target BLE device data
- workflow `on_pr.yml` now forces Flutter version to 2.5.3

## 0.6.0

- fix bug in adding a provisioner on iOS device
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.6.0"
version: "0.7.0"
package_config:
dependency: transitive
description:
Expand Down
4 changes: 3 additions & 1 deletion lib/src/ble/ble_scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class BleScanner {

final FlutterReactiveBle _flutterReactiveBle = FlutterReactiveBle();

Stream<BleStatus> get bleStatus => _flutterReactiveBle.statusStream;
Stream<BleStatus> get bleStatusStream => _flutterReactiveBle.statusStream;

BleStatus get bleStatus => _flutterReactiveBle.status;

late final StreamController<BleScannerError> _onScanErrorController = StreamController<BleScannerError>.broadcast();

Expand Down
5 changes: 4 additions & 1 deletion lib/src/nrf_mesh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,8 @@ class NordicNrfMesh {
_bleScanner.searchForSpecificNode(deviceNameOrId, timeoutDuration, isProxy);

/// Provide a [Stream] of the current [BleStatus] of the host device.
Stream<BleStatus> get bleStatus => _bleScanner.bleStatus;
Stream<BleStatus> get bleStatusStream => _bleScanner.bleStatusStream;

/// Will return the last known [BleStatus] (tracked via stream by BLE library, so it should always be up-to-date)
BleStatus get bleStatus => _bleScanner.bleStatus;
}
36 changes: 18 additions & 18 deletions lib/src/utils/provisioning.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ import 'package:nordic_nrf_mesh/src/mesh_manager_api.dart';
import 'package:nordic_nrf_mesh/src/models/models.dart';

class _ProvisioningEvent {
final _provisioningController = StreamController<void>();
final _provisioningCapabilitiesController = StreamController<void>();
final _provisioningInvitationController = StreamController<void>();
final _provisioningReconnectController = StreamController<void>();
final _onConfigCompositionDataStatusController = StreamController<void>();
final _onConfigAppKeyStatusController = StreamController<void>();
final _provisioningController = StreamController<DiscoveredDevice>();
final _provisioningCapabilitiesController = StreamController<DiscoveredDevice>();
final _provisioningInvitationController = StreamController<DiscoveredDevice>();
final _provisioningReconnectController = StreamController<DiscoveredDevice>();
final _onConfigCompositionDataStatusController = StreamController<DiscoveredDevice>();
final _onConfigAppKeyStatusController = StreamController<DiscoveredDevice>();
final _provisioningGattErrorController = StreamController<BleManagerCallbacksError>();
}

class ProvisioningEvent extends _ProvisioningEvent {
Stream<void> get onProvisioning => _provisioningController.stream;
Stream<DiscoveredDevice> get onProvisioning => _provisioningController.stream;

Stream<void> get onProvisioningCapabilities => _provisioningCapabilitiesController.stream;
Stream<DiscoveredDevice> get onProvisioningCapabilities => _provisioningCapabilitiesController.stream;

Stream<void> get onProvisioningInvitation => _provisioningInvitationController.stream;
Stream<DiscoveredDevice> get onProvisioningInvitation => _provisioningInvitationController.stream;

Stream<void> get onProvisioningReconnect => _provisioningReconnectController.stream;
Stream<DiscoveredDevice> get onProvisioningReconnect => _provisioningReconnectController.stream;

Stream<void> get onConfigCompositionDataStatus => _onConfigCompositionDataStatusController.stream;
Stream<DiscoveredDevice> get onConfigCompositionDataStatus => _onConfigCompositionDataStatusController.stream;

Stream<void> get onConfigAppKeyStatus => _onConfigAppKeyStatusController.stream;
Stream<DiscoveredDevice> get onConfigAppKeyStatus => _onConfigAppKeyStatusController.stream;
Stream<BleManagerCallbacksError> get onProvisioningGattError => _provisioningGattErrorController.stream;

Future<void> dispose() => Future.wait([
Expand Down Expand Up @@ -117,7 +117,7 @@ Future<ProvisionedMeshNode> _provisioning(
if (device == null) {
completer.completeError(NrfMeshProvisioningException(ProvisioningFailureCode.notFound, 'Didn\'t find module'));
}
events?._provisioningReconnectController.add(null);
events?._provisioningReconnectController.add(deviceToProvision);
try {
_connectRetryCount = 0;
isHandlingConnectErrors = true;
Expand All @@ -141,7 +141,7 @@ Future<ProvisionedMeshNode> _provisioning(
});
onProvisioningStateChangedSubscription = meshManagerApi.onProvisioningStateChanged.listen((event) async {
if (event.state == 'PROVISIONING_CAPABILITIES') {
events?._provisioningCapabilitiesController.add(null);
events?._provisioningCapabilitiesController.add(deviceToProvision);
final unprovisionedMeshNode =
UnprovisionedMeshNode(event.meshNode!.uuid, event.meshNode!.provisionerPublicKeyXY!);
final elementSize = await unprovisionedMeshNode.getNumberOfElements();
Expand All @@ -167,11 +167,11 @@ Future<ProvisionedMeshNode> _provisioning(
}
_log('successfully assigned $unicast to node !');
}
events?._provisioningController.add(null);
events?._provisioningController.add(deviceToProvision);
await meshManagerApi.provisioning(unprovisionedMeshNode);
} else if (event.state == 'PROVISIONING_INVITE') {
if (!bleMeshManager.isProvisioningCompleted) {
events?._provisioningInvitationController.add(null);
events?._provisioningInvitationController.add(deviceToProvision);
} else if (bleMeshManager.isProvisioningCompleted) {
final unicast = await provisionedMeshNode.unicastAddress;
await meshManagerApi.sendConfigCompositionDataGet(unicast);
Expand Down Expand Up @@ -216,11 +216,11 @@ Future<ProvisionedMeshNode> _provisioning(
}
});
onConfigCompositionDataStatusSubscription = meshManagerApi.onConfigCompositionDataStatus.listen((event) async {
events?._onConfigCompositionDataStatusController.add(null);
events?._onConfigCompositionDataStatusController.add(deviceToProvision);
await meshManagerApi.sendConfigAppKeyAdd(await provisionedMeshNode.unicastAddress);
});
onConfigAppKeyStatusSubscription = meshManagerApi.onConfigAppKeyStatus.listen((event) async {
events?._onConfigAppKeyStatusController.add(null);
events?._onConfigAppKeyStatusController.add(deviceToProvision);
completer.complete(provisionedMeshNode);
});
try {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nordic_nrf_mesh
description: A Flutter plugin to enable mesh network management and communication using Nordic's SDKs. It also provides the ability to open BLE connection with mesh nodes using some other flutter package.
version: 0.6.0
version: 0.7.0

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit d8fa7b6

Please sign in to comment.