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.

145 lines
3.7 KiB

  1. //@doc
  2. /******************************************************
  3. **
  4. ** @module DTRANS.H | Definition file for DataTransmitter
  5. **
  6. ** Description:
  7. ** The Data Transmitters allow virtualization of the
  8. ** actual media used for transmission of data to the FF Device
  9. ** DataTransmitter - Base class that defines the functionality
  10. ** SerialDataTransmitter - Transmitter for Serial (via CreateFile)
  11. **
  12. ** Classes:
  13. ** DataTransmitter
  14. ** SerialDataTransmitter
  15. ** PinTransmitter
  16. **
  17. ** History:
  18. ** Created 11/13/97 Matthew L. Coill (mlc)
  19. **
  20. ** (c) 1986-1997 Microsoft Corporation. All Rights Reserved.
  21. ******************************************************/
  22. #ifndef __DTRANS_H__
  23. #define __DTRANS_H__
  24. #ifdef DIRECTINPUT_VERSION
  25. #undef DIRECTINPUT_VERSION
  26. #endif
  27. #define DIRECTINPUT_VERSION 0x050a
  28. #include <dinput.h>
  29. #include <dmusicc.h>
  30. #ifndef override
  31. #define override
  32. #endif
  33. //
  34. // @class DataTransmitter class
  35. //
  36. class DataTransmitter
  37. {
  38. //@access Constructor
  39. protected:
  40. //@cmember constructor
  41. DataTransmitter() {};
  42. //@access Destructor
  43. public:
  44. //@cmember destructor
  45. virtual ~DataTransmitter() {};
  46. //@access Member functions
  47. public:
  48. virtual BOOL Initialize() { return FALSE; }
  49. virtual BOOL Send(BYTE* data, UINT numBytes) { return FALSE; }
  50. virtual BOOL ReceiveData(BYTE* data, UINT numBytes) { return FALSE; }
  51. virtual HANDLE GetCOMMHandleHack() const { return NULL; }
  52. virtual void StopAutoClose() {}; // Temporary hack to avoid closing own handle (for backdoor serial)
  53. virtual ULONG GetSerialPortHack() { return 0; }
  54. };
  55. //
  56. // @class SerialDataTransmitter class
  57. //
  58. class SerialDataTransmitter : public DataTransmitter
  59. {
  60. //@access Constructor/Destructor
  61. public:
  62. //@cmember constructor
  63. SerialDataTransmitter();
  64. //@cmember destructor
  65. override ~SerialDataTransmitter();
  66. override BOOL Initialize();
  67. override BOOL Send(BYTE* data, UINT numBytes);
  68. override HANDLE GetCOMMHandleHack() const { return m_SerialPort; }
  69. override void StopAutoClose() { m_SerialPort = INVALID_HANDLE_VALUE; }
  70. override ULONG GetSerialPortHack() { return m_SerialPortIDHack; }
  71. //@access private data members
  72. private:
  73. HANDLE m_SerialPort;
  74. ULONG m_SerialPortIDHack;
  75. };
  76. /************************************************************************
  77. **
  78. ** @class DMusicTransmitter |
  79. ** This transmitter uses the IDirectMusic Interface to send data
  80. ** to the joystick.
  81. **
  82. *************************************************************************/
  83. class DMusicTransmitter :
  84. public DataTransmitter
  85. {
  86. //@access Constructor/Destructor
  87. public:
  88. //@cmember constructor
  89. DMusicTransmitter();
  90. //@cmember destructor
  91. override ~DMusicTransmitter();
  92. override BOOL Initialize();
  93. override BOOL Send(BYTE* pData, UINT ulByteCount);
  94. //@access private data members
  95. private:
  96. IDirectMusic* m_pIDirectMusic;
  97. IDirectMusicPort* m_pIDirectMusicPort;
  98. IDirectMusicBuffer* m_pIDirectMusicBuffer;
  99. };
  100. #if 0 // Fix pin later
  101. typedef DWORD (WINAPI* KSCREATEPIN)(HANDLE, PKSPIN_CONNECT, ACCESS_MASK, HANDLE*);
  102. //
  103. // @class PinTransmitter class
  104. //
  105. class PinTransmitter : public DataTransmitter
  106. {
  107. //@access Constructor/Destructor
  108. public:
  109. //@cmember constructor
  110. PinTransmitter();
  111. //@cmember destructor
  112. override ~PinTransmitter();
  113. override BOOL Initialize();
  114. override BOOL Send(BYTE* data, UINT numBytes);
  115. //@access private data members
  116. private:
  117. BOOL CreatePinInstance(UINT pinNumber, KSCREATEPIN pfCreatePin);
  118. BOOL OverLappedPinIOCTL(OVERLAPPED overlapped, KSP_PIN ksPinProp, void* pData, DWORD dataSize);
  119. void SetPinState(KSSTATE state);
  120. HANDLE m_UartFilter;
  121. HANDLE m_MidiPin;
  122. HANDLE m_MidiOutEvent;
  123. };
  124. #endif
  125. #endif __DTRANS_H__