Source code of Windows XP (NT5)
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.

170 lines
3.4 KiB

  1. /* Copyright 1999 American Power Conversion, All Rights Reserved
  2. *
  3. * Description:
  4. * Implements the UPS to the service - it does this by
  5. * either loading a UPS driver or by using the default
  6. * Generic UPS interface (simple signalling)
  7. *
  8. * Revision History:
  9. * mholly 19Apr1999 initial revision.
  10. *
  11. */
  12. #ifndef _INC_UPS_DRIVER_H_
  13. #define _INC_UPS_DRIVER_H_
  14. //
  15. // values that represent the state of the
  16. // UPS system - these values are used in the
  17. // UPSGetState and UPSWaitForStateChange functions
  18. //
  19. #define UPS_ONLINE 1
  20. #define UPS_ONBATTERY 2
  21. #define UPS_LOWBATTERY 4
  22. #define UPS_NOCOMM 8
  23. #define UPS_CRITICAL 16
  24. //
  25. // possible error codes returned from UPSInit
  26. //
  27. #define UPS_INITUNKNOWNERROR 0
  28. #define UPS_INITOK 1
  29. #define UPS_INITNOSUCHDRIVER 2
  30. #define UPS_INITBADINTERFACE 3
  31. #define UPS_INITREGISTRYERROR 4
  32. #define UPS_INITCOMMOPENERROR 5
  33. #define UPS_INITCOMMSETUPERROR 6
  34. /**
  35. * UPSInit
  36. *
  37. * Description:
  38. *
  39. * The UPSInit function must be called before any
  40. * other function in this file
  41. *
  42. * Parameters:
  43. * None
  44. *
  45. * Returns:
  46. * UPS_INITOK: Initalization was successful
  47. * UPS_INITNOSUCHDRIVER: The configured driver DLL can't be opened
  48. * UPS_INITBADINTERFACE: The configured driver DLL doesn't support
  49. * the UPS driver interface
  50. * UPS_INITREGISTRYERROR: The 'Options' registry value is corrupt
  51. * UPS_INITCOMMOPENERROR: The comm port could not be opened
  52. * UPS_INITCOMMSETUPERROR: The comm port could not be configured
  53. * UPS_INITUNKNOWNERROR: Undefined error has occurred
  54. *
  55. */
  56. DWORD UPSInit(void);
  57. /**
  58. * UPSStop
  59. *
  60. * Description:
  61. * After a call to UPSStop, only the UPSInit
  62. * function is valid. This call will unload the
  63. * UPS driver interface and stop monitoring of the
  64. * UPS system
  65. *
  66. * Parameters:
  67. * None
  68. *
  69. * Returns:
  70. * None
  71. *
  72. */
  73. void UPSStop(void);
  74. /**
  75. * UPSWaitForStateChange
  76. *
  77. * Description:
  78. * Blocks until the state of the UPS differs
  79. * from the value passed in via aState or
  80. * anInterval milliseconds has expired. If
  81. * anInterval has a value of INFINITE this
  82. * function will never timeout
  83. *
  84. * Parameters:
  85. * aState: defines the state to wait for a change from,
  86. * possible values:
  87. * UPS_ONLINE
  88. * UPS_ONBATTERY
  89. * UPS_LOWBATTERY
  90. * UPS_NOCOMM
  91. *
  92. * anInterval: timeout in milliseconds, or INFINITE for
  93. * no timeout interval
  94. *
  95. * Returns:
  96. * None
  97. *
  98. */
  99. void UPSWaitForStateChange(DWORD aCurrentState, DWORD anInterval);
  100. /**
  101. * UPSGetState
  102. *
  103. * Description:
  104. * returns the current state of the UPS
  105. *
  106. * Parameters:
  107. * None
  108. *
  109. * Returns:
  110. * possible values:
  111. * UPS_ONLINE
  112. * UPS_ONBATTERY
  113. * UPS_LOWBATTERY
  114. * UPS_NOCOMM
  115. *
  116. */
  117. DWORD UPSGetState(void);
  118. /**
  119. * UPSCancelWait
  120. *
  121. * Description:
  122. * interrupts pending calls to UPSWaitForStateChange
  123. * without regard to timout or state change
  124. *
  125. * Parameters:
  126. * None
  127. *
  128. * Returns:
  129. * None
  130. *
  131. */
  132. void UPSCancelWait(void);
  133. /**
  134. * UPSTurnOff
  135. *
  136. * Description:
  137. * Attempts to turn off the outlets on the UPS
  138. * after the specified delay. This call must
  139. * return immediately. Any work, such as a timer,
  140. * must be performed on a another thread.
  141. *
  142. * Parameters:
  143. * aTurnOffDelay: the minimum amount of time to wait before
  144. * turning off the outlets on the UPS
  145. *
  146. * Returns:
  147. * None
  148. *
  149. */
  150. void UPSTurnOff(DWORD aTurnOffDelay);
  151. #endif