Add advanced monitoring and release infrastructure
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import Foundation
|
||||
|
||||
public enum PuterHelperConstants {
|
||||
public static let machServiceName = "dev.soconnor.puter.helper"
|
||||
public static let daemonPlistName = "dev.soconnor.puter.helper.plist"
|
||||
public static let protocolVersion = 1
|
||||
}
|
||||
|
||||
public enum PuterFanTargetValidator {
|
||||
public static let validFanIDs = 0...15
|
||||
public static let validRPM = 500...20_000
|
||||
|
||||
public static func validate(_ targets: [NSNumber: NSNumber]) -> [(fan: Int, rpm: Int)]? {
|
||||
let values = targets.compactMap { key, value -> (fan: Int, rpm: Int)? in
|
||||
let fan = key.intValue
|
||||
let rpm = value.intValue
|
||||
guard validFanIDs.contains(fan), validRPM.contains(rpm) else { return nil }
|
||||
return (fan, rpm)
|
||||
}
|
||||
guard values.count == targets.count, !values.isEmpty else { return nil }
|
||||
return values.sorted { $0.fan < $1.fan }
|
||||
}
|
||||
}
|
||||
|
||||
@objc public protocol PuterPrivilegedHelperProtocol {
|
||||
func version(withReply reply: @escaping (Int) -> Void)
|
||||
func setFanTargets(_ targets: [NSNumber: NSNumber], withReply reply: @escaping (Bool, String?) -> Void)
|
||||
func restoreAutomaticFanControl(withReply reply: @escaping (Bool, String?) -> Void)
|
||||
}
|
||||
Reference in New Issue
Block a user