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.

75 lines
1.5 KiB

  1. /*
  2. * REVISIONS:
  3. * pcy26Nov92: Added #if C_OS2 around os2.h
  4. * ane03Feb93: Added destructor and error checking
  5. * pcy30Apr93: Moved DevCOmController to its own file
  6. * mwh18Nov93: changed EventID to INT
  7. * tjg26Jan98: Added Stop method
  8. */
  9. #define INCL_BASE
  10. #define INCL_NOPM
  11. #include "cdefine.h"
  12. #include "_defs.h"
  13. #include "event.h"
  14. #include "codes.h"
  15. #include "err.h"
  16. #include "cdevice.h"
  17. #include "comctrl.h"
  18. CommController :: CommController()
  19. : Controller()
  20. {
  21. }
  22. CommController :: ~CommController()
  23. {
  24. if (theCommDevice) {
  25. delete theCommDevice;
  26. theCommDevice = NULL;
  27. }
  28. }
  29. INT CommController::Initialize()
  30. {
  31. theObjectStatus = theCommDevice->Initialize();
  32. return theObjectStatus;
  33. }
  34. INT CommController :: RegisterEvent(INT code, PUpdateObj sensor)
  35. {
  36. Controller :: RegisterEvent(code, sensor);
  37. theCommDevice->RegisterEvent(code ,(PUpdateObj)this);
  38. return ErrNO_ERROR;
  39. }
  40. INT CommController :: UnregisterEvent(INT code, PUpdateObj sensor)
  41. {
  42. theCommDevice->UnregisterEvent(code ,(PUpdateObj)this);
  43. Controller :: UnregisterEvent(code, sensor);
  44. return ErrNO_ERROR;
  45. }
  46. INT CommController :: Get(INT aCode, PCHAR aValue)
  47. {
  48. return theCommDevice->Get((INT)aCode, aValue);
  49. }
  50. INT CommController :: Set(INT aCode, PCHAR aValue)
  51. {
  52. return theCommDevice->Set((INT)aCode, aValue);
  53. }
  54. VOID CommController::Stop()
  55. {
  56. if (theCommDevice) {
  57. Event event(EXIT_THREAD_NOW, (PCHAR)NULL);
  58. theCommDevice->Update(&event);
  59. }
  60. }