Skip to content

Commit

Permalink
Merge branch 'release-3.1.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Schiffli committed Jul 31, 2018
2 parents af953e0 + a272e8a commit 9175080
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.1.5
current_version = 3.1.6

[bumpversion:file:Docs/source/conf.py]

Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
### Added
- MetaWearScanner.retrieveConnectedMetaWearsAsync function

### Changed
- Save CBPeripheral's retrieved in willRestoreState

## [3.1.5] - 2018-07-27
### Added
- Bluetooth State Restoration on MetaWearScanner.shared

### Changed
- CPP submodule accessed with https instead of git protocol

## [3.1.4] - 2018-07-23

### Changed
- Updated Podspec with the swift-version key and latest Bolts-Swift 1.4.0
- MetaWear-SDK-Cpp v0.16.0
Expand Down
4 changes: 2 additions & 2 deletions Docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
# built documents.
#
# The short X.Y version.
version = '3.1.5'
version = '3.1.6'
# The full version, including alpha/beta/rc tags.
release = '3.1.5'
release = '3.1.6'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion MetaWear.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MetaWear'
s.version = '3.1.5'
s.version = '3.1.6'
s.license = { :type => 'Commercial', :text => 'See https://www.mbientlab.com/terms/', :file => 'LICENSE' }
s.homepage = 'https://mbientlab.com'
s.summary = 'iOS/macOS/tvOS/watchOS API and documentation for the MetaWear platform'
Expand Down
32 changes: 30 additions & 2 deletions MetaWear/Core/MetaWearScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fileprivate var scannerCount = 0
public class MetaWearScanner: NSObject {
public static let shared = MetaWearScanner(restoreIdentifier: "MetaWearScanner.shared")
public var central: CBCentralManager! = nil
/// All devices that have been discovered in one way or another by this central
public var deviceMap: [CBPeripheral: MetaWear] = [:]
public var didUpdateState: ((CBCentralManager) -> Void)? {
didSet {
Expand Down Expand Up @@ -96,7 +97,24 @@ public class MetaWearScanner: NSObject {
}
return source.task
}


/// List of devices that are already connected
/// This is useful to check after state was restored
public func retrieveConnectedMetaWearsAsync() -> Task<[MetaWear]> {
let source = TaskCompletionSource<[MetaWear]>()
runWhenPoweredOn {
var devices: [MetaWear] = []
let peripherals = self.central.retrieveConnectedPeripherals(withServices: [.metaWearService,
.metaWearDfuService])
devices = peripherals.map { peripheral -> MetaWear in
let device = self.deviceMap[peripheral] ?? MetaWear(peripheral: peripheral, scanner: self)
self.deviceMap[peripheral] = device
return device
}
source.trySet(result: devices)
}
return source.task
}

// Internal details below
var allowDuplicates: Bool = false
Expand Down Expand Up @@ -230,9 +248,19 @@ extension MetaWearScanner: CBCentralManagerDelegate {
public func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
deviceMap[peripheral]?.didDisconnectPeripheral(error: error)
}
public func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any]) {
public func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any]) {
// As an SDK, we arn't sure what operations the user is acutally doing.
// You should place code in didFinishLaunchingWithOptions to kick off any tasks
// you expect to take place

// An array (an instance of NSArray) of CBPeripheral objects that contains
// all of the peripherals that were connected to the central manager
// (or had a connection pending) at the time the app was terminated by the system.
if let peripherals = dict[CBCentralManagerRestoredStatePeripheralsKey] as? [CBPeripheral] {
for peripheral in peripherals {
let device = MetaWear(peripheral: peripheral, scanner: self)
self.deviceMap[peripheral] = device
}
}
}
}
12 changes: 6 additions & 6 deletions MetaWear/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ PODS:
- Bolts-Swift (1.4.0)
- iOSDFULibrary (4.1.3):
- Zip (~> 1.0)
- MetaWear/AsyncUtils (3.1.5):
- MetaWear/AsyncUtils (3.1.6):
- MetaWear/Core
- MetaWear/Core (3.1.5):
- MetaWear/Core (3.1.6):
- Bolts-Swift (~> 1)
- MetaWear/DFU (3.1.5):
- MetaWear/DFU (3.1.6):
- iOSDFULibrary (~> 4)
- MetaWear/Core
- MetaWear/Mocks (3.1.5):
- MetaWear/Mocks (3.1.6):
- MetaWear/Core
- MetaWear/UI (3.1.5):
- MetaWear/UI (3.1.6):
- MetaWear/AsyncUtils
- MetaWear/Core
- Zip (1.1.0)
Expand All @@ -35,7 +35,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Bolts-Swift: 650d72e8017721b1a6bbe43d542c4578f8e5ba6f
iOSDFULibrary: 921bc0e250ad204a68ffe0cc98a7cb6ac8b13b9f
MetaWear: fd23fdf6ec1d6b9f19c58767ef53fa4ca04518f3
MetaWear: 547e2a2665921d3c02bad90dd765a89ff29b6b72
Zip: 8877eede3dda76bcac281225c20e71c25270774c

PODFILE CHECKSUM: 40f51631a47326fabd7a7939d3b4c5c6bc3dd8ba
Expand Down
4 changes: 2 additions & 2 deletions MetaWear/Pods/Local Podspecs/MetaWear.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions MetaWear/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions StarterProject/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PODS:
- Bolts-Swift (1.4.0)
- MBProgressHUD (1.1.0)
- MetaWear/AsyncUtils (3.1.5):
- MetaWear/AsyncUtils (3.1.6):
- MetaWear/Core
- MetaWear/Core (3.1.5):
- MetaWear/Core (3.1.6):
- Bolts-Swift (~> 1)
- MetaWear/UI (3.1.5):
- MetaWear/UI (3.1.6):
- MetaWear/AsyncUtils
- MetaWear/Core

Expand All @@ -27,7 +27,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Bolts-Swift: 650d72e8017721b1a6bbe43d542c4578f8e5ba6f
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
MetaWear: fd23fdf6ec1d6b9f19c58767ef53fa4ca04518f3
MetaWear: 547e2a2665921d3c02bad90dd765a89ff29b6b72

PODFILE CHECKSUM: 0136ee1c1d406ecb176b6b32114b80feeceec950

Expand Down
4 changes: 2 additions & 2 deletions StarterProject/Pods/Local Podspecs/MetaWear.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions StarterProject/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9175080

Please sign in to comment.