File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Sources/SwiftOCA/OCA/Browsing Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,11 @@ public actor OcaConnectionBroker {
239239 }
240240 }
241241
242+ private static let _defaultServiceTypes = Set ( [
243+ OcaNetworkAdvertisingServiceType . tcp,
244+ OcaNetworkAdvertisingServiceType . udp,
245+ ] )
246+
242247 /// An async sequence of events emitted by the connection broker.
243248 ///
244249 /// This sequence provides notifications about device lifecycle changes and connection state
@@ -316,12 +321,13 @@ public actor OcaConnectionBroker {
316321 ///
317322 /// - Parameter connectionOptions: Configuration options for connections created by this broker.
318323 /// Defaults to standard options if not specified.
319- public init ( connectionOptions: Ocp1ConnectionOptions = . init( ) ) {
324+ public init (
325+ connectionOptions: Ocp1ConnectionOptions = . init( ) ,
326+ serviceTypes: Set < OcaNetworkAdvertisingServiceType > ? = nil
327+ ) {
320328 _connectionOptions = connectionOptions
321329 var browsers = [ OcaNetworkAdvertisingServiceType: BrowserMonitor] ( )
322- for serviceType in [ OcaNetworkAdvertisingServiceType . tcp,
323- OcaNetworkAdvertisingServiceType . udp]
324- {
330+ for serviceType in serviceTypes ?? Self . _defaultServiceTypes {
325331 browsers [ serviceType] = try ! BrowserMonitor ( serviceType: serviceType, broker: self )
326332 }
327333 _browsers = browsers
You can’t perform that action at this time.
0 commit comments