Leaked source code of windows server 2003
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.

174 lines
3.5 KiB

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