Skip to content

Commit 147639b

Browse files
authored
Merge pull request #28 from StarryInternet/mutable-properties
Make more properties mutable on the main types
2 parents 02b3441 + b55b829 commit 147639b

4 files changed

Lines changed: 80 additions & 80 deletions

File tree

Sources/CombineCoreBluetooth/Central/Interface+Central.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public struct Central: Sendable {
66

77
public let identifier: UUID
88

9-
let _maximumUpdateValueLength: @Sendable () -> Int
9+
public var _maximumUpdateValueLength: @Sendable () -> Int
1010

1111
public var maximumUpdateValueLength: Int {
1212
_maximumUpdateValueLength()

Sources/CombineCoreBluetooth/CentralManager/Interface+CentralManager.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@ public struct CentralManager: Sendable {
88
public typealias Feature = CBCentralManager.Feature
99
#endif
1010
let delegate: Delegate?
11+
12+
public var _state: @Sendable () -> CBManagerState
13+
public var _authorization: @Sendable () -> CBManagerAuthorization
14+
public var _isScanning: @Sendable () -> Bool
15+
16+
public var _supportsFeatures: @Sendable (_ feature: Feature) -> Bool
17+
18+
public var _retrievePeripheralsWithIdentifiers: @Sendable ([UUID]) -> [Peripheral]
19+
public var _retrieveConnectedPeripheralsWithServices: @Sendable ([CBUUID]) -> [Peripheral]
20+
public var _scanForPeripheralsWithServices: @Sendable (_ serviceUUIDs: [CBUUID]?, _ options: ScanOptions?) -> Void
21+
public var _stopScan: @Sendable () -> Void
22+
23+
public var _connectToPeripheral: @Sendable (Peripheral, _ options: PeripheralConnectionOptions?) -> Void
24+
public var _cancelPeripheralConnection: @Sendable (_ peripheral: Peripheral) -> Void
25+
public var _registerForConnectionEvents: @Sendable (_ options: [CBConnectionEventMatchingOption : Any]?) -> Void
1126

12-
let _state: @Sendable () -> CBManagerState
13-
let _authorization: @Sendable () -> CBManagerAuthorization
14-
let _isScanning: @Sendable () -> Bool
15-
16-
let _supportsFeatures: @Sendable (_ feature: Feature) -> Bool
17-
18-
let _retrievePeripheralsWithIdentifiers: @Sendable ([UUID]) -> [Peripheral]
19-
let _retrieveConnectedPeripheralsWithServices: @Sendable ([CBUUID]) -> [Peripheral]
20-
let _scanForPeripheralsWithServices: @Sendable (_ serviceUUIDs: [CBUUID]?, _ options: ScanOptions?) -> Void
21-
let _stopScan: @Sendable () -> Void
22-
23-
let _connectToPeripheral: @Sendable (Peripheral, _ options: PeripheralConnectionOptions?) -> Void
24-
let _cancelPeripheralConnection: @Sendable (_ peripheral: Peripheral) -> Void
25-
let _registerForConnectionEvents: @Sendable (_ options: [CBConnectionEventMatchingOption : Any]?) -> Void
26-
27-
public let didUpdateState: AnyPublisher<CBManagerState, Never>
28-
public let willRestoreState: AnyPublisher<[String: Any], Never>
29-
public let didConnectPeripheral: AnyPublisher<Peripheral, Never>
30-
public let didFailToConnectPeripheral: AnyPublisher<(Peripheral, Error?), Never>
31-
public let didDisconnectPeripheral: AnyPublisher<(Peripheral, Error?), Never>
27+
public var didUpdateState: AnyPublisher<CBManagerState, Never>
28+
public var willRestoreState: AnyPublisher<[String: Any], Never>
29+
public var didConnectPeripheral: AnyPublisher<Peripheral, Never>
30+
public var didFailToConnectPeripheral: AnyPublisher<(Peripheral, Error?), Never>
31+
public var didDisconnectPeripheral: AnyPublisher<(Peripheral, Error?), Never>
3232

33-
public let connectionEventDidOccur: AnyPublisher<(CBConnectionEvent, Peripheral), Never>
34-
public let didDiscoverPeripheral: AnyPublisher<PeripheralDiscovery, Never>
33+
public var connectionEventDidOccur: AnyPublisher<(CBConnectionEvent, Peripheral), Never>
34+
public var didDiscoverPeripheral: AnyPublisher<PeripheralDiscovery, Never>
3535

36-
public let didUpdateACNSAuthorizationForPeripheral: AnyPublisher<Peripheral, Never>
36+
public var didUpdateACNSAuthorizationForPeripheral: AnyPublisher<Peripheral, Never>
3737

3838
public var state: CBManagerState {
3939
_state()

Sources/CombineCoreBluetooth/Peripheral/Interface+Peripheral.swift

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ public struct Peripheral: Sendable {
77
let rawValue: CBPeripheral?
88
let delegate: Delegate?
99

10-
var _name: @Sendable () -> String?
11-
var _identifier: @Sendable () -> UUID
12-
var _state: @Sendable () -> CBPeripheralState
13-
var _services: @Sendable () -> [CBService]?
14-
var _canSendWriteWithoutResponse: @Sendable () -> Bool
15-
16-
var _ancsAuthorized: @Sendable () -> Bool
17-
18-
var _readRSSI: @Sendable () -> Void
19-
var _discoverServices: @Sendable (_ serviceUUIDs: [CBUUID]?) -> Void
20-
var _discoverIncludedServices: @Sendable (_ includedServiceUUIDs: [CBUUID]?, _ service: CBService) -> Void
21-
var _discoverCharacteristics: @Sendable (_ characteristicUUIDs: [CBUUID]?, _ service: CBService) -> Void
22-
var _readValueForCharacteristic: @Sendable (_ characteristic: CBCharacteristic) -> Void
23-
var _maximumWriteValueLength: @Sendable (_ type: CBCharacteristicWriteType) -> Int
24-
var _writeValueForCharacteristic: @Sendable (_ data: Data, _ characteristic: CBCharacteristic, _ type: CBCharacteristicWriteType) -> Void
25-
var _setNotifyValue: @Sendable (_ enabled: Bool, _ characteristic: CBCharacteristic) -> Void
26-
var _discoverDescriptors: @Sendable (_ characteristic: CBCharacteristic) -> Void
27-
var _readValueForDescriptor: @Sendable (_ descriptor: CBDescriptor) -> Void
28-
var _writeValueForDescriptor: @Sendable (_ data: Data, _ descriptor: CBDescriptor) -> Void
29-
var _openL2CAPChannel: @Sendable (_ PSM: CBL2CAPPSM) -> Void
30-
31-
var didReadRSSI: AnyPublisher<Result<Double, Error>, Never>
32-
var didDiscoverServices: AnyPublisher<([CBService], Error?), Never>
33-
var didDiscoverIncludedServices: AnyPublisher<(CBService, Error?), Never>
34-
var didDiscoverCharacteristics: AnyPublisher<(CBService, Error?), Never>
35-
var didUpdateValueForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never>
36-
var didWriteValueForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never>
37-
var didUpdateNotificationState: AnyPublisher<(CBCharacteristic, Error?), Never>
38-
var didDiscoverDescriptorsForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never>
39-
var didUpdateValueForDescriptor: AnyPublisher<(CBDescriptor, Error?), Never>
40-
var didWriteValueForDescriptor: AnyPublisher<(CBDescriptor, Error?), Never>
41-
var didOpenChannel: AnyPublisher<(L2CAPChannel?, Error?), Never>
10+
public var _name: @Sendable () -> String?
11+
public var _identifier: @Sendable () -> UUID
12+
public var _state: @Sendable () -> CBPeripheralState
13+
public var _services: @Sendable () -> [CBService]?
14+
public var _canSendWriteWithoutResponse: @Sendable () -> Bool
15+
16+
public var _ancsAuthorized: @Sendable () -> Bool
17+
18+
public var _readRSSI: @Sendable () -> Void
19+
public var _discoverServices: @Sendable (_ serviceUUIDs: [CBUUID]?) -> Void
20+
public var _discoverIncludedServices: @Sendable (_ includedServiceUUIDs: [CBUUID]?, _ service: CBService) -> Void
21+
public var _discoverCharacteristics: @Sendable (_ characteristicUUIDs: [CBUUID]?, _ service: CBService) -> Void
22+
public var _readValueForCharacteristic: @Sendable (_ characteristic: CBCharacteristic) -> Void
23+
public var _maximumWriteValueLength: @Sendable (_ type: CBCharacteristicWriteType) -> Int
24+
public var _writeValueForCharacteristic: @Sendable (_ data: Data, _ characteristic: CBCharacteristic, _ type: CBCharacteristicWriteType) -> Void
25+
public var _setNotifyValue: @Sendable (_ enabled: Bool, _ characteristic: CBCharacteristic) -> Void
26+
public var _discoverDescriptors: @Sendable (_ characteristic: CBCharacteristic) -> Void
27+
public var _readValueForDescriptor: @Sendable (_ descriptor: CBDescriptor) -> Void
28+
public var _writeValueForDescriptor: @Sendable (_ data: Data, _ descriptor: CBDescriptor) -> Void
29+
public var _openL2CAPChannel: @Sendable (_ PSM: CBL2CAPPSM) -> Void
30+
31+
public var didReadRSSI: AnyPublisher<Result<Double, Error>, Never>
32+
public var didDiscoverServices: AnyPublisher<([CBService], Error?), Never>
33+
public var didDiscoverIncludedServices: AnyPublisher<(CBService, Error?), Never>
34+
public var didDiscoverCharacteristics: AnyPublisher<(CBService, Error?), Never>
35+
public var didUpdateValueForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never>
36+
public var didWriteValueForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never>
37+
public var didUpdateNotificationState: AnyPublisher<(CBCharacteristic, Error?), Never>
38+
public var didDiscoverDescriptorsForCharacteristic: AnyPublisher<(CBCharacteristic, Error?), Never>
39+
public var didUpdateValueForDescriptor: AnyPublisher<(CBDescriptor, Error?), Never>
40+
public var didWriteValueForDescriptor: AnyPublisher<(CBDescriptor, Error?), Never>
41+
public var didOpenChannel: AnyPublisher<(L2CAPChannel?, Error?), Never>
4242

4343
public var isReadyToSendWriteWithoutResponse: AnyPublisher<Void, Never>
4444
public var nameUpdates: AnyPublisher<String?, Never>

Sources/CombineCoreBluetooth/PeripheralManager/Interface+PeripheralManager.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ import Foundation
44
public struct PeripheralManager: Sendable {
55
let delegate: Delegate?
66

7-
let _state: @Sendable () -> CBManagerState
8-
let _authorization: @Sendable () -> CBManagerAuthorization
9-
let _isAdvertising: @Sendable () -> Bool
10-
let _startAdvertising: @Sendable (_ advertisementData: AdvertisementData?) -> Void
11-
let _stopAdvertising: @Sendable () -> Void
12-
let _setDesiredConnectionLatency: @Sendable (_ latency: CBPeripheralManagerConnectionLatency, _ central: Central) -> Void
13-
let _add: @Sendable (_ service: CBMutableService) -> Void
14-
let _remove: @Sendable (_ service: CBMutableService) -> Void
15-
let _removeAllServices: @Sendable () -> Void
16-
let _respondToRequest: @Sendable (_ request: ATTRequest, _ result: CBATTError.Code) -> Void
17-
let _updateValueForCharacteristic: @Sendable (_ value: Data, _ characteristic: CBMutableCharacteristic, _ centrals: [Central]?) -> Bool
18-
let _publishL2CAPChannel: @Sendable (_ encryptionRequired: Bool) -> Void
19-
let _unpublishL2CAPChannel: @Sendable (_ PSM: CBL2CAPPSM) -> Void
7+
public var _state: @Sendable () -> CBManagerState
8+
public var _authorization: @Sendable () -> CBManagerAuthorization
9+
public var _isAdvertising: @Sendable () -> Bool
10+
public var _startAdvertising: @Sendable (_ advertisementData: AdvertisementData?) -> Void
11+
public var _stopAdvertising: @Sendable () -> Void
12+
public var _setDesiredConnectionLatency: @Sendable (_ latency: CBPeripheralManagerConnectionLatency, _ central: Central) -> Void
13+
public var _add: @Sendable (_ service: CBMutableService) -> Void
14+
public var _remove: @Sendable (_ service: CBMutableService) -> Void
15+
public var _removeAllServices: @Sendable () -> Void
16+
public var _respondToRequest: @Sendable (_ request: ATTRequest, _ result: CBATTError.Code) -> Void
17+
public var _updateValueForCharacteristic: @Sendable (_ value: Data, _ characteristic: CBMutableCharacteristic, _ centrals: [Central]?) -> Bool
18+
public var _publishL2CAPChannel: @Sendable (_ encryptionRequired: Bool) -> Void
19+
public var _unpublishL2CAPChannel: @Sendable (_ PSM: CBL2CAPPSM) -> Void
2020

21-
public let didUpdateState: AnyPublisher<CBManagerState, Never>
22-
public let didStartAdvertising: AnyPublisher<Error?, Never>
23-
public let didAddService: AnyPublisher<(CBService, Error?), Never>
24-
public let centralDidSubscribeToCharacteristic: AnyPublisher<(Central, CBCharacteristic), Never>
25-
public let centralDidUnsubscribeFromCharacteristic: AnyPublisher<(Central, CBCharacteristic), Never>
26-
public let didReceiveReadRequest: AnyPublisher<ATTRequest, Never>
27-
public let didReceiveWriteRequests: AnyPublisher<[ATTRequest], Never>
28-
public let readyToUpdateSubscribers: AnyPublisher<Void, Never>
29-
public let didPublishL2CAPChannel: AnyPublisher<(CBL2CAPPSM, Error?), Never>
30-
public let didUnpublishL2CAPChannel: AnyPublisher<(CBL2CAPPSM, Error?), Never>
31-
public let didOpenL2CAPChannel: AnyPublisher<(L2CAPChannel?, Error?), Never>
21+
public var didUpdateState: AnyPublisher<CBManagerState, Never>
22+
public var didStartAdvertising: AnyPublisher<Error?, Never>
23+
public var didAddService: AnyPublisher<(CBService, Error?), Never>
24+
public var centralDidSubscribeToCharacteristic: AnyPublisher<(Central, CBCharacteristic), Never>
25+
public var centralDidUnsubscribeFromCharacteristic: AnyPublisher<(Central, CBCharacteristic), Never>
26+
public var didReceiveReadRequest: AnyPublisher<ATTRequest, Never>
27+
public var didReceiveWriteRequests: AnyPublisher<[ATTRequest], Never>
28+
public var readyToUpdateSubscribers: AnyPublisher<Void, Never>
29+
public var didPublishL2CAPChannel: AnyPublisher<(CBL2CAPPSM, Error?), Never>
30+
public var didUnpublishL2CAPChannel: AnyPublisher<(CBL2CAPPSM, Error?), Never>
31+
public var didOpenL2CAPChannel: AnyPublisher<(L2CAPChannel?, Error?), Never>
3232

3333
public var state: CBManagerState {
3434
_state()

0 commit comments

Comments
 (0)