Skip to content

Commit e8e6325

Browse files
authored
Merge pull request #29 from Henryforce/master_fix
Fixed master and updated environment support to only iOS
2 parents 560990c + 14a6789 commit e8e6325

11 files changed

+62
-33
lines changed

Package.resolved

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PackageDescription
66
let package = Package(
77
name: "BLECombineKit",
88
platforms: [
9-
.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)
9+
.iOS(.v13)
1010
],
1111
products: [
1212
.library(name: "BLECombineKit", targets: ["BLECombineKit"])
@@ -19,18 +19,25 @@ let package = Package(
1919
],
2020
targets: [
2121
.target(
22-
name: "BLECombineKit",
23-
dependencies: ["CombineExt"],
24-
path: ".",
25-
exclude: [
26-
"Source/BLECombineKit.h",
27-
"Source/Info.plist",
28-
"BLECombineExplorer",
29-
"Tests"
30-
],
31-
sources: [
32-
"Source"
33-
]
34-
)
22+
name: "BLECombineKit",
23+
dependencies: ["CombineExt"],
24+
path: ".",
25+
exclude: [
26+
"Source/BLECombineKit.h",
27+
"Source/Info.plist",
28+
"BLECombineExplorer",
29+
"Tests"
30+
],
31+
sources: [
32+
"Source"
33+
]
34+
),
35+
.testTarget(
36+
name: "BLECombineKitTests",
37+
dependencies: [
38+
"BLECombineKit",
39+
],
40+
path: "Tests"
41+
),
3542
]
3643
)

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
# BLECombineKit
22

3-
![badge-platforms][] [![badge-ci][]][travis] [![badge-codecov][]][codecov] [![badge-carthage][]][carthage] [![badge-spm][]][spm]
3+
![badge-platforms][] [![badge-carthage][]][carthage] [![badge-spm][]][spm]
44

5-
CoreBluetooth abstraction layer for iOS, macOS, TvOS and WatchOS development environments. Powered by Combine.
5+
CoreBluetooth abstraction layer for iOS development environment. Powered by Combine.
66

77
- SwiftUI compatible
88
- Apple's APIs dependencies only
99

10-
Per Apple's docs, https://developer.apple.com/documentation/combine, Combine (and BLECombineKit) is only supported on:
10+
It is currently supported on:
1111

1212
iOS 13.0+
13-
macOS 11.0+ Beta
14-
Mac Catalyst 13.0+
15-
tvOS 13.0+
16-
watchOS 6.0+
1713

1814
# How to use
1915

@@ -62,13 +58,9 @@ In Xcode, select File --> Swift Packages --> Add Package Dependency and then add
6258
https://github.com/Henryforce/BLECombineKit
6359
```
6460

65-
[badge-platforms]: https://img.shields.io/badge/platforms-macOS%20%7C%20iOS%20%7C%20tvOS%20%7C%20watchOS-lightgrey.svg
66-
[badge-codecov]: https://codecov.io/gh/codecov/example-swift/branch/master/graphs/badge.svg
67-
[badge-ci]: https://travis-ci.com/Henryforce/BLECombineKit.svg?branch=master
61+
[badge-platforms]: https://img.shields.io/badge/platforms-iOS%20%7C%20-lightgrey.svg
6862
[badge-carthage]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat
6963
[badge-spm]: https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg
7064

71-
[codecov]: https://codecov.io/gh/Henryforce/BLECombineKit/branch/master
72-
[travis]: https://travis-ci.com/Henryforce/BLECombineKit
7365
[carthage]: https://github.com/Carthage/Carthage
7466
[spm]: https://github.com/apple/swift-package-manager

Source/Central/BLECentralManager.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public protocol BLECentralManager: AnyObject {
2222
func stopScan()
2323
func connect(peripheralWrapper: CBPeripheralWrapper, options: [String:Any]?)
2424
func cancelPeripheralConnection(_ peripheral: CBPeripheralWrapper) -> AnyPublisher<Never, Never>
25+
2526
func registerForConnectionEvents(options: [CBConnectionEventMatchingOption : Any]?)
2627
func observeWillRestoreState() -> AnyPublisher<[String: Any], Never>
2728
func observeDidUpdateANCSAuthorization() -> AnyPublisher<BLEPeripheral, Never>

Source/Error/BLEError.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ extension CBATTError: Hashable, Identifiable {
2121
public var id: Self { self }
2222
}
2323

24-
public enum BLEError: Error, Hashable, Identifiable, CustomStringConvertible {
24+
public enum BLEError: Error, CustomStringConvertible {
25+
2526
public enum CoreBluetoothError: Error, Hashable, Identifiable, CustomStringConvertible {
2627
case base(code: CBError.Code, description: String), ATT(code: CBATTError.Code, description: String), other(error: NSError)
2728

@@ -97,6 +98,14 @@ public enum BLEError: Error, Hashable, Identifiable, CustomStringConvertible {
9798

9899
public var id: Self { self }
99100

101+
case advertisingInProgress
102+
103+
case advertisingStartFailed(Error)
104+
105+
case addingServiceFailed(CBMutableService, Error)
106+
107+
case publishingL2CAPChannelFailed(CBL2CAPPSM, Error)
108+
100109
/// Generic error for handling `unknown` cases.
101110
case unknown
102111

@@ -117,6 +126,10 @@ public enum BLEError: Error, Hashable, Identifiable, CustomStringConvertible {
117126

118127
public var description: String {
119128
switch(self) {
129+
case .advertisingInProgress: return "Advertising in Progress"
130+
case .advertisingStartFailed(let error): return "Advertising failed to start with error: \(error)"
131+
case .addingServiceFailed(let service, let error): return "Adding service \(service) failed with error: \(error)"
132+
case .publishingL2CAPChannelFailed(_, let error): return "Publishing L2CAPChannel failed with error: \(error)"
120133
case .unknown: return "Unknown error"
121134
case .deallocated: return "Deallocated"
122135
case .managerState(let error): return "Manager state error: \(error)"

Tests/BLECentralManagerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CoreBluetooth
1111
import Combine
1212
@testable import BLECombineKit
1313

14-
class BLECentralManagerTests: XCTestCase {
14+
final class BLECentralManagerTests: XCTestCase {
1515

1616
var sut: BLECentralManager!
1717
var delegate: BLECentralManagerDelegate!

Tests/BLECharacteristicTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import XCTest
1010
import CoreBluetooth
1111
@testable import BLECombineKit
1212

13-
class BLECharacteristicTests: XCTestCase {
13+
final class BLECharacteristicTests: XCTestCase {
1414

1515
var blePeripheralMock: MockBLEPeripheral!
1616

Tests/BLECombineKitTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import XCTest
1010
import BLECombineKit
1111

12-
class BLECombineKitTests: XCTestCase {
12+
final class BLECombineKitTests: XCTestCase {
1313

1414
func testBLECombineKitInitReturnsBLECentralManager() throws {
1515
let bleCentralManager = BLECombineKit.buildCentralManager()

Tests/BLEDataTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import XCTest
1010
@testable import BLECombineKit
1111

12-
class BLEDataTests: XCTestCase {
12+
final class BLEDataTests: XCTestCase {
1313

1414
var mockupPeripheral: MockBLEPeripheral!
1515

Tests/BLEPeripheralTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CoreBluetooth
1111
import Combine
1212
@testable import BLECombineKit
1313

14-
class BLEPeripheralTests: XCTestCase {
14+
final class BLEPeripheralTests: XCTestCase {
1515

1616
var sut: StandardBLEPeripheral!
1717
var delegate: BLEPeripheralDelegate!

0 commit comments

Comments
 (0)