Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DrAma999 committed Jul 12, 2020
2 parents fc6e8ef + e1a72cc commit 63db965
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 183 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

LittleBlueTooth.xcodeproj/project.xcworkspace/xcuserdata/Andrea.xcuserdatad/UserInterfaceState.xcuserstate
LittleBlueTooth.xcodeproj/project.xcworkspace/xcuserdata/Andrea.xcuserdatad/UserInterfaceState.xcuserstate

LittleBlueTooth.xcodeproj/xcuserdata/Andrea.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
6 changes: 3 additions & 3 deletions LittleBlueTooth.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 0.1.1;
PRODUCT_BUNDLE_IDENTIFIER = it.vanillagorilla.LittleBlueTooth;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -611,7 +611,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 0.1.1;
PRODUCT_BUNDLE_IDENTIFIER = it.vanillagorilla.LittleBlueTooth;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -639,7 +639,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.1.0;
MARKETING_VERSION = 0.1.1;
PRODUCT_BUNDLE_IDENTIFIER = it.vanillagorilla.LittleBlueTooth;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
Binary file not shown.

This file was deleted.

10 changes: 0 additions & 10 deletions LittleBlueTooth/LittleBlueTooth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ public class LittleBlueTooth: Identifiable {
public func connectableListenPublisher<T: Readable>(for characteristic: LittleBlueToothCharacteristic, valueType: T.Type, queue: DispatchQueue = DispatchQueue.main) -> AnyPublisher<T, LittleBluetoothError> {

let listen = ensureBluetoothState()
.subscribe(on: queue)
.print("ConnectableListenPublisher")
.flatMap { [unowned self] _ in
self.ensurePeripheralConnected()
Expand Down Expand Up @@ -192,7 +191,6 @@ public class LittleBlueTooth: Identifiable {
/// - important: The type of the value must be conform to `Readable`
public func startListen<T: Readable>(from charact: LittleBlueToothCharacteristic, forType: T.Type, queue: DispatchQueue = DispatchQueue.main) -> AnyPublisher<T, LittleBluetoothError> {
let lis = ensureBluetoothState()
.subscribe(on: queue)
.print("StartListenPublisher")
.flatMap { [unowned self] _ in
self.ensurePeripheralConnected()
Expand Down Expand Up @@ -238,7 +236,6 @@ public class LittleBlueTooth: Identifiable {
let key = UUID()

self.ensureBluetoothState()
.subscribe(on: queue)
.print("StartListenPublisher no Value")
.flatMap { [unowned self] _ in
self.ensurePeripheralConnected()
Expand Down Expand Up @@ -270,7 +267,6 @@ public class LittleBlueTooth: Identifiable {
/// - returns: A publisher with that informs you about the successful or failed task
public func stopListen(from characteristic: LittleBlueToothCharacteristic, queue: DispatchQueue = DispatchQueue.main) -> AnyPublisher<CBCharacteristic, LittleBluetoothError> {
return ensureBluetoothState()
.subscribe(on: queue)
.flatMap { [unowned self] _ in
self.ensurePeripheralConnected()
}
Expand All @@ -292,7 +288,6 @@ public class LittleBlueTooth: Identifiable {
let key = UUID()

ensureBluetoothState()
.subscribe(on: queue)
.timeout(RunLoop.SchedulerTimeType.Stride(timeout ?? TimeInterval.infinity), scheduler: RunLoop.current, customError: {.readTimeout})
.print("ReadPublisher")
.flatMap { [unowned self] _ in
Expand Down Expand Up @@ -347,7 +342,6 @@ public class LittleBlueTooth: Identifiable {
let key = UUID()

ensureBluetoothState()
.subscribe(on: queue)
.timeout(RunLoop.SchedulerTimeType.Stride(timeout ?? TimeInterval.infinity), scheduler: RunLoop.current, customError: {.writeTimeout})
.print("WritePublisher")
.flatMap { [unowned self] _ in
Expand Down Expand Up @@ -386,7 +380,6 @@ public class LittleBlueTooth: Identifiable {
let key = UUID()

ensureBluetoothState()
.subscribe(on: DispatchQueue.main)
.timeout(RunLoop.SchedulerTimeType.Stride(timeout ?? TimeInterval.infinity), scheduler: RunLoop.current, customError: {.writeAndListenTimeout})
.print("WriteAndListePublisher")
.flatMap { [unowned self] _ in
Expand Down Expand Up @@ -439,7 +432,6 @@ public class LittleBlueTooth: Identifiable {

scanning =
ensureBluetoothState()
.subscribe(on: queue)
.timeout(RunLoop.SchedulerTimeType.Stride(timeout ?? TimeInterval.infinity), scheduler: RunLoop.current, customError: {.scanTimeout})
.print("DiscoverPublisher")
.flatMap { [unowned self] _ -> Publishers.SetFailureType<PassthroughSubject<PeripheralDiscovery, Never>, LittleBluetoothError> in
Expand Down Expand Up @@ -490,7 +482,6 @@ public class LittleBlueTooth: Identifiable {
let key = UUID()

ensureBluetoothState()
.subscribe(on: queue)
.print("ConnectPublisher")
.timeout(RunLoop.SchedulerTimeType.Stride(timeout ?? TimeInterval.infinity), scheduler: RunLoop.current, customError: {.connectTimeout})
.tryMap { [unowned self] _ -> Void in
Expand Down Expand Up @@ -594,7 +585,6 @@ public class LittleBlueTooth: Identifiable {
let key = UUID()

self.centralProxy.connectionEventPublisher
.subscribe(on: queue)
.print("DisconnectPublisher")
.filter{ (event) -> Bool in
if case ConnectionEvent.disconnected(_, error: _) = event {
Expand Down
6 changes: 4 additions & 2 deletions LittleBlueToothTests/ScanDiscoveryTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ScanDiscoveryTest: LittleBlueToothTests {
}) { (discov) in
print("Discovery \(discov)")
discovery = discov

self.littleBT.stopDiscovery()
discoveryExpectation.fulfill()
}
.store(in: &disposeBag)
Expand Down Expand Up @@ -71,6 +71,7 @@ class ScanDiscoveryTest: LittleBlueToothTests {
isPowerOff = false
if case LittleBluetoothError.bluetoothPoweredOff = error {
isPowerOff = true
self.littleBT.stopDiscovery()
}
discoveryExpectation.fulfill()
case .finished:
Expand All @@ -89,7 +90,7 @@ class ScanDiscoveryTest: LittleBlueToothTests {
disposeBag.removeAll()

blinky.simulateProximityChange(.immediate)
let discoveryExpectation = expectation(description: "Discovery Expectation")
let discoveryExpectation = expectation(description: "Discovery Expectation Stop")

var isScanning = true

Expand Down Expand Up @@ -132,6 +133,7 @@ class ScanDiscoveryTest: LittleBlueToothTests {
isScanTimeout = false
if case LittleBluetoothError.scanTimeout = error {
isScanTimeout = true
self.littleBT.stopDiscovery()
}
discoveryExpectation.fulfill()
case .finished:
Expand Down

0 comments on commit 63db965

Please sign in to comment.