DeviceManager.swift 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // DeviceManager.swift
  3. // LoopKit
  4. //
  5. // Copyright © 2018 LoopKit Authors. All rights reserved.
  6. //
  7. import Foundation
  8. import UserNotifications
  9. public protocol DeviceManagerDelegate: AlertIssuer, PersistedAlertStore {
  10. // This will be called from an unspecified queue
  11. func deviceManager(_ manager: DeviceManager, logEventForDeviceIdentifier deviceIdentifier: String?, type: DeviceLogEntryType, message: String, completion: ((Error?) -> Void)?)
  12. }
  13. public protocol DeviceManager: CustomDebugStringConvertible, AlertResponder, AlertSoundVendor {
  14. typealias RawStateValue = [String: Any]
  15. /// A unique identifier for this manager
  16. var managerIdentifier: String { get }
  17. /// A title describing this manager
  18. var localizedTitle: String { get }
  19. /// Initializes the manager with its previously-saved state
  20. ///
  21. /// Return nil if the saved state is invalid to prevent restoration
  22. ///
  23. /// - Parameter rawState: The last state
  24. init?(rawState: RawStateValue)
  25. /// The current, serializable state of the manager
  26. var rawState: RawStateValue { get }
  27. /// Is the device manager onboarded and ready for use?
  28. var isOnboarded: Bool { get }
  29. }