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.

88 lines
2.0 KiB

  1. /*
  2. * REVISIONS:
  3. * pcy29Nov92: New defines from codes.h
  4. * sja08Dec92: Changed #define BATTERY_TYPE to RATED_BATTERY_VOLTAGE
  5. * jod13Jan93: Added eventList to InterpretMessage
  6. * jod28Jan93: Added fixes for support of Data and Decrement Sets
  7. * pcy02Feb93: InterpretSetMessage needs to return a value
  8. * ane03Feb93: Changed BuildPollTransactionGroupMessages to check IsPollSet
  9. * differently
  10. * jod14Feb93: Handle mulit char sets (@ddd, KK, etc)
  11. * pcy16Feb92: Move UPS_STATE_SET define to err.h to avoid conflicts
  12. * pcy16Feb92: Allow gets of UpsState params
  13. * pcy16Feb93: Made battery test results pollable
  14. * pcy21Apr93: OS/2 2.0 FE Merge
  15. * jod05Apr93: Added changes for Deep Discharge
  16. * jod14May93: Added Matrix changes.
  17. * cad10Jun93: Added Mups parms
  18. * cad22Jul93: Fixed up destructor conflicts and omissions
  19. * cad27Aug93: Added MeasureUPS firmware poll param
  20. * rct05Nov93: Added a useful destructor
  21. * jps14Jul94: added stdlib.h for os2
  22. * ajr08Nov95: SINIX Port
  23. */
  24. #define INCL_BASE
  25. #define INCL_NOPM
  26. /* #define INCL_NOPMAPI jwa */
  27. #include "cdefine.h"
  28. extern "C" {
  29. #if (C_OS & C_OS2)
  30. #include <stdlib.h>
  31. #endif
  32. }
  33. #include "pollparm.h"
  34. #include "trans.h"
  35. #include "proto.h"
  36. INT Protocol::currentTransactionId = 0;
  37. Protocol::Protocol()
  38. {
  39. theOriginalTransactionItem = (PTransactionItem)NULL;
  40. theCurrentTransactionGroup = (PTransactionGroup)NULL;
  41. for (int i=0; i<PROTOSIZE; i++)
  42. {
  43. ProtoList[i] = (PPollParam)NULL;
  44. }
  45. }
  46. Protocol::~Protocol()
  47. {
  48. for (int i=0; i<PROTOSIZE; i++)
  49. {
  50. if (ProtoList[i] != (PPollParam) NULL) {
  51. delete (PPollParam) ProtoList[i];
  52. ProtoList[i] = NULL;
  53. }
  54. }
  55. }
  56. INT Protocol::IsEventCodePollable(INT aCode)
  57. {
  58. PollParam* poll_param = ProtoList[aCode];
  59. if(poll_param)
  60. {
  61. if (poll_param->isPollable())
  62. {
  63. return TRUE;
  64. }
  65. }
  66. return FALSE;
  67. }
  68. VOID Protocol::SetCurrentTransactionGroup(PTransactionGroup aTransactionGroup)
  69. {
  70. theCurrentTransactionGroup = aTransactionGroup;
  71. }