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.

691 lines
24 KiB

  1. /*++
  2. Copyright (c) 1999- Microsoft Corporation
  3. Module Name:
  4. ISO15740.h
  5. Abstract:
  6. This module contains PIMA15740 defined data types and their predefined
  7. values(if there are any).
  8. Revision History:
  9. --*/
  10. #ifndef ISO15740__H_
  11. #define ISO15740__H_
  12. //
  13. // This is PTP_STRING maximum string length in characters.
  14. //
  15. const UINT32 PTP_MAXSTRINGSIZE = 255;
  16. //
  17. // Define QWORD type
  18. //
  19. typedef unsigned __int64 QWORD;
  20. //
  21. // Every structure must be packed on byte boundary
  22. //
  23. #pragma pack(push,Old,1)
  24. //
  25. // Define 128 bits integer and unsigned integer
  26. // This will be the base type of INT128 and UINT128
  27. //
  28. typedef struct tagInt128
  29. {
  30. unsigned __int64 LowPart;
  31. __int64 HighPart;
  32. }INT128, *PINT128;
  33. typedef struct tagUInt128
  34. {
  35. unsigned __int64 LowPart;
  36. unsigned __int64 HighPart;
  37. }UINT128, *PUINT128;
  38. //
  39. // Data code ranges and masks. Each data code has 16 bits:
  40. //
  41. // Bit 15(std/vendor)
  42. // 0 -- the code is defined by PTP standard
  43. // 1 -- the code is vendor specific
  44. //
  45. // Bit 14 - 12(data type)
  46. // 14 13 12
  47. // 0 0 0 -- undefined data type
  48. // 0 0 1 -- op code
  49. // 0 1 0 -- response code
  50. // 0 1 1 -- format code
  51. // 1 0 0 -- event code
  52. // 1 0 1 -- property code
  53. // 1 1 0 -- reserved
  54. // 1 1 1 -- reserved
  55. //
  56. // Bit 11 - bit 0 (data value)
  57. //
  58. const WORD PTP_DATACODE_VENDORMASK = 0x8000;
  59. const WORD PTP_DATACODE_TYPEMASK = 0x7000;
  60. const WORD PTP_DATACODE_VALUEMASK = 0x0FFF;
  61. const WORD PTP_DATACODE_TYPE_UNKNOWN = 0x0000;
  62. const WORD PTP_DATACODE_TYPE_OPERATION = 0x1000;
  63. const WORD PTP_DATACODE_TYPE_RESPONSE = 0x2000;
  64. const WORD PTP_DATACODE_TYPE_FORMAT = 0x3000;
  65. const WORD PTP_DATACODE_TYPE_EVENT = 0x4000;
  66. const WORD PTP_DATACODE_TYPE_PROPERTY = 0x5000;
  67. const WORD PTP_DATACODE_TYPE_RESERVED_1 = 0x6000;
  68. const WORD PTP_DATACODE_TYPE_RESERVED_2 = 0x7000;
  69. //
  70. // To verify an op code
  71. // (Code & PTP_DATACODE_TYPEMASK) == PTP_DATACODE_TYPE_OPERATION
  72. // To verify a response code
  73. // (Code & PTP_DATACODE_TYPEMASK) == PTP_DATACODE_TYPE_RESPONSE)
  74. //
  75. // Image format codes receive special treatment.
  76. //
  77. const WORD PTP_DATACODE_TYPEIMAGEMASK = 0x7800;
  78. const WORD PTP_DATACODE_TYPE_IMAGEFORMAT = 0x3800;
  79. const WORD PTP_DATACODE_VALUE_IMAGEVMASK = 0x07FF;
  80. // To verify an image code
  81. // (Code & PTP_DATACODE_TYPEIMAGEMASK) == PTP_DATACODE_TYPE_IMAGEFORMAT
  82. //
  83. //
  84. // PTP specially defined constants
  85. //
  86. const DWORD PTP_OBJECTHANDLE_ALL = 0x0;
  87. const DWORD PTP_OBJECTHANDLE_UNDEFINED = 0x0;
  88. const DWORD PTP_OBJECTHANDLE_ROOT = 0xFFFFFFFF;
  89. const DWORD PTP_STORAGEID_ALL = 0xFFFFFFFF;
  90. const DWORD PTP_STORAGEID_DEFAULT = 0;
  91. const DWORD PTP_STORAGEID_UNDEFINED = 0;
  92. const DWORD PTP_STORAGEID_PHYSICAL = 0xFFFF0000;
  93. const DWORD PTP_STORAGEID_LOGICAL = 0x0000FFFF;
  94. const DWORD PTP_SESSIONID_ALL = 0;
  95. const DWORD PTP_SESSIONID_NOSESSION = 0;
  96. const WORD PTP_FORMATCODE_IMAGE = 0xFFFF;
  97. const WORD PTP_FORMATCODE_ALL = 0x0000;
  98. const WORD PTP_FORMATCODE_DEFAULT = 0x0000;
  99. const DWORD PTP_TRANSACTIONID_ALL = 0xFFFFFFFF;
  100. const DWORD PTP_TRANSACTIONID_NOSESSION = 0;
  101. const DWORD PTP_TRANSACTIONID_MIN = 1;
  102. const DWORD PTP_TRANSACTIONID_MAX = 0xFFFFFFFE;
  103. //
  104. // Data type codes.
  105. //
  106. const WORD PTP_DATATYPE_UNDEFINED = 0x0000;
  107. const WORD PTP_DATATYPE_INT8 = 0x0001;
  108. const WORD PTP_DATATYPE_UINT8 = 0x0002;
  109. const WORD PTP_DATATYPE_INT16 = 0x0003;
  110. const WORD PTP_DATATYPE_UINT16 = 0x0004;
  111. const WORD PTP_DATATYPE_INT32 = 0x0005;
  112. const WORD PTP_DATATYPE_UINT32 = 0x0006;
  113. const WORD PTP_DATATYPE_INT64 = 0x0007;
  114. const WORD PTP_DATATYPE_UINT64 = 0x0008;
  115. const WORD PTP_DATATYPE_INT128 = 0x0009;
  116. const WORD PTP_DATATYPE_UINT128 = 0x000A;
  117. const WORD PTP_DATATYPE_STRING = 0xFFFF;
  118. //
  119. // standard operation codes
  120. //
  121. const WORD PTP_OPCODE_UNDEFINED = 0x1000;
  122. const WORD PTP_OPCODE_GETDEVICEINFO = 0x1001;
  123. const WORD PTP_OPCODE_OPENSESSION = 0x1002;
  124. const WORD PTP_OPCODE_CLOSESESSION = 0x1003;
  125. const WORD PTP_OPCODE_GETSTORAGEIDS = 0x1004;
  126. const WORD PTP_OPCODE_GETSTORAGEINFO = 0x1005;
  127. const WORD PTP_OPCODE_GETNUMOBJECTS = 0x1006;
  128. const WORD PTP_OPCODE_GETOBJECTHANDLES = 0x1007;
  129. const WORD PTP_OPCODE_GETOBJECTINFO = 0x1008;
  130. const WORD PTP_OPCODE_GETOBJECT = 0x1009;
  131. const WORD PTP_OPCODE_GETTHUMB = 0x100A;
  132. const WORD PTP_OPCODE_DELETEOBJECT = 0x100B;
  133. const WORD PTP_OPCODE_SENDOBJECTINFO = 0x100C;
  134. const WORD PTP_OPCODE_SENDOBJECT = 0x100D;
  135. const WORD PTP_OPCODE_INITIATECAPTURE = 0x100E;
  136. const WORD PTP_OPCODE_FORMATSTORE = 0x100F;
  137. const WORD PTP_OPCODE_RESETDEVICE = 0x1010;
  138. const WORD PTP_OPCODE_SELFTEST = 0x1011;
  139. const WORD PTP_OPCODE_SETOBJECTPROTECTION = 0x1012;
  140. const WORD PTP_OPCODE_POWERDOWN = 0x1013;
  141. const WORD PTP_OPCODE_GETDEVICEPROPDESC = 0x1014;
  142. const WORD PTP_OPCODE_GETDEVICEPROPVALUE = 0x1015;
  143. const WORD PTP_OPCODE_SETDEVICEPROPVALUE = 0x1016;
  144. const WORD PTP_OPCODE_RESETDEVICEPROPVALUE = 0x1017;
  145. const WORD PTP_OPCODE_TERMINATECAPTURE = 0x1018;
  146. const WORD PTP_OPCODE_MOVEOBJECT = 0x1019;
  147. const WORD PTP_OPCODE_COPYOBJECT = 0x101A;
  148. const WORD PTP_OPCODE_GETPARTIALOBJECT = 0x101B;
  149. const WORD PTP_OPCODE_INITIATEOPENCAPTURE = 0x101C;
  150. //
  151. // standard event codes
  152. //
  153. const WORD PTP_EVENTCODE_UNDEFINED = 0x4000;
  154. const WORD PTP_EVENTCODE_CANCELTRANSACTION = 0x4001;
  155. const WORD PTP_EVENTCODE_OBJECTADDED = 0x4002;
  156. const WORD PTP_EVENTCODE_OBJECTREMOVED = 0x4003;
  157. const WORD PTP_EVENTCODE_STOREADDED = 0x4004;
  158. const WORD PTP_EVENTCODE_STOREREMOVED = 0x4005;
  159. const WORD PTP_EVENTCODE_DEVICEPROPCHANGED = 0x4006;
  160. const WORD PTP_EVENTCODE_OBJECTINFOCHANGED = 0x4007;
  161. const WORD PTP_EVENTCODE_DEVICEINFOCHANGED = 0x4008;
  162. const WORD PTP_EVENTCODE_REQUESTOBJECTTRANSFER = 0x4009;
  163. const WORD PTP_EVENTCODE_STOREFULL = 0x400A;
  164. const WORD PTP_EVENTCODE_DEVICERESET = 0x400B;
  165. const WORD PTP_EVENTCODE_STORAGEINFOCHANGED = 0x400C;
  166. const WORD PTP_EVENTCODE_CAPTURECOMPLETE = 0x400D;
  167. const WORD PTP_EVENTCODE_UNREPORTEDSTATUS = 0x400E;
  168. const WORD PTP_EVENTCODE_VENDOREXTENTION = 0xC000;
  169. //
  170. // standard response codes
  171. //
  172. const WORD PTP_RESPONSECODE_UNDEFINED = 0x2000;
  173. const WORD PTP_RESPONSECODE_OK = 0x2001;
  174. const WORD PTP_RESPONSECODE_GENERALERROR = 0x2002;
  175. const WORD PTP_RESPONSECODE_SESSIONNOTOPEN = 0x2003;
  176. const WORD PTP_RESPONSECODE_INVALIDTRANSACTIONID = 0x2004;
  177. const WORD PTP_RESPONSECODE_OPERATIONNOTSUPPORTED = 0x2005;
  178. const WORD PTP_RESPONSECODE_PARAMETERNOTSUPPORTED = 0x2006;
  179. const WORD PTP_RESPONSECODE_INCOMPLETETRANSFER = 0x2007;
  180. const WORD PTP_RESPONSECODE_INVALIDSTORAGEID = 0x2008;
  181. const WORD PTP_RESPONSECODE_INVALIDOBJECTHANDLE = 0x2009;
  182. const WORD PTP_RESPONSECODE_INVALIDPROPERTYCODE = 0x200A;
  183. const WORD PTP_RESPONSECODE_INVALIDOBJECTFORMATCODE = 0x200B;
  184. const WORD PTP_RESPONSECODE_STOREFULL = 0x200C;
  185. const WORD PTP_RESPONSECODE_OBJECTWRITEPROTECTED = 0x200D;
  186. const WORD PTP_RESPONSECODE_STOREWRITEPROTECTED = 0x200E;
  187. const WORD PTP_RESPONSECODE_ACCESSDENIED = 0x200F;
  188. const WORD PTP_RESPONSECODE_NOTHUMBNAILPRESENT = 0x2010;
  189. const WORD PTP_RESPONSECODE_SELFTESTFAILED = 0x2011;
  190. const WORD PTP_RESPONSECODE_PARTIALDELETION = 0x2012;
  191. const WORD PTP_RESPONSECODE_STORENOTAVAILABLE = 0x2013;
  192. const WORD PTP_RESPONSECODE_NOSPECIFICATIONBYFORMAT = 0x2014;
  193. const WORD PTP_RESPONSECODE_NOVALIDOBJECTINFO = 0x2015;
  194. const WORD PTP_RESPONSECODE_INVALIDCODEFORMAT = 0x2016;
  195. const WORD PTP_RESPONSECODE_UNKNOWNVENDORCODE = 0x2017;
  196. const WORD PTP_RESPONSECODE_CAPTUREALREADYTERMINATED = 0x2018;
  197. const WORD PTP_RESPONSECODE_DEVICEBUSY = 0x2019;
  198. const WORD PTP_RESPONSECODE_INVALIDPARENT = 0x201A;
  199. const WORD PTP_RESPONSECODE_INVALIDPROPFORMAT = 0x201B;
  200. const WORD PTP_RESPONSECODE_INVALIDPROPVALUE = 0x201C;
  201. const WORD PTP_RESPONSECODE_INVALIDPARAMETER = 0x201D;
  202. const WORD PTP_RESPONSECODE_SESSIONALREADYOPENED = 0x201E;
  203. const WORD PTP_RESPONSECODE_TRANSACTIONCANCELLED = 0x201F;
  204. //
  205. // offset for returning PTP response codes in an HRESULT
  206. //
  207. const HRESULT PTP_E_BASEERROR = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0);
  208. #define HRESULT_FROM_PTP(x) (PTP_E_BASEERROR | (HRESULT) (x))
  209. //
  210. // standard property codes
  211. //
  212. const WORD PTP_PROPERTYCODE_UNDEFINED = 0x5000;
  213. const WORD PTP_PROPERTYCODE_BATTERYLEVEL = 0x5001;
  214. const WORD PTP_PROPERTYCODE_FUNCTIONMODE = 0x5002;
  215. const WORD PTP_PROPERTYCODE_IMAGESIZE = 0x5003;
  216. const WORD PTP_PROPERTYCODE_COMPRESSIONSETTING = 0x5004;
  217. const WORD PTP_PROPERTYCODE_WHITEBALANCE = 0x5005;
  218. const WORD PTP_PROPERTYCODE_RGBGAIN = 0x5006;
  219. const WORD PTP_PROPERTYCODE_FNUMBER = 0x5007;
  220. const WORD PTP_PROPERTYCODE_FOCALLENGTH = 0x5008;
  221. const WORD PTP_PROPERTYCODE_FOCUSDISTANCE = 0x5009;
  222. const WORD PTP_PROPERTYCODE_FOCUSMODE = 0x500A;
  223. const WORD PTP_PROPERTYCODE_EXPOSUREMETERINGMODE = 0x500B;
  224. const WORD PTP_PROPERTYCODE_FLASHMODE = 0x500C;
  225. const WORD PTP_PROPERTYCODE_EXPOSURETIME = 0x500D;
  226. const WORD PTP_PROPERTYCODE_EXPOSUREPROGRAMMODE = 0x500E;
  227. const WORD PTP_PROPERTYCODE_EXPOSUREINDEX = 0x500F;
  228. const WORD PTP_PROPERTYCODE_EXPOSURECOMPENSATION = 0x5010;
  229. const WORD PTP_PROPERTYCODE_DATETIME = 0x5011;
  230. const WORD PTP_PROPERTYCODE_CAPTUREDELAY = 0x5012;
  231. const WORD PTP_PROPERTYCODE_STILLCAPTUREMODE = 0x5013;
  232. const WORD PTP_PROPERTYCODE_CONTRAST = 0x5014;
  233. const WORD PTP_PROPERTYCODE_SHARPNESS = 0x5015;
  234. const WORD PTP_PROPERTYCODE_DIGITALZOOM = 0x5016;
  235. const WORD PTP_PROPERTYCODE_EFFECTMODE = 0x5017;
  236. const WORD PTP_PROPERTYCODE_BURSTNUMBER = 0x5018;
  237. const WORD PTP_PROPERTYCODE_BURSTINTERVAL = 0x5019;
  238. const WORD PTP_PROPERTYCODE_TIMELAPSENUMBER = 0x501A;
  239. const WORD PTP_PROPERTYCODE_TIMELAPSEINTERVAL = 0x501B;
  240. const WORD PTP_PROPERTYCODE_FOCUSMETERINGMODE = 0x501C;
  241. //
  242. // standard format codes
  243. //
  244. const WORD PTP_FORMATMASK_IMAGE = 0x0800;
  245. const WORD PTP_FORMATCODE_NOTUSED = 0x0000;
  246. const WORD PTP_FORMATCODE_ALLIMAGES = 0xFFFF;
  247. const WORD PTP_FORMATCODE_UNDEFINED = 0x3000;
  248. const WORD PTP_FORMATCODE_ASSOCIATION = 0x3001;
  249. const WORD PTP_FORMATCODE_SCRIPT = 0x3002;
  250. const WORD PTP_FORMATCODE_EXECUTABLE = 0x3003;
  251. const WORD PTP_FORMATCODE_TEXT = 0x3004;
  252. const WORD PTP_FORMATCODE_HTML = 0x3005;
  253. const WORD PTP_FORMATCODE_DPOF = 0x3006;
  254. const WORD PTP_FORMATCODE_AIFF = 0x3007;
  255. const WORD PTP_FORMATCODE_WAVE = 0x3008;
  256. const WORD PTP_FORMATCODE_MP3 = 0x3009;
  257. const WORD PTP_FORMATCODE_AVI = 0x300A;
  258. const WORD PTP_FORMATCODE_MPEG = 0x300B;
  259. const WORD PTP_FORMATCODE_IMAGE_UNDEFINED = 0x3800;
  260. const WORD PTP_FORMATCODE_IMAGE_EXIF = 0x3801;
  261. const WORD PTP_FORMATCODE_IMAGE_TIFFEP = 0x3802;
  262. const WORD PTP_FORMATCODE_IMAGE_FLASHPIX = 0x3803;
  263. const WORD PTP_FORMATCODE_IMAGE_BMP = 0x3804;
  264. const WORD PTP_FORMATCODE_IMAGE_CIFF = 0x3805;
  265. const WORD PTP_FORMATCODE_IMAGE_GIF = 0x3807;
  266. const WORD PTP_FORMATCODE_IMAGE_JFIF = 0x3808;
  267. const WORD PTP_FORMATCODE_IMAGE_PCD = 0x3809;
  268. const WORD PTP_FORMATCODE_IMAGE_PICT = 0x380A;
  269. const WORD PTP_FORMATCODE_IMAGE_PNG = 0x380B;
  270. const WORD PTP_FORMATCODE_IMAGE_TIFF = 0x380D;
  271. const WORD PTP_FORMATCODE_IMAGE_TIFFIT = 0x380E;
  272. const WORD PTP_FORMATCODE_IMAGE_JP2 = 0x380F;
  273. const WORD PTP_FORMATCODE_IMAGE_JPX = 0x3810;
  274. //
  275. // Property values definitions
  276. //
  277. //
  278. // Property description data set form flags definitions
  279. //
  280. const BYTE PTP_FORMFLAGS_NONE = 0;
  281. const BYTE PTP_FORMFLAGS_RANGE = 1;
  282. const BYTE PTP_FORMFLAGS_ENUM = 2;
  283. //
  284. // power states
  285. //
  286. const WORD PTP_POWERSTATE_DEVICEOFF = 0x0000;
  287. const WORD PTP_POWERSTATE_SLEEP = 0x0001;
  288. const WORD PTP_POWERSTATE_FULL = 0x0002;
  289. //
  290. // white balances
  291. //
  292. const WORD PTP_WHITEBALANCE_UNDEFINED = 0x0000;
  293. const WORD PTP_WHILEBALANCE_MANUAL = 0x0001;
  294. const WORD PTP_WHITEBALANCE_AUTOMATIC = 0x0002;
  295. const WORD PTP_WHITEBALANCE_ONEPUSHAUTO = 0x0003;
  296. const WORD PTP_WHITEBALANCE_DAYLIGHT = 0x0004;
  297. const WORD PTP_WHITEBALANCE_FLORESCENT = 0x0005;
  298. const WORD PTP_WHITEBALANCE_TUNGSTEN = 0x0006;
  299. const WORD PTP_WHITEBALANCE_FLASH = 0x0007;
  300. //
  301. // focus modes
  302. //
  303. const WORD PTP_FOCUSMODE_UNDEFINED = 0x0000;
  304. const WORD PTP_FOCUSMODE_MANUAL = 0x0001;
  305. const WORD PTP_FOCUSMODE_AUTO = 0x0002;
  306. const WORD PTP_FOCUSMODE_MACRO = 0x0003;
  307. //
  308. // focus metering
  309. //
  310. const WORD PTP_FOCUSMETERING_UNDEFINED = 0x0000;
  311. const WORD PTP_FOCUSMETERING_CENTERSPOT = 0x0001;
  312. const WORD PTP_FOCUSMETERING_MULTISPOT = 0x0002;
  313. //
  314. // flash modes
  315. //
  316. const WORD PTP_FLASHMODE_UNDEFINED = 0x0000;
  317. const WORD PTP_FLASHMODE_AUTO = 0x0001;
  318. const WORD PTP_FLASHMODE_OFF = 0x0002;
  319. const WORD PTP_FLASHMODE_FILL = 0x0003;
  320. const WORD PTP_FLASHMODE_REDEYEAUTO = 0x0004;
  321. const WORD PTP_FLASHMODE_REDEYEFILL = 0x0005;
  322. const WORD PTP_FLASHMODE_EXTERNALSYNC = 0x0006;
  323. //
  324. // exposure modes
  325. //
  326. const WORD PTP_EXPOSUREMODE_UNDEFINED = 0x0000;
  327. const WORD PTP_EXPOSUREMODE_MANUALSETTING = 0x0001;
  328. const WORD PTP_EXPOSUREMODE_AUTOPROGRAM = 0x0002;
  329. const WORD PTP_EXPOSUREMODE_APERTUREPRIORITY = 0x0003;
  330. const WORD PTP_EXPOSUREMODE_SHUTTERPRIORITY = 0x0004;
  331. const WORD PTP_EXPOSUREMODE_PROGRAMCREATIVE = 0x0005;
  332. const WORD PTP_EXPOSUREMODE_PROGRAMACTION = 0x0006;
  333. const WORD PTP_EXPOSUREMODE_PORTRAIT = 0x0007;
  334. //
  335. // capturing modes
  336. //
  337. const WORD PTP_CAPTUREMODE_UNDEFINED = 0x0000;
  338. const WORD PTP_CAPTUREMODE_NORMAL = 0x0001;
  339. const WORD PTP_CAPTUREMODE_BURST = 0x0002;
  340. const WORD PTP_CAPTUREMODE_TIMELAPSE = 0x0003;
  341. //
  342. // focus metering modes
  343. //
  344. const WORD PTP_FOCUSMETERMODE_UNDEFINED = 0x0000;
  345. const WORD PTP_FOCUSMETERMODE_CENTERSPOT = 0x0001;
  346. const WORD PTP_FOCUSMETERMODE_MULTISPOT = 0x0002;
  347. //
  348. // effect modes
  349. //
  350. const WORD PTP_EFFECTMODE_UNDEFINED = 0x0000;
  351. const WORD PTP_EFFECTMODE_COLOR = 0x0001;
  352. const WORD PTP_EFFECTMODE_BW = 0x0002;
  353. const WORD PTP_EFFECTMODE_SEPIA = 0x0003;
  354. //
  355. // storage types
  356. //
  357. const WORD PTP_STORAGETYPE_UNDEFINED = 0x0000;
  358. const WORD PTP_STORAGETYPE_FIXEDROM = 0x0001;
  359. const WORD PTP_STORAGETYPE_REMOVABLEROM = 0x0002;
  360. const WORD PTP_STORAGETYPE_FIXEDRAM = 0x0003;
  361. const WORD PTP_STORAGETYPE_REMOVABLERAM = 0x0004;
  362. //
  363. // storage access capabilities
  364. //
  365. const WORD PTP_STORAGEACCESS_RWD = 0x0000;
  366. const WORD PTP_STORAGEACCESS_R = 0x0001;
  367. const WORD PTP_STORAGEACCESS_RD = 0x0002;
  368. //
  369. // association types
  370. //
  371. const WORD PTP_ASSOCIATIONTYPE_UNDEFINED = 0x0000;
  372. const WORD PTP_ASSOCIATIONTYPE_FOLDER = 0x0001;
  373. const WORD PTP_ASSOCIATIONTYPE_ALBUM = 0x0002;
  374. const WORD PTP_ASSOCIATIONTYPE_BURST = 0x0003;
  375. const WORD PTP_ASSOCIATIONTYPE_HPANORAMA = 0x0004;
  376. const WORD PTP_ASSOCIATIONTYPE_VPANORAMA = 0x0005;
  377. const WORD PTP_ASSOCIATIONTYPE_2DPANORAMA = 0x0006;
  378. const WORD PTP_ASSOCIATIONTYPE_ANCILLARYDATA = 0x0007;
  379. //
  380. // protection status
  381. //
  382. const WORD PTP_PROTECTIONSTATUS_NONE = 0x0000;
  383. const WORD PTP_PROTECTIONSTATUS_READONLY = 0x0001;
  384. //
  385. // file system types
  386. //
  387. const WORD PTP_FILESYSTEMTYPE_UNDEFINED = 0x0000;
  388. const WORD PTP_FILESYSTEMTYPE_FLAT = 0x0001;
  389. const WORD PTP_FILESYSTEMTYPE_HIERARCHICAL = 0x0002;
  390. const WORD PTP_FILESYSTEMTYPE_DCF = 0x0003;
  391. //
  392. // functional modes
  393. //
  394. const WORD PTP_FUNCTIONMODE_STDANDARD = 0x0000;
  395. const WORD PTP_FUNCTIONMODE_SLEEP = 0x0001;
  396. //
  397. // Get/Set
  398. //
  399. const BYTE PTP_PROPGETSET_GETONLY = 0x00;
  400. const BYTE PTP_PROPGETSET_GETSET = 0x01;
  401. //
  402. // PTP command request
  403. //
  404. const DWORD COMMAND_NUMPARAMS_MAX = 5;
  405. typedef struct tagPTPCommand
  406. {
  407. WORD OpCode; // the opcode
  408. DWORD SessionId; // the session id
  409. DWORD TransactionId; // the transaction id
  410. DWORD Params[COMMAND_NUMPARAMS_MAX]; // parameters
  411. }PTP_COMMAND, *PPTP_COMMAND;
  412. //
  413. // PTP response block
  414. //
  415. const DWORD RESPONSE_NUMPARAMS_MAX = 5;
  416. typedef struct tagPTPResponse
  417. {
  418. WORD ResponseCode; // response code
  419. DWORD SessionId; // the session id
  420. DWORD TransactionId; // the transaction id
  421. DWORD Params[RESPONSE_NUMPARAMS_MAX]; // parameters
  422. }PTP_RESPONSE, *PPTP_RESPONSE;
  423. //
  424. // PTP event data
  425. //
  426. const DWORD EVENT_NUMPARAMS_MAX = 3;
  427. typedef struct tagPTPEvent
  428. {
  429. WORD EventCode; // the event code
  430. DWORD SessionId; // the session id
  431. DWORD TransactionId; // the transaction id
  432. DWORD Params[EVENT_NUMPARAMS_MAX]; // parameters
  433. }PTP_EVENT, *PPTP_EVENT;
  434. #pragma pack(pop, Old)
  435. //
  436. // Raw data parsing utility functions
  437. //
  438. WORD ParseWord(BYTE **ppRaw);
  439. DWORD ParseDword(BYTE **ppRaw);
  440. QWORD ParseQword(BYTE **ppRaw);
  441. //
  442. // Raw data writing utility functions
  443. //
  444. VOID WriteWord(BYTE **ppRaw, WORD value);
  445. VOID WriteDword(BYTE **ppRaw, DWORD value);
  446. //
  447. // Class that holds a BSTR
  448. //
  449. class CBstr
  450. {
  451. public:
  452. CBstr();
  453. CBstr(const CBstr& src);
  454. ~CBstr();
  455. HRESULT Copy(WCHAR *wcsString);
  456. HRESULT Init(BYTE **ppRaw, BOOL bParse = FALSE);
  457. VOID WriteToBuffer(BYTE **ppRaw);
  458. VOID Dump(char *szDesc);
  459. UINT Length() { return (m_bstrString == NULL ? 0 : SysStringLen(m_bstrString)); }
  460. BSTR String() { return m_bstrString; }
  461. BSTR m_bstrString;
  462. };
  463. //
  464. // Array definitions for 8, 16, and 32 bit integers
  465. //
  466. class CArray8 : public CWiaArray<BYTE>
  467. {
  468. public:
  469. VOID Dump(char *szDesc, char *szFiller);
  470. };
  471. class CArray16 : public CWiaArray<USHORT>
  472. {
  473. public:
  474. VOID Dump(char *szDesc, char *szFiller);
  475. };
  476. class CArray32 : public CWiaArray<ULONG>
  477. {
  478. public:
  479. BOOL ParseFrom8(BYTE **ppRaw, int NumSize = 4);
  480. BOOL ParseFrom16(BYTE **ppRaw, int NumSize = 4);
  481. BOOL Copy(CArray8 values8);
  482. BOOL Copy(CArray16 values16);
  483. VOID Dump(char *szDesc, char *szFiller);
  484. };
  485. //
  486. // Array of CBstr
  487. //
  488. class CArrayString : public CWiaArray<CBstr>
  489. {
  490. public:
  491. HRESULT Init(BYTE **ppRaw, int NumSize = 4);
  492. VOID Dump(char *szDesc, char *szFiller);
  493. };
  494. //
  495. // Class that holds a PTP DeviceInfo structure
  496. //
  497. class CPtpDeviceInfo
  498. {
  499. public:
  500. CPtpDeviceInfo();
  501. CPtpDeviceInfo(const CPtpDeviceInfo &src);
  502. ~CPtpDeviceInfo();
  503. HRESULT Init(BYTE *pRawData);
  504. VOID Dump();
  505. BOOL IsValid() { return m_SupportedOps.GetSize() > 0; }
  506. WORD m_Version; // version in hundredths
  507. DWORD m_VendorExtId; // PIMA assigned vendor id
  508. WORD m_VendorExtVersion; // vender extention version
  509. CBstr m_cbstrVendorExtDesc; // Optional vender description
  510. WORD m_FuncMode; // current functional mode
  511. CArray16 m_SupportedOps; // supported operations
  512. CArray16 m_SupportedEvents; // supported events
  513. CArray16 m_SupportedProps; // supported properties
  514. CArray16 m_SupportedCaptureFmts; // supported capture formats
  515. CArray16 m_SupportedImageFmts; // supported image formats
  516. CBstr m_cbstrManufacturer; // optional manufacturer description
  517. CBstr m_cbstrModel; // optional model description
  518. CBstr m_cbstrDeviceVersion; // optional firmware description
  519. CBstr m_cbstrSerialNumber; // optional serial number description
  520. };
  521. //
  522. // Class that holds a PTP StorageInfo structure
  523. //
  524. class CPtpStorageInfo
  525. {
  526. public:
  527. CPtpStorageInfo();
  528. ~CPtpStorageInfo();
  529. HRESULT Init(BYTE *pRawData, DWORD StorageId);
  530. VOID Dump();
  531. DWORD m_StorageId; // the "id" for this store
  532. WORD m_StorageType; // storage type
  533. WORD m_FileSystemType; // file system type
  534. WORD m_AccessCapability; // access capability (e.g. read/write)
  535. QWORD m_MaxCapacity; // maximum capacity in bytes
  536. QWORD m_FreeSpaceInBytes; // free space in bytes
  537. DWORD m_FreeSpaceInImages; // free space in images
  538. CBstr m_cbstrStorageDesc; // description
  539. CBstr m_cbstrStorageLabel; // volume label
  540. };
  541. //
  542. // Class that holds a PTP ObjectInfo structure
  543. //
  544. class CPtpObjectInfo
  545. {
  546. public:
  547. CPtpObjectInfo();
  548. ~CPtpObjectInfo();
  549. HRESULT Init(BYTE *pRawData, DWORD ObjectHandle);
  550. VOID WriteToBuffer(BYTE **ppRaw);
  551. VOID Dump();
  552. DWORD m_ObjectHandle; // the "handle" for this object
  553. DWORD m_StorageId; // The storage the object resides
  554. WORD m_FormatCode; // object format code
  555. WORD m_ProtectionStatus; // object protection status
  556. DWORD m_CompressedSize; // object compressed size
  557. WORD m_ThumbFormat; // thumbnail format(image object only)
  558. DWORD m_ThumbCompressedSize; // thumbnail compressedsize
  559. DWORD m_ThumbPixWidth; // thumbnail width in pixels
  560. DWORD m_ThumbPixHeight; // thumbmail height in pixels
  561. DWORD m_ImagePixWidth; // image width in pixels
  562. DWORD m_ImagePixHeight; // image height in pixels
  563. DWORD m_ImageBitDepth; // image color depth
  564. DWORD m_ParentHandle; // parent objec handle
  565. WORD m_AssociationType; // association type
  566. DWORD m_AssociationDesc; // association description
  567. DWORD m_SequenceNumber; // sequence number
  568. CBstr m_cbstrFileName; // optional file name
  569. CBstr m_cbstrExtension; // file name extension
  570. CBstr m_cbstrCaptureDate; // Captured date
  571. CBstr m_cbstrModificationDate; // when it was last modified.
  572. CBstr m_cbstrKeywords; // optional keywords
  573. };
  574. //
  575. // Generic class for holding property information
  576. //
  577. class CPtpPropDesc
  578. {
  579. public:
  580. CPtpPropDesc();
  581. ~CPtpPropDesc();
  582. HRESULT Init(BYTE *pRawData);
  583. HRESULT ParseValue(BYTE *pRaw);
  584. VOID WriteValue(BYTE **ppRaw);
  585. VOID Dump();
  586. VOID DumpValue();
  587. WORD m_PropCode; // Property code for this property
  588. WORD m_DataType; // Contains the type of the data (2=BYTE, 4=WORD, 6=DWORD, 0xFFFF=String)
  589. BYTE m_GetSet; // Indicates whether the property can be set or not (0=get-only, 1=get-set)
  590. BYTE m_FormFlag; // Indicates the form of the valid values (0=none, 1=range, 2=enum)
  591. int m_NumValues; // Number of values in the enumeration
  592. //
  593. // Integer values
  594. //
  595. DWORD m_lDefault; // Default value
  596. DWORD m_lCurrent; // Current value
  597. DWORD m_lRangeMin; // Minimum value
  598. DWORD m_lRangeMax; // Maximum value
  599. DWORD m_lRangeStep; // Step value
  600. CArray32 m_lValues; // Array of values
  601. //
  602. // String values
  603. //
  604. CBstr m_cbstrDefault; // Default value
  605. CBstr m_cbstrCurrent; // Current value
  606. CBstr m_cbstrRangeMin; // Minimum value
  607. CBstr m_cbstrRangeMax; // Maximum value
  608. CBstr m_cbstrRangeStep; // Step value
  609. CArrayString m_cbstrValues; // Array of values
  610. };
  611. #endif // #ifndef ISO15740__H_