From e9129ab95c35fa67f35861306deb9fadc4671acf Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sat, 16 Dec 2023 12:14:18 +1100 Subject: [PATCH] Add convenience manager initializers --- Sources/SwiftOCA/OCC/ControlClasses/Agents/TimeSource.swift | 4 ++-- .../OCC/ControlClasses/Managers/AudioProcessingManager.swift | 4 ++++ .../OCC/ControlClasses/Managers/DeviceTimeManager.swift | 4 ++-- .../OCC/ControlClasses/Managers/DiagnosticManager.swift | 4 ++++ .../SwiftOCA/OCC/ControlClasses/Managers/LockManager.swift | 4 ++++ .../OCC/ControlClasses/Managers/MediaClockManager.swift | 4 ++++ .../OCC/ControlDataTypes/WellKnownObjectNumbers.swift | 3 ++- 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Sources/SwiftOCA/OCC/ControlClasses/Agents/TimeSource.swift b/Sources/SwiftOCA/OCC/ControlClasses/Agents/TimeSource.swift index 3fc44fdc..0ab94b18 100644 --- a/Sources/SwiftOCA/OCC/ControlClasses/Agents/TimeSource.swift +++ b/Sources/SwiftOCA/OCC/ControlClasses/Agents/TimeSource.swift @@ -40,8 +40,8 @@ public enum OcaTimeDeliveryMechanism: OcaUint8, Codable, Sendable { case sntp = 4 case ieee1588v1 = 5 case ieee1588v2 = 6 - case ieee1588v2_1 = 7 // 2.1 - case ieee8021AS = 8 + case ieee1588v2_1 = 7 + case ieee8021AS = 8 // gPTP case streamEndpoint = 9 case aes11 = 10 case expansionBase = 128 diff --git a/Sources/SwiftOCA/OCC/ControlClasses/Managers/AudioProcessingManager.swift b/Sources/SwiftOCA/OCC/ControlClasses/Managers/AudioProcessingManager.swift index a7950ca4..ac99cb41 100644 --- a/Sources/SwiftOCA/OCC/ControlClasses/Managers/AudioProcessingManager.swift +++ b/Sources/SwiftOCA/OCC/ControlClasses/Managers/AudioProcessingManager.swift @@ -17,4 +17,8 @@ open class OcaAudioProcessingManager: OcaManager { override public class var classID: OcaClassID { OcaClassID("1.3.9") } override public class var classVersion: OcaClassVersionNumber { 3 } + + public convenience init() { + self.init(objectNumber: OcaAudioProcessingManagerONo) + } } diff --git a/Sources/SwiftOCA/OCC/ControlClasses/Managers/DeviceTimeManager.swift b/Sources/SwiftOCA/OCC/ControlClasses/Managers/DeviceTimeManager.swift index 08cfc7fa..b758c378 100644 --- a/Sources/SwiftOCA/OCC/ControlClasses/Managers/DeviceTimeManager.swift +++ b/Sources/SwiftOCA/OCC/ControlClasses/Managers/DeviceTimeManager.swift @@ -24,7 +24,7 @@ open class OcaDeviceTimeManager: OcaManager { } } - public func setDeviceTimeNTP(_ time: OcaTimeNTP) async throws { + public func set(deviceTimeNTP time: OcaTimeNTP) async throws { try await sendCommandRrq(methodID: OcaMethodID("3.2"), parameters: time) } @@ -47,7 +47,7 @@ open class OcaDeviceTimeManager: OcaManager { } } - public func setDeviceTimePTP(_ time: OcaTime) async throws { + public func set(deviceTimePTP time: OcaTime) async throws { try await sendCommandRrq(methodID: OcaMethodID("3.7"), parameters: time) } diff --git a/Sources/SwiftOCA/OCC/ControlClasses/Managers/DiagnosticManager.swift b/Sources/SwiftOCA/OCC/ControlClasses/Managers/DiagnosticManager.swift index 8bb3bea6..eb667883 100644 --- a/Sources/SwiftOCA/OCC/ControlClasses/Managers/DiagnosticManager.swift +++ b/Sources/SwiftOCA/OCC/ControlClasses/Managers/DiagnosticManager.swift @@ -17,4 +17,8 @@ open class OcaDiagnosticManager: OcaManager { override public class var classID: OcaClassID { OcaClassID("1.3.13") } override public class var classVersion: OcaClassVersionNumber { 3 } + + public convenience init() { + self.init(objectNumber: OcaDiagnosticManagerONo) + } } diff --git a/Sources/SwiftOCA/OCC/ControlClasses/Managers/LockManager.swift b/Sources/SwiftOCA/OCC/ControlClasses/Managers/LockManager.swift index 1f394642..f9deeab2 100644 --- a/Sources/SwiftOCA/OCC/ControlClasses/Managers/LockManager.swift +++ b/Sources/SwiftOCA/OCC/ControlClasses/Managers/LockManager.swift @@ -36,4 +36,8 @@ open class OcaLockManager: OcaManager { public func abortWaits(oNo: OcaONo) async throws { try await sendCommandRrq(methodID: OcaMethodID("3.2"), parameters: oNo) } + + public convenience init() { + self.init(objectNumber: OcaLockManagerONo) + } } diff --git a/Sources/SwiftOCA/OCC/ControlClasses/Managers/MediaClockManager.swift b/Sources/SwiftOCA/OCC/ControlClasses/Managers/MediaClockManager.swift index 1753978e..bcf06e90 100644 --- a/Sources/SwiftOCA/OCC/ControlClasses/Managers/MediaClockManager.swift +++ b/Sources/SwiftOCA/OCC/ControlClasses/Managers/MediaClockManager.swift @@ -35,4 +35,8 @@ open class OcaMediaClockManager: OcaManager { getMethodID: OcaMethodID("3.3") ) public var clock3s: OcaProperty>.State + + public convenience init() { + self.init(objectNumber: OcaMediaClockManagerONo) + } } diff --git a/Sources/SwiftOCA/OCC/ControlDataTypes/WellKnownObjectNumbers.swift b/Sources/SwiftOCA/OCC/ControlDataTypes/WellKnownObjectNumbers.swift index c1651739..28de7b58 100644 --- a/Sources/SwiftOCA/OCC/ControlDataTypes/WellKnownObjectNumbers.swift +++ b/Sources/SwiftOCA/OCC/ControlDataTypes/WellKnownObjectNumbers.swift @@ -28,7 +28,8 @@ public let OcaAudioProcessingManagerONo: OcaONo = 9 public let OcaDeviceTimeManagerONo: OcaONo = 10 public let OcaTaskManagerONo: OcaONo = 11 public let OcaCodingManagerONo: OcaONo = 12 -public let OcaDiagnosticsManagerONo: OcaONo = 13 +public let OcaDiagnosticManagerONo: OcaONo = 13 +public let OcaLockManagerONo: OcaONo = 14 public let OcaRootBlockONo: OcaONo = 100