Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IThermalStatus.cs 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. namespace UnityEngine.AdaptivePerformance
  3. {
  4. /// <summary>
  5. /// You can subscribe to the thermal event delegate which sends the <see cref="ThermalMetrics"/> when the thermal state changes.
  6. /// </summary>
  7. /// <param name="thermalMetrics"></param>
  8. public delegate void ThermalEventHandler(ThermalMetrics thermalMetrics);
  9. /// <summary>
  10. /// ThermalMetrics stores the thermal state as <see cref="TemperatureLevel"/>, <see cref="TemperatureTrend"/>, and <see cref="WarningLevel"/>.
  11. /// </summary>
  12. public struct ThermalMetrics
  13. {
  14. /// <summary>
  15. /// Current thermal warning level.
  16. /// </summary>
  17. public WarningLevel WarningLevel { get; set; }
  18. /// <summary>
  19. /// Current normalized temperature level in the range of [0, 1].
  20. /// A value of 0 means standard operation temperature and that the device is not in a throttling state.
  21. /// A value of 1 means that the device has reached maximum temperature and is either going into or is already in throttling state.
  22. /// </summary>
  23. /// <value>Value in the range [0, 1].</value>
  24. public float TemperatureLevel { get; set; }
  25. /// <summary>
  26. /// Current normalized temperature trend in the range of [-1, 1].
  27. /// A value of 1 describes a rapid increase in temperature.
  28. /// A value of 0 describes a constant temperature.
  29. /// A value of -1 describes a rapid decrease in temperature.
  30. /// **Note:** It takes at least 10s until the temperature trend can start reflecting any changes.
  31. /// </summary>
  32. /// <value>Value in the range [-1, 1].</value>
  33. public float TemperatureTrend { get; set; }
  34. }
  35. /// <summary>
  36. /// Use the thermal status interface to receive thermal status events and thermal metrics of the device.
  37. /// </summary>
  38. public interface IThermalStatus
  39. {
  40. /// <summary>
  41. /// The latest thermal metrics available.
  42. /// </summary>
  43. /// <value>The latest thermal metrics</value>
  44. ThermalMetrics ThermalMetrics { get; }
  45. /// <summary>
  46. /// Subscribe to thermal events which Adaptive Performance sends when the thermal state of the device changes.
  47. /// </summary>
  48. event ThermalEventHandler ThermalEvent;
  49. }
  50. /// <summary>
  51. /// Warning levels are used in the <see cref="ThermalMetrics"/> and describe the thermal status of the device. There are three possible statuses.
  52. /// </summary>
  53. public enum WarningLevel
  54. {
  55. /// <summary>
  56. /// No warning is the normal warning level during standard thermal state.
  57. /// </summary>
  58. NoWarning,
  59. /// <summary>
  60. /// If throttling is imminent, the application should perform adjustments to avoid thermal throttling.
  61. /// </summary>
  62. ThrottlingImminent,
  63. /// <summary>
  64. /// If the application is in the throttling state, it should make adjustments to go back to normal temperature levels.
  65. /// </summary>
  66. Throttling,
  67. }
  68. }