package enum DriverVoiceOverDelivery { package static func matches( target: DriverInputTarget, expectedKey: UInt16?, key: Int64, sourcePID: Int64, voiceOverPIDs: Set, targetPID: Int64, timestamp: UInt64, armedAt: UInt64 ) -> Bool { belongsToRequest( target: target, expectedKey: expectedKey, key: key, sourcePID: sourcePID, voiceOverPIDs: voiceOverPIDs, timestamp: timestamp, armedAt: armedAt) && targetPID == Int64(target.pid) } package static func belongsToRequest( target: DriverInputTarget, expectedKey: UInt16?, key: Int64, sourcePID: Int64, voiceOverPIDs: Set, timestamp: UInt64, armedAt: UInt64, allowFixture: Bool = false ) -> Bool { guard (target.panel && !target.fixture) || (allowFixture && target.fixture && !target.panel), target.pid > 0, target.windowID > 0, let expectedKey, let source = Int32(exactly: sourcePID), source > 0 else { return false } return key == Int64(expectedKey) && voiceOverPIDs.contains(source) && timestamp >= armedAt } }