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.

217 lines
7.6 KiB

  1. /****************************************************************************
  2. *
  3. * (C) COPYRIGHT 1999-2000, MICROSOFT CORP.
  4. *
  5. * FILE: wiamicro.h
  6. *
  7. * VERSION: 3.0
  8. *
  9. * DESCRIPTION:
  10. * Definitions to support WIA scanner and camera microdrivers.
  11. *
  12. *****************************************************************************/
  13. #pragma once
  14. #include <SCSISCAN.H>
  15. #define WIAMICRO_API __declspec(dllexport)
  16. #include <pshpack8.h>
  17. /****************************************************************************\
  18. * Scanner microdriver definitions
  19. \****************************************************************************/
  20. //
  21. // Private #defines
  22. //
  23. #define MAX_IO_HANDLES 16
  24. #define MAX_RESERVED 4
  25. #define MAX_ANSI_CHAR 255
  26. //
  27. // Common BUS types
  28. //
  29. #define BUS_TYPE_SCSI 200
  30. #define BUS_TYPE_USB 201
  31. #define BUS_TYPE_PARALLEL 202
  32. #define BUS_TYPE_FIREWIRE 203
  33. //
  34. // command list
  35. //
  36. #define SCAN_FIRST 10
  37. #define SCAN_NEXT 20
  38. #define SCAN_FINISHED 30
  39. #define SCANMODE_FINALSCAN 0
  40. #define SCANMODE_PREVIEWSCAN 1
  41. #define CMD_INITIALIZE 100
  42. #define CMD_UNINITIALIZE 101
  43. #define CMD_SETXRESOLUTION 102
  44. #define CMD_SETYRESOLUTION 103
  45. #define CMD_SETCONTRAST 104
  46. #define CMD_SETINTENSITY 105
  47. #define CMD_SETDATATYPE 106
  48. #define CMD_SETDITHER 107
  49. #define CMD_SETMIRROR 108
  50. #define CMD_SETNEGATIVE 109
  51. #define CMD_SETTONEMAP 110
  52. #define CMD_SETCOLORDITHER 111
  53. #define CMD_SETMATRIX 112
  54. #define CMD_SETSPEED 113
  55. #define CMD_SETFILTER 114
  56. #define CMD_LOAD_ADF 115
  57. #define CMD_UNLOAD_ADF 116
  58. #define CMD_GETADFAVAILABLE 117
  59. #define CMD_GETADFOPEN 118
  60. #define CMD_GETADFREADY 119
  61. #define CMD_GETADFHASPAPER 120
  62. #define CMD_GETADFSTATUS 121
  63. #define CMD_GETADFUNLOADREADY 122
  64. #define CMD_GETTPAAVAILABLE 123
  65. #define CMD_GETTPAOPENED 124
  66. #define CMD_TPAREADY 125
  67. #define CMD_SETLAMP 126
  68. #define CMD_SENDSCSICOMMAND 127
  69. #define CMD_STI_DEVICERESET 128
  70. #define CMD_STI_GETSTATUS 129
  71. #define CMD_STI_DIAGNOSTIC 130
  72. #define CMD_RESETSCANNER 131
  73. #define CMD_GETCAPABILITIES 132
  74. #define CMD_GET_INTERRUPT_EVENT 133
  75. #define CMD_SETGSDNAME 134
  76. #define CMD_SETSCANMODE 135
  77. #define CMD_SETSTIDEVICEHKEY 136
  78. #define CMD_GETSUPPORTEDFILEFORMATS 138
  79. #define CMD_GETSUPPORTEDMEMORYFORMATS 139
  80. #define CMD_SETFORMAT 140
  81. #define SUPPORT_COLOR 0x00000001
  82. #define SUPPORT_BW 0x00000002
  83. #define SUPPORT_GRAYSCALE 0x00000004
  84. //
  85. // Error Codes
  86. //
  87. #define MCRO_ERROR_GENERAL_ERROR 0 // All lVal values are initialized to '0'
  88. #define MCRO_STATUS_OK 1 // General success status return
  89. #define MCRO_ERROR_PAPER_JAM 2 // ADF has a paper Jam
  90. #define MCRO_ERROR_PAPER_PROBLEM 3 // ADF has a paper problem
  91. #define MCRO_ERROR_PAPER_EMPTY 4 // ADF has no paper
  92. #define MCRO_ERROR_OFFLINE 5 // ADF or Device is offline
  93. #define MCRO_ERROR_USER_INTERVENTION 6 // User needs to interact with the physical device
  94. //
  95. // WIA compatible #defines
  96. //
  97. #define WIA_PACKED_PIXEL 0
  98. #define WIA_PLANAR 1
  99. #define WIA_ORDER_RGB 0
  100. #define WIA_ORDER_BGR 1
  101. #define WIA_DATA_THRESHOLD 0
  102. #define WIA_DATA_DITHER 1
  103. #define WIA_DATA_GRAYSCALE 2
  104. #define WIA_DATA_COLOR 3
  105. #define WIA_DATA_COLOR_THRESHOLD 4
  106. #define WIA_DATA_COLOR_DITHER 5
  107. //
  108. // structure definitions
  109. //
  110. typedef struct _RANGEVALUE {
  111. LONG lMin; // minimum value
  112. LONG lMax; // maximum value
  113. LONG lStep; // increment/step value
  114. } RANGEVALUE, *PRANGEVALUE;
  115. typedef struct _SCANWINDOW {
  116. LONG xPos; // X position (left)
  117. LONG yPos; // Y position (top)
  118. LONG xExtent; // X extent (right)
  119. LONG yExtent; // Y extent (bottom)
  120. } SCANWINDOW, *PSCANWINDOW;
  121. typedef struct _SCANINFO {
  122. // Common Scanner specs
  123. LONG ADF; // (0 - no support, 1 - supported, 2 - supported and It can duplex)
  124. LONG TPA; // (0 - no support, 1 - supported)
  125. LONG Endorser; // (0 - no endorser, 1 - supported)
  126. LONG OpticalXResolution; // (dpi setting of optics)
  127. LONG OpticalYResolution; // (dpi setting of optics)
  128. LONG BedWidth; // (bed width in 1000's of an inch)
  129. LONG BedHeight; // (bed height in 1000's of an inch)
  130. RANGEVALUE IntensityRange; // (Intensity/Brightness ranges)
  131. RANGEVALUE ContrastRange; // (Contrast ranges)
  132. LONG SupportedCompressionType; // (mask of supported compression types, 0 - None)
  133. LONG SupportedDataTypes; // (mask of supported types, (ie. SUPPORT_COLOR|SUPPORT_BW...))
  134. // Current Image Info
  135. LONG WidthPixels; // (width of image, using current scanner settings in pixels)
  136. LONG WidthBytes; // (width of image, using current scanner settings in bytes)
  137. LONG Lines; // (height of image, using current scanner settings in pixles)
  138. LONG DataType; // (current data type set)
  139. LONG PixelBits; // (current bit depth setting)
  140. // Current Scanner settings
  141. LONG Intensity; // (current Intensity/Brightness setting)
  142. LONG Contrast; // (current contrast setting)
  143. LONG Xresolution; // (current X Resolution)
  144. LONG Yresolution; // (current Y Resolution
  145. SCANWINDOW Window; // (current scanner window settings)
  146. // Scanner options
  147. LONG DitherPattern;
  148. LONG Negative; // (0 - off, 1 - Negative is on)
  149. LONG Mirror; // (0 - off, 1 - Mirror is on)
  150. LONG AutoBack; // (0 - off, 1 - AutoBack is on)
  151. LONG ColorDitherPattern; // (dither pattern??)
  152. LONG ToneMap; // (tone map ??)
  153. LONG Compression; // (0 - off, 1 - Compression is on)
  154. LONG RawDataFormat; // (0 - Packed data 1 - Planar data)
  155. LONG RawPixelOrder; // (0 - RGB, 1 - BGR)
  156. LONG bNeedDataAlignment; // (0 - FALSE, 1 - TRUE)
  157. LONG DelayBetweenRead; // delay between WIA Scan() calls requesting data (milliseconds)
  158. LONG MaxBufferSize; // maximum buffer size in scanner
  159. HANDLE DeviceIOHandles[MAX_IO_HANDLES]; // Device IO handles needed for device communication
  160. LONG lReserved[MAX_RESERVED]; // (silly reserved bits)
  161. VOID *pMicroDriverContext; // private data for Micro driver's only.
  162. // The Micro Driver is responsible for allocating and freeing.
  163. // CMD_INITIALIZE - allocate, CMD_UNINITIALIZE - free
  164. }SCANINFO, *PSCANINFO;
  165. typedef struct VAL {
  166. LONG lVal; // long value
  167. double dblVal; // float/double value
  168. GUID *pGuid; // GUID pointer
  169. PSCANINFO pScanInfo; // pointer to the shared ScanInfo struct
  170. HGLOBAL handle; // handle value
  171. WCHAR **ppButtonNames; // pointer to button names array
  172. HANDLE *pHandle; // pointer to a Handle value
  173. LONG lReserved; // lone value
  174. CHAR szVal[MAX_ANSI_CHAR];// ANSI string
  175. }VAL, *PVAL;
  176. //
  177. // Micro driver entry points
  178. //
  179. WIAMICRO_API HRESULT MicroEntry(LONG lCommand, PVAL pValue);
  180. WIAMICRO_API HRESULT Scan(PSCANINFO pScanInfo, LONG lPhase, PBYTE pBuffer, LONG lLength, LONG *plReceived);
  181. WIAMICRO_API HRESULT SetPixelWindow(PSCANINFO pScanInfo, LONG x, LONG y, LONG xExtent, LONG yExtent);
  182. //
  183. // optional debug trace
  184. //
  185. VOID Trace(LPCTSTR Format, ...);
  186. #include <poppack.h>