Skip to content

Commit

Permalink
add connection options to NetService convenience initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed May 27, 2024
1 parent a71ead4 commit 0c1b108
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Sources/SwiftOCA/OCA/Browser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ extension Ocp1ConnectionFactory {
}

extension Ocp1Connection: Ocp1ConnectionFactory {
public convenience init(_ netService: NetService) async throws {
public convenience init(
_ netService: NetService,
options: Ocp1ConnectionOptions = Ocp1ConnectionOptions()
) async throws {
guard let serviceType = OcaBrowser.ServiceType(rawValue: netService.type) else {
throw Ocp1Error.unknownServiceType
}
Expand Down Expand Up @@ -160,15 +163,17 @@ extension Ocp1Connection: Ocp1ConnectionFactory {
await self
.init(
reassigningSelfTo: try Ocp1TCPConnection(
deviceAddress: address
deviceAddress: address,
options: options
) as! Self
)
return
case .udp:
await self
.init(
reassigningSelfTo: try Ocp1UDPConnection(
deviceAddress: address
deviceAddress: address,
options: options
) as! Self
)
return
Expand Down

0 comments on commit 0c1b108

Please sign in to comment.