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.

369 lines
14 KiB

  1. //------------------------------------------------------------------------------
  2. // Copyright (c) 1999 Microsoft Corporation.
  3. //
  4. // defprop.h
  5. //
  6. // Property Declarations and definitions for the IrTran-P WIA USD.
  7. //
  8. // Author:
  9. //
  10. // EdwardR 12-Aug-1999
  11. //
  12. //------------------------------------------------------------------------------
  13. #include "tcamprop.h"
  14. #define NUM_CAP_ENTRIES 4
  15. #define NUM_EVENTS 3
  16. #define PREFFERED_FORMAT_NOM &WiaImgFmt_JPEG
  17. #define FORMAT_NOM &WiaImgFmt_JPEG
  18. #define NUM_CAM_ITEM_PROPS (19)
  19. #define NUM_CAM_DEV_PROPS (17)
  20. #ifdef __GLOBALPROPVARS__
  21. PROPID gItemPropIDs[NUM_CAM_ITEM_PROPS] =
  22. {
  23. WIA_IPA_DATATYPE,
  24. WIA_IPA_DEPTH,
  25. WIA_IPA_PIXELS_PER_LINE,
  26. WIA_IPA_NUMBER_OF_LINES,
  27. WIA_IPC_THUMBNAIL,
  28. WIA_IPA_ITEM_TIME,
  29. WIA_IPC_THUMB_WIDTH,
  30. WIA_IPC_THUMB_HEIGHT,
  31. WIA_IPA_PREFERRED_FORMAT,
  32. WIA_IPA_ITEM_SIZE,
  33. WIA_IPA_FORMAT,
  34. WIA_IPA_TYMED,
  35. WIA_IPA_COMPRESSION,
  36. WIA_IPA_CHANNELS_PER_PIXEL,
  37. WIA_IPA_BITS_PER_CHANNEL,
  38. WIA_IPA_PLANAR,
  39. WIA_IPA_BYTES_PER_LINE,
  40. WIA_IPA_ACCESS_RIGHTS,
  41. WIA_IPA_MIN_BUFFER_SIZE
  42. };
  43. LPOLESTR gItemPropNames[NUM_CAM_ITEM_PROPS] =
  44. {
  45. WIA_IPA_DATATYPE_STR,
  46. WIA_IPA_DEPTH_STR,
  47. WIA_IPA_PIXELS_PER_LINE_STR,
  48. WIA_IPA_NUMBER_OF_LINES_STR,
  49. WIA_IPC_THUMBNAIL_STR,
  50. WIA_IPA_ITEM_TIME_STR,
  51. WIA_IPC_THUMB_WIDTH_STR,
  52. WIA_IPC_THUMB_HEIGHT_STR,
  53. WIA_IPA_PREFERRED_FORMAT_STR,
  54. WIA_IPA_ITEM_SIZE_STR,
  55. WIA_IPA_FORMAT_STR,
  56. WIA_IPA_TYMED_STR,
  57. WIA_IPA_COMPRESSION_STR,
  58. WIA_IPA_CHANNELS_PER_PIXEL_STR,
  59. WIA_IPA_BITS_PER_CHANNEL_STR,
  60. WIA_IPA_PLANAR_STR,
  61. WIA_IPA_BYTES_PER_LINE_STR,
  62. WIA_IPA_ACCESS_RIGHTS_STR,
  63. WIA_IPA_MIN_BUFFER_SIZE_STR
  64. };
  65. PROPID gItemCameraPropIDs[WIA_NUM_IPC] =
  66. {
  67. WIA_IPC_AUDIO_AVAILABLE,
  68. WIA_IPC_AUDIO_DATA
  69. };
  70. LPOLESTR gItemCameraPropNames[WIA_NUM_IPC] =
  71. {
  72. WIA_IPC_AUDIO_AVAILABLE_STR,
  73. WIA_IPC_AUDIO_DATA_STR,
  74. };
  75. PROPID gDevicePropIDs[NUM_CAM_DEV_PROPS] =
  76. {
  77. WIA_DPA_FIRMWARE_VERSION,
  78. WIA_DPA_CONNECT_STATUS,
  79. WIA_DPA_DEVICE_TIME,
  80. WIA_DPC_PICTURES_TAKEN,
  81. WIA_DPC_PICTURES_REMAINING,
  82. WIA_DPC_THUMB_WIDTH,
  83. WIA_DPC_THUMB_HEIGHT,
  84. WIA_DPC_PICT_WIDTH,
  85. WIA_DPC_PICT_HEIGHT,
  86. WIA_DPC_EXPOSURE_MODE,
  87. WIA_DPC_FLASH_MODE,
  88. WIA_DPC_FOCUS_MODE,
  89. WIA_DPC_ZOOM_POSITION,
  90. WIA_DPC_BATTERY_STATUS,
  91. WIA_DPC_TIMER_MODE,
  92. WIA_DPC_TIMER_VALUE,
  93. WIA_DPP_TCAM_ROOT_PATH
  94. };
  95. LPOLESTR gDevicePropNames[NUM_CAM_DEV_PROPS] =
  96. {
  97. WIA_DPA_FIRMWARE_VERSION_STR,
  98. WIA_DPA_CONNECT_STATUS_STR,
  99. WIA_DPA_DEVICE_TIME_STR,
  100. WIA_DPC_PICTURES_TAKEN_STR,
  101. WIA_DPC_PICTURES_REMAINING_STR,
  102. WIA_DPC_THUMB_WIDTH_STR,
  103. WIA_DPC_THUMB_HEIGHT_STR,
  104. WIA_DPC_PICT_WIDTH_STR,
  105. WIA_DPC_PICT_HEIGHT_STR,
  106. WIA_DPC_EXPOSURE_MODE_STR,
  107. WIA_DPC_FLASH_MODE_STR,
  108. WIA_DPC_FOCUS_MODE_STR,
  109. WIA_DPC_ZOOM_POSITION_STR,
  110. WIA_DPC_BATTERY_STATUS_STR,
  111. WIA_DPC_TIMER_MODE_STR,
  112. WIA_DPC_TIMER_VALUE_STR,
  113. WIA_DPP_TCAM_ROOT_PATH_STR
  114. };
  115. PROPSPEC gDevicePropSpecDefaults[NUM_CAM_DEV_PROPS] =
  116. {
  117. {PRSPEC_PROPID, WIA_DPA_FIRMWARE_VERSION},
  118. {PRSPEC_PROPID, WIA_DPA_CONNECT_STATUS},
  119. {PRSPEC_PROPID, WIA_DPA_DEVICE_TIME},
  120. {PRSPEC_PROPID, WIA_DPC_PICTURES_TAKEN},
  121. {PRSPEC_PROPID, WIA_DPC_PICTURES_REMAINING},
  122. {PRSPEC_PROPID, WIA_DPC_THUMB_WIDTH},
  123. {PRSPEC_PROPID, WIA_DPC_THUMB_HEIGHT},
  124. {PRSPEC_PROPID, WIA_DPC_PICT_WIDTH},
  125. {PRSPEC_PROPID, WIA_DPC_PICT_HEIGHT},
  126. {PRSPEC_PROPID, WIA_DPC_EXPOSURE_MODE},
  127. {PRSPEC_PROPID, WIA_DPC_FLASH_MODE},
  128. {PRSPEC_PROPID, WIA_DPC_FOCUS_MODE},
  129. {PRSPEC_PROPID, WIA_DPC_ZOOM_POSITION},
  130. {PRSPEC_PROPID, WIA_DPC_BATTERY_STATUS},
  131. {PRSPEC_PROPID, WIA_DPC_TIMER_MODE},
  132. {PRSPEC_PROPID, WIA_DPC_TIMER_VALUE},
  133. {PRSPEC_PROPID, WIA_DPP_TCAM_ROOT_PATH}
  134. };
  135. WIA_PROPERTY_INFO gDevPropInfoDefaults[NUM_CAM_DEV_PROPS] =
  136. {
  137. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPA_FIRMWARE_VERSION
  138. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPA_CONNECT_STATUS
  139. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPA_DEVICE_TIME
  140. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_PICTURES_TAKEN
  141. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_PICTURES_REMAINING
  142. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_THUMB_WIDTH
  143. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_THUMB_HEIGHT
  144. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_PICT_WIDTH
  145. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_PICT_HEIGHT
  146. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_EXPOSURE_MODE
  147. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_FLASH_MODE
  148. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_FOCUS_MODE
  149. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_ZOOM_POSITION
  150. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_BATTERY_STATUS
  151. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_TIMER_MODE
  152. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_TIMER_VALUE
  153. {WIA_PROP_RW | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0} // WIA_DPP_ROOT_PATH
  154. };
  155. PROPSPEC gPropSpecDefaults[NUM_CAM_ITEM_PROPS] =
  156. {
  157. {PRSPEC_PROPID, WIA_IPA_DATATYPE},
  158. {PRSPEC_PROPID, WIA_IPA_DEPTH},
  159. {PRSPEC_PROPID, WIA_IPA_PIXELS_PER_LINE},
  160. {PRSPEC_PROPID, WIA_IPA_NUMBER_OF_LINES},
  161. {PRSPEC_PROPID, WIA_IPC_THUMBNAIL},
  162. {PRSPEC_PROPID, WIA_IPA_ITEM_TIME},
  163. {PRSPEC_PROPID, WIA_IPC_THUMB_WIDTH},
  164. {PRSPEC_PROPID, WIA_IPC_THUMB_HEIGHT},
  165. {PRSPEC_PROPID, WIA_IPA_PREFERRED_FORMAT},
  166. {PRSPEC_PROPID, WIA_IPA_ITEM_SIZE},
  167. {PRSPEC_PROPID, WIA_IPA_FORMAT},
  168. {PRSPEC_PROPID, WIA_IPA_TYMED},
  169. {PRSPEC_PROPID, WIA_IPA_COMPRESSION},
  170. {PRSPEC_PROPID, WIA_IPA_CHANNELS_PER_PIXEL},
  171. {PRSPEC_PROPID, WIA_IPA_BITS_PER_CHANNEL},
  172. {PRSPEC_PROPID, WIA_IPA_PLANAR},
  173. {PRSPEC_PROPID, WIA_IPA_BYTES_PER_LINE},
  174. {PRSPEC_PROPID, WIA_IPA_ACCESS_RIGHTS},
  175. {PRSPEC_PROPID, WIA_IPA_MIN_BUFFER_SIZE},
  176. };
  177. LONG gPropVarDefaults[(sizeof(PROPVARIANT) / sizeof(LONG)) * (NUM_CAM_ITEM_PROPS)] =
  178. {
  179. // VARTYPE reserved val pad/array ptr
  180. (LONG)VT_I4, 0x00000000, WIA_DATA_GRAYSCALE,0x00000000, // WIA_IPA_DATATYPE
  181. (LONG)VT_I4, 0x00000000, 8, 0x00000000, // WIA_IPA_DEPTH
  182. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_PIXELS_PER_LINE
  183. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_NUMBER_OF_LINES
  184. (LONG)VT_VECTOR | VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPC_THUMBNAIL
  185. (LONG)VT_VECTOR | VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_ITEM_TIME
  186. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPC_THUMB_WIDTH
  187. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPC_THUMB_HEIGHT
  188. (LONG)VT_CLSID, 0x00000000, (LONG)PREFFERED_FORMAT_NOM,0x00000000, // WIA_IPA_PREFERRED_FORMAT
  189. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_ITEM_SIZE
  190. (LONG)VT_CLSID, 0x00000000, (LONG)FORMAT_NOM, 0x00000000, // WIA_IPA_FORMAT
  191. (LONG)VT_I4, 0x00000000, TYMED_CALLBACK, 0x00000000, // WIA_IPA_TYMED
  192. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_COMPRESSION
  193. (LONG)VT_I4, 0x00000000, 3, 0x00000000, // WIA_IPA_CHANNELS PER PIXEL
  194. (LONG)VT_I4, 0x00000000, 8, 0x00000000, // WIA_IPA_BITS PER CHANNEL
  195. (LONG)VT_I4, 0x00000000, WIA_PACKED_PIXEL, 0x00000000, // WIA_IPA_PLANAR
  196. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_WIDTH IN BYTES
  197. (LONG)VT_I4, 0x00000000, WIA_ITEM_RD, 0x00000000, // WIA_IPA_ACCESS_RIGHTS
  198. (LONG)VT_I4, 0x00000000, 65535, 0x00000000, // WIA_IPA_MIN_BUFFER_SIZE
  199. };
  200. //
  201. // Default device extended properties.
  202. //
  203. #define NUM_DATATYPE 3
  204. LONG lDataTypes[NUM_DATATYPE] =
  205. {
  206. WIA_DATA_THRESHOLD,
  207. WIA_DATA_GRAYSCALE,
  208. WIA_DATA_COLOR
  209. };
  210. #define NUM_DEPTH 3
  211. LONG lDepths[NUM_DEPTH] =
  212. {
  213. 1,
  214. 8,
  215. 24
  216. };
  217. //
  218. // Different formats supported
  219. //
  220. #define NUM_FORMAT 2
  221. GUID *pguidFormats[NUM_FORMAT] =
  222. {
  223. (GUID*) &WiaImgFmt_JPEG,
  224. (GUID*) &WiaImgFmt_JPEG
  225. };
  226. GUID g_guidFormats[NUM_FORMAT]; // FormatID's specified in pguidFormats are copied to g_guidFormats
  227. // during SetFormatAttribs
  228. //
  229. // This is an array of WIA_FORMAT_INFOs, describing the different formats
  230. // and their corresponding media types. Initialized in wiadev.cpp
  231. //
  232. WIA_FORMAT_INFO* g_wfiTable = NULL;
  233. //
  234. // Different media types supported
  235. //
  236. #define NUM_TYMED 2
  237. LONG lTymeds [NUM_TYMED]=
  238. {
  239. TYMED_CALLBACK,
  240. TYMED_FILE
  241. };
  242. //
  243. // Extended information for each property
  244. //
  245. WIA_PROPERTY_INFO gWiaPropInfoDefaults[NUM_CAM_ITEM_PROPS] =
  246. {
  247. {WIA_PROP_READ | WIA_PROP_LIST, VT_I4, NUM_DATATYPE, WIA_DATA_GRAYSCALE, (LONG) lDataTypes, 0}, // WIA_IPA_DATATYPE
  248. {WIA_PROP_READ | WIA_PROP_LIST, VT_I4, NUM_DEPTH, 8, (LONG) lDepths, 0}, // WIA_IPA_DEPTH
  249. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_PIXELS_PER_LINE
  250. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_NUMBER_OF_LINES
  251. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPC_THUMBNAIL
  252. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_ITEM_TIME
  253. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPC_THUMB_WIDTH
  254. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPC_THUMB_HEIGHT
  255. {WIA_PROP_READ | WIA_PROP_NONE, VT_CLSID, 0, 0, 0, 0}, // WIA_IPA_PREFERRED_FORMAT, set later
  256. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_ITEM_SIZE
  257. {WIA_PROP_RW | WIA_PROP_LIST, VT_CLSID, 0, 0, 0, 0}, // WIA_IPA_FORMAT, set later
  258. {WIA_PROP_RW | WIA_PROP_LIST, VT_I4, NUM_TYMED, TYMED_CALLBACK, (LONG)lTymeds, 0}, // WIA_IPA_TYMED
  259. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_COMPRESSION
  260. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_CHANNELS
  261. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_BITS_PER_CHANNEL
  262. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_PLANAR
  263. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_BYTES_PER_LINE
  264. {WIA_PROP_RW | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_ACCESS_RIGHTS
  265. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_MIN_BUFFER_SIZE
  266. };
  267. //
  268. // Device capabilities. Events are listed before commands to simplify the
  269. // implementation of drvGetCapabilities(...)
  270. //
  271. #define N WIA_NOTIFICATION_EVENT
  272. #define A WIA_ACTION_EVENT
  273. #define NA (WIA_NOTIFICATION_EVENT | WIA_ACTION_EVENT)
  274. WIA_DEV_CAP_DRV gCapabilities[NUM_CAP_ENTRIES] =
  275. {
  276. //
  277. // GUID ulFlags wszName wszDescription wszIcon
  278. //
  279. {(GUID *)&WIA_EVENT_DEVICE_CONNECTED, NA, NULL, NULL, WIA_ICON_DEVICE_CONNECTED},
  280. {(GUID *)&WIA_EVENT_DEVICE_DISCONNECTED, N, NULL, NULL, WIA_ICON_DEVICE_DISCONNECTED},
  281. {(GUID *)&WIA_EVENT_ITEM_CREATED, NA, NULL, NULL, WIA_ICON_ITEM_CREATED},
  282. {(GUID *)&WIA_CMD_SYNCHRONIZE, 0, NULL, NULL, WIA_ICON_SYNCHRONIZE}
  283. };
  284. //
  285. // The device name and description strings are kept in the resource file. This
  286. // table maps the IDS_ values (in the resource file for each of the
  287. // gCapabilities[] array entries. gDefaultStrings[] are backup names in case
  288. // we can't load the strings from the resource file (should never actually
  289. // happen).
  290. //
  291. UINT gCapabilityIDS[NUM_CAP_ENTRIES] =
  292. {
  293. IDS_DEVICE_CONNECTED,
  294. IDS_DEVICE_DISCONNECTED,
  295. IDS_NEW_PICTURE_SENT,
  296. IDS_SYNCHRONIZE
  297. };
  298. WCHAR *gDefaultStrings[NUM_CAP_ENTRIES] =
  299. {
  300. L"Device connected",
  301. L"Device disconnected",
  302. L"New picture sent",
  303. L"Synchronize"
  304. };
  305. #else
  306. extern PROPID gItemPropIDs[NUM_CAM_ITEM_PROPS];
  307. extern LPOLESTR gItemPropNames[NUM_CAM_ITEM_PROPS];
  308. extern PROPID gItemCameraPropIDs[WIA_NUM_IPC];
  309. extern LPOLESTR gItemCameraPropNames[WIA_NUM_IPC];
  310. extern PROPID gDevicePropIDs[NUM_CAM_DEV_PROPS];
  311. extern LPOLESTR gDevicePropNames[NUM_CAM_DEV_PROPS];
  312. extern PROPSPEC gDevicePropSpecDefaults[NUM_CAM_DEV_PROPS];
  313. extern WIA_PROPERTY_INFO gDevPropInfoDefaults[NUM_CAM_DEV_PROPS];
  314. extern PROPSPEC gPropSpecDefaults[NUM_CAM_ITEM_PROPS];
  315. extern LONG gPropVarDefaults[];
  316. extern WIA_PROPERTY_INFO gWiaPropInfoDefaults[NUM_CAM_ITEM_PROPS];
  317. extern WIA_DEV_CAP_DRV gCapabilities[NUM_CAP_ENTRIES];
  318. extern UINT gCapabilityIDS[NUM_CAP_ENTRIES];
  319. extern WCHAR *gDefaultStrings[NUM_CAP_ENTRIES];
  320. #endif