@@ -140,7 +140,12 @@ public class CentralManager {
140
140
self . cbCentralManager. connect ( peripheral. cbPeripheral, options: options)
141
141
}
142
142
}
143
-
143
+
144
+ @available ( macOS, unavailable)
145
+ public func registerForConnectionEvents( options: [ CBConnectionEventMatchingOption : Any ] ? = nil ) {
146
+ self . cbCentralManager. registerForConnectionEvents ( options: options)
147
+ }
148
+
144
149
/// Cancels an active or pending local connection to a peripheral.
145
150
public func cancelPeripheralConnection( _ peripheral: Peripheral ) async throws {
146
151
let peripheralState = peripheral. cbPeripheral. state
@@ -290,7 +295,33 @@ extension CentralManager.DelegateWrapper: CBCentralManagerDelegate {
290
295
)
291
296
}
292
297
}
293
-
298
+
299
+ #if !os(macOS)
300
+ func centralManager(
301
+ _ cbCentralManager: CBCentralManager ,
302
+ connectionEventDidOccur event: CBConnectionEvent ,
303
+ for cbPeripheral: CBPeripheral
304
+ ) {
305
+ let peripheral = Peripheral ( cbPeripheral)
306
+
307
+ switch event {
308
+ case . peerConnected:
309
+ Self . logger. info ( " Connection event for \( peripheral. identifier) " )
310
+ case . peerDisconnected:
311
+ Self . logger. info ( " Disconnection event for \( peripheral. identifier) " )
312
+ @unknown default :
313
+ break
314
+ }
315
+
316
+ self . context. eventSubject. send (
317
+ . connectionEventDidOccur(
318
+ connectionEvent: event,
319
+ peripheral: peripheral
320
+ )
321
+ )
322
+ }
323
+ #endif
324
+
294
325
func centralManager(
295
326
_ cbCentralManager: CBCentralManager ,
296
327
didFailToConnect peripheral: CBPeripheral ,
0 commit comments