Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | #ifndef __DEVINFOPARSER_H__ |
2 | #define __DEVINFOPARSER_H__ |
||
3 | |||
4 | #include <inttypes.h> |
||
5 | #include <avr/pgmspace.h> |
||
6 | #include <../ptp/ptpconst.h> |
||
7 | #include <../ptp/mtpconst.h> |
||
8 | #include <../ptp/ptp.h> |
||
9 | |||
10 | const char msgVendorDefined [] PROGMEM = "Vendor defined"; |
||
11 | const char msgTab [] PROGMEM = "\t"; |
||
12 | const char msgCRLF [] PROGMEM = "\r\n"; |
||
13 | |||
14 | // PTP Operations |
||
15 | const char msgUndefined [] PROGMEM = "Undefined"; |
||
16 | const char msgGetDeviceInfo [] PROGMEM = "GetDeviceInfo"; |
||
17 | const char msgOpenSession [] PROGMEM = "OpenSession"; |
||
18 | const char msgCloseSession [] PROGMEM = "CloseSession"; |
||
19 | const char msgGetStorageIDs [] PROGMEM = "GetStorageIDs"; |
||
20 | const char msgGetStorageInfo [] PROGMEM = "GetStorageInfo"; |
||
21 | const char msgGetNumObjects [] PROGMEM = "GetNumObjects"; |
||
22 | const char msgGetObjectHandles [] PROGMEM = "GetObjectHandles"; |
||
23 | const char msgGetObjectInfo [] PROGMEM = "GetObjectInfo"; |
||
24 | const char msgGetObject [] PROGMEM = "GetObject"; |
||
25 | const char msgGetThumb [] PROGMEM = "GetThumb"; |
||
26 | const char msgDeleteObject [] PROGMEM = "DeleteObject"; |
||
27 | const char msgSendObjectInfo [] PROGMEM = "SendObjectInfo"; |
||
28 | const char msgSendObject [] PROGMEM = "SendObject"; |
||
29 | const char msgInitiateCapture [] PROGMEM = "InitiateCapture"; |
||
30 | const char msgFormatStore [] PROGMEM = "FormatStore"; |
||
31 | const char msgResetDevice [] PROGMEM = "ResetDevice"; |
||
32 | const char msgSelfTest [] PROGMEM = "SelfTest"; |
||
33 | const char msgSetObjectProtection [] PROGMEM = "SetObjectProtection"; |
||
34 | const char msgPowerDown [] PROGMEM = "PowerDown"; |
||
35 | const char msgGetDevicePropDesc [] PROGMEM = "GetDevicePropDesc"; |
||
36 | const char msgGetDevicePropValue [] PROGMEM = "GetDevicePropValue"; |
||
37 | const char msgSetDevicePropValue [] PROGMEM = "SetDevicePropValue"; |
||
38 | const char msgResetDevicePropValue [] PROGMEM = "ResetDevicePropValue"; |
||
39 | const char msgTerminateOpenCapture [] PROGMEM = "TerminateOpenCapture"; |
||
40 | const char msgMoveObject [] PROGMEM = "MoveObject"; |
||
41 | const char msgCopyObject [] PROGMEM = "CopyObject"; |
||
42 | const char msgGetPartialObject [] PROGMEM = "GetPartialObject"; |
||
43 | const char msgInitiateOpenCapture [] PROGMEM = "InitiateOpenCapture"; |
||
44 | |||
45 | // MTP Operations |
||
46 | const char msgGetObjectPropsSupported [] PROGMEM = "GetObjectPropsSupported"; |
||
47 | const char msgGetObjectPropDesc [] PROGMEM = "GetObjectPropDesc"; |
||
48 | const char msgGetObjectPropValue [] PROGMEM = "GetObjectPropValue"; |
||
49 | const char msgSetObjectPropValue [] PROGMEM = "SetObjectPropValue"; |
||
50 | const char msgGetObjectPropList [] PROGMEM = "GetObjectPropList"; |
||
51 | const char msgSetObjectPropList [] PROGMEM = "SetObjectPropList"; |
||
52 | const char msgGetInterdependentPropDesc [] PROGMEM = "GetInterdependentPropDesc"; |
||
53 | const char msgSendObjectPropList [] PROGMEM = "SendObjectPropList"; |
||
54 | const char msgGetObjectReferences [] PROGMEM = "GetObjectReferences"; |
||
55 | const char msgSetObjectReferences [] PROGMEM = "SetObjectReferences"; |
||
56 | const char msgSkip [] PROGMEM = "Skip"; |
||
57 | |||
58 | // Canon EOS Operations |
||
59 | const char msgEOS_GetStorageIDs [] PROGMEM = "EOS_GetStorageIDs"; |
||
60 | const char msgEOS_GetStorageInfo [] PROGMEM = "EOS_GetStorageInfo"; |
||
61 | const char msgEOS_GetObject [] PROGMEM = "EOS_GetObject"; |
||
62 | const char msgEOS_GetDeviceInfo [] PROGMEM = "EOS_GetDeviceInfo"; |
||
63 | const char msgEOS_GetObjectIDs [] PROGMEM = "EOS_GetObjectIDs"; |
||
64 | const char msgEOS_Capture [] PROGMEM = "EOS_Capture"; |
||
65 | const char msgEOS_SetDevicePropValue [] PROGMEM = "EOS_SetDevicePropValue"; |
||
66 | const char msgEOS_SetPCConnectMode [] PROGMEM = "EOS_SetPCConnectMode"; |
||
67 | const char msgEOS_SetExtendedEventInfo [] PROGMEM = "EOS_SetExtendedEventInfo"; |
||
68 | const char msgEOS_GetEvent [] PROGMEM = "EOS_GetEvent"; |
||
69 | const char msgEOS_GetLiveViewPicture [] PROGMEM = "EOS_GetLiveViewPicture"; |
||
70 | const char msgEOS_MoveFocus [] PROGMEM = "EOS_MoveFocus"; |
||
71 | |||
72 | // Canon PowerShot Operations |
||
73 | const char msgPS_GetObjectSize [] PROGMEM = "PS_GetObjectSize"; |
||
74 | const char msgPS_StartShootingMode [] PROGMEM = "PS_StartShootingMode"; |
||
75 | const char msgPS_EndShootingMode [] PROGMEM = "PS_EndShootingMode"; |
||
76 | const char msgPS_ViewfinderOn [] PROGMEM = "PS_ViewfinderOn"; |
||
77 | const char msgPS_ViewfinderOff [] PROGMEM = "PS_ViewfinderOff"; |
||
78 | const char msgPS_ReflectChanges [] PROGMEM = "PS_ReflectChanges"; |
||
79 | const char msgPS_CheckEvent [] PROGMEM = "PS_CheckEvent"; |
||
80 | const char msgPS_FocusLock [] PROGMEM = "PS_FocusLock"; |
||
81 | const char msgPS_FocusUnlock [] PROGMEM = "PS_FocusUnlock"; |
||
82 | const char msgPS_InitiateCaptureInMemory [] PROGMEM = "PS_InitiateCaptureInMemory"; |
||
83 | const char msgPS_GetPartialObject [] PROGMEM = "PS_GetPartialObject"; |
||
84 | const char msgPS_GetViewfinderImage [] PROGMEM = "PS_GetViewfinderImage"; |
||
85 | const char msgPS_GetChanges [] PROGMEM = "PS_GetChanges"; |
||
86 | const char msgPS_GetFolderEntries [] PROGMEM = "PS_GetFolderEntries"; |
||
87 | |||
88 | |||
89 | // PTP Events |
||
90 | const char msgCancelTransaction [] PROGMEM = "CancelTransaction"; |
||
91 | const char msgObjectAdded [] PROGMEM = "ObjectAdded"; |
||
92 | const char msgObjectRemoved [] PROGMEM = "ObjectRemoved"; |
||
93 | const char msgStoreAdded [] PROGMEM = "StoreAdded"; |
||
94 | const char msgStoreRemoved [] PROGMEM = "StoreRemoved"; |
||
95 | const char msgDevicePropChanged [] PROGMEM = "DevicePropChanged"; |
||
96 | const char msgObjectInfoChanged [] PROGMEM = "ObjectInfoChanged"; |
||
97 | const char msgDeviceInfoChanged [] PROGMEM = "DeviceInfoChanged"; |
||
98 | const char msgRequestObjectTransfer [] PROGMEM = "RequestObjectTransfer"; |
||
99 | const char msgStoreFull [] PROGMEM = "StoreFull"; |
||
100 | const char msgDeviceReset [] PROGMEM = "DeviceReset"; |
||
101 | const char msgStorageInfoChanged [] PROGMEM = "StorageInfoChanged"; |
||
102 | const char msgCaptureComplete [] PROGMEM = "CaptureComplete"; |
||
103 | const char msgUnreportedStatus [] PROGMEM = "UnreportedStatus"; |
||
104 | |||
105 | // MTP Events |
||
106 | const char msgObjectPropChanged [] PROGMEM = "ObjectPropChanged"; |
||
107 | const char msgObjectPropDescChanged [] PROGMEM = "ObjectPropDescChanged"; |
||
108 | const char msgObjectReferencesChanged [] PROGMEM = "ObjectReferencesChanged"; |
||
109 | |||
110 | // PTP Device properties |
||
111 | const char msgBatteryLevel [] PROGMEM = "BatteryLevel"; |
||
112 | const char msgFunctionalMode [] PROGMEM = "FunctionalMode"; |
||
113 | const char msgImageSize [] PROGMEM = "ImageSize"; |
||
114 | const char msgCompressionSetting [] PROGMEM = "CompressionSetting"; |
||
115 | const char msgWhiteBalance [] PROGMEM = "WhiteBalance"; |
||
116 | const char msgRGBGain [] PROGMEM = "RGBGain"; |
||
117 | const char msgFNumber [] PROGMEM = "FNumber"; |
||
118 | const char msgFocalLength [] PROGMEM = "FocalLength"; |
||
119 | const char msgFocusDistance [] PROGMEM = "FocusDistance"; |
||
120 | const char msgFocusMode [] PROGMEM = "FocusMode"; |
||
121 | const char msgExposureMeteringMode [] PROGMEM = "ExposureMeteringMode"; |
||
122 | const char msgFlashMode [] PROGMEM = "FlashMode"; |
||
123 | const char msgExposureTime [] PROGMEM = "ExposureTime"; |
||
124 | const char msgExposureProgramMode [] PROGMEM = "ExposureProgramMode"; |
||
125 | const char msgExposureIndex [] PROGMEM = "ExposureIndex"; |
||
126 | const char msgExposureBiasCompensation [] PROGMEM = "ExposureBiasCompensation"; |
||
127 | const char msgDateTime [] PROGMEM = "DateTime"; |
||
128 | const char msgCaptureDelay [] PROGMEM = "CaptureDelay"; |
||
129 | const char msgStillCaptureMode [] PROGMEM = "StillCaptureMode"; |
||
130 | const char msgContrast [] PROGMEM = "Contrast"; |
||
131 | const char msgSharpness [] PROGMEM = "Sharpness"; |
||
132 | const char msgDigitalZoom [] PROGMEM = "DigitalZoom"; |
||
133 | const char msgEffectMode [] PROGMEM = "EffectMode"; |
||
134 | const char msgBurstNumber [] PROGMEM = "BurstNumber"; |
||
135 | const char msgBurstInterval [] PROGMEM = "BurstInterval"; |
||
136 | const char msgTimelapseNumber [] PROGMEM = "TimelapseNumber"; |
||
137 | const char msgTimelapseInterval [] PROGMEM = "TimelapseInterval"; |
||
138 | const char msgFocusMeteringMode [] PROGMEM = "FocusMeteringMode"; |
||
139 | const char msgUploadURL [] PROGMEM = "UploadURL"; |
||
140 | const char msgArtist [] PROGMEM = "Artist"; |
||
141 | const char msgCopyrightInfo [] PROGMEM = "CopyrightInfo"; |
||
142 | |||
143 | // MTP Device properties |
||
144 | const char msgSynchronization_Partner [] PROGMEM = "Synchronization_Partner"; |
||
145 | const char msgDevice_Friendly_Name [] PROGMEM = "Device_Friendly_Name"; |
||
146 | const char msgVolume [] PROGMEM = "Volume"; |
||
147 | const char msgSupportedFormatsOrdered [] PROGMEM = "SupportedFormatsOrdered"; |
||
148 | const char msgDeviceIcon [] PROGMEM = "DeviceIcon"; |
||
149 | const char msgSession_Initiator_Version_Info [] PROGMEM = "Session_Initiator_Version_Info"; |
||
150 | const char msgPerceived_Device_Type [] PROGMEM = "Perceived_Device_Type"; |
||
151 | const char msgPlayback_Rate [] PROGMEM = "Playback_Rate"; |
||
152 | const char msgPlayback_Object [] PROGMEM = "Playback_Object"; |
||
153 | const char msgPlayback_Container [] PROGMEM = "Playback_Container"; |
||
154 | |||
155 | // Ancillary formats |
||
156 | const char msgAssociation [] PROGMEM = "Association"; |
||
157 | const char msgScript [] PROGMEM = "Script"; |
||
158 | const char msgExecutable [] PROGMEM = "Executable"; |
||
159 | const char msgText [] PROGMEM = "Text"; |
||
160 | const char msgHTML [] PROGMEM = "HTML"; |
||
161 | const char msgDPOF [] PROGMEM = "DPOF"; |
||
162 | const char msgAIFF [] PROGMEM = "AIFF"; |
||
163 | const char msgWAV [] PROGMEM = "WAV"; |
||
164 | const char msgMP3 [] PROGMEM = "MP3"; |
||
165 | const char msgAVI [] PROGMEM = "AVI"; |
||
166 | const char msgMPEG [] PROGMEM = "MPEG"; |
||
167 | const char msgASF [] PROGMEM = "ASF"; |
||
168 | const char msgQT [] PROGMEM = "QT"; |
||
169 | |||
170 | // Image formats |
||
171 | const char msgEXIF_JPEG [] PROGMEM = "EXIF_JPEG"; |
||
172 | const char msgTIFF_EP [] PROGMEM = "TIFF_EP"; |
||
173 | const char msgFlashPix [] PROGMEM = "FlashPix"; |
||
174 | const char msgBMP [] PROGMEM = "BMP"; |
||
175 | const char msgCIFF [] PROGMEM = "CIFF"; |
||
176 | const char msgUndefined_0x3806 [] PROGMEM = "Undefined_0x3806"; |
||
177 | const char msgGIF [] PROGMEM = "GIF"; |
||
178 | const char msgJFIF [] PROGMEM = "JFIF"; |
||
179 | const char msgPCD [] PROGMEM = "PCD"; |
||
180 | const char msgPICT [] PROGMEM = "PICT"; |
||
181 | const char msgPNG [] PROGMEM = "PNG"; |
||
182 | const char msgUndefined_0x380C [] PROGMEM = "Undefined_0x380C"; |
||
183 | const char msgTIFF [] PROGMEM = "TIFF"; |
||
184 | const char msgTIFF_IT [] PROGMEM = "TIFF_IT"; |
||
185 | const char msgJP2 [] PROGMEM = "JP2"; |
||
186 | const char msgJPX [] PROGMEM = "JPX"; |
||
187 | |||
188 | // MTP Object Formats |
||
189 | const char msgUndefined_Firmware [] PROGMEM = "Undefined_Firmware"; |
||
190 | const char msgWindows_Image_Format [] PROGMEM = "Windows_Image_Format"; |
||
191 | const char msgUndefined_Audio [] PROGMEM = "Undefined_Audio"; |
||
192 | const char msgWMA [] PROGMEM = "WMA"; |
||
193 | const char msgOGG [] PROGMEM = "OGG"; |
||
194 | const char msgAAC [] PROGMEM = "AAC"; |
||
195 | const char msgAudible [] PROGMEM = "Audible"; |
||
196 | const char msgFLAC [] PROGMEM = "FLAC"; |
||
197 | const char msgUndefined_Video [] PROGMEM = "Undefined_Video"; |
||
198 | const char msgWMV [] PROGMEM = "WMV"; |
||
199 | const char msgMP4_Container [] PROGMEM = "MP4_Container"; |
||
200 | const char msgMP2 [] PROGMEM = "MP2"; |
||
201 | const char msg3GP_Container [] PROGMEM = "3GP_Container"; |
||
202 | |||
203 | |||
204 | // PTP Operation Codes (EOS specific) |
||
205 | #define PTP_OC_EOS_GetStorageIDs 0x9101 |
||
206 | #define PTP_OC_EOS_GetStorageInfo 0x9102 |
||
207 | #define PTP_OC_EOS_GetObject 0x9107 |
||
208 | #define PTP_OC_EOS_GetDeviceInfo 0x9108 |
||
209 | #define PTP_OC_EOS_GetObjectIDs 0x9109 |
||
210 | #define PTP_OC_EOS_Capture 0x910f |
||
211 | #define PTP_OC_EOS_SetDevicePropValue 0x9110 |
||
212 | #define PTP_OC_EOS_SetPCConnectMode 0x9114 |
||
213 | #define PTP_OC_EOS_SetExtendedEventInfo 0x9115 |
||
214 | #define PTP_OC_EOS_GetEvent 0x9116 |
||
215 | #define PTP_OC_EOS_GetLiveViewPicture 0x9153 |
||
216 | #define PTP_OC_EOS_MoveFocus 0x9155 |
||
217 | |||
218 | // PTP Operation Codes (PowerSot specific) |
||
219 | #define PTP_OC_PS_GetObjectSize 0x9001 |
||
220 | #define PTP_OC_PS_StartShootingMode 0x9008 |
||
221 | #define PTP_OC_PS_EndShootingMode 0x9009 |
||
222 | #define PTP_OC_PS_ViewfinderOn 0x900B |
||
223 | #define PTP_OC_PS_ViewfinderOff 0x900C |
||
224 | #define PTP_OC_PS_ReflectChanges 0x900D |
||
225 | #define PTP_OC_PS_CheckEvent 0x9013 |
||
226 | #define PTP_OC_PS_FocusLock 0x9014 |
||
227 | #define PTP_OC_PS_FocusUnlock 0x9015 |
||
228 | #define PTP_OC_PS_InitiateCaptureInMemory 0x901A |
||
229 | #define PTP_OC_PS_GetPartialObject 0x901B |
||
230 | #define PTP_OC_PS_GetViewfinderImage 0x901d |
||
231 | #define PTP_OC_PS_GetChanges 0x9020 |
||
232 | #define PTP_OC_PS_GetFolderEntries 0x9021 |
||
233 | |||
234 | |||
235 | |||
236 | |||
237 | class DevInfoParser : public PTPReadParser |
||
238 | { |
||
239 | static const char* ptpopNames[]; |
||
240 | static const char* mtpopNames[]; |
||
241 | static const char* ptpevNames[]; |
||
242 | static const char* mtpevNames[]; |
||
243 | static const char* acNames[]; |
||
244 | static const char* imNames[]; |
||
245 | static const char* ptpprNames[]; |
||
246 | static const char* mtpprNames[]; |
||
247 | |||
248 | uint8_t nStage; |
||
249 | |||
250 | // PrintString variables |
||
251 | uint16_t strByteCountDown; |
||
252 | |||
253 | // PrintWordArray variables |
||
254 | uint8_t waStage; |
||
255 | uint8_t waLenCountDown; |
||
256 | uint32_t waByteCountDown; |
||
257 | uint8_t waLen[4]; |
||
258 | union |
||
259 | { |
||
260 | uint8_t bytes[2]; |
||
261 | uint16_t word; |
||
262 | } waWord; |
||
263 | |||
264 | // PrintFunctMode variables |
||
265 | uint8_t fmByteCountDown; |
||
266 | uint8_t fmBytes[2]; |
||
267 | |||
268 | |||
269 | uint16_t idVendor; |
||
270 | |||
271 | typedef void (DevInfoParser::*PRINTFUNC)(uint16_t); |
||
272 | |||
273 | bool PrintVendor(uint8_t **pp, uint16_t &count); |
||
274 | bool PrintFunctMode(uint8_t **pp, uint16_t &count); |
||
275 | bool PrintString(uint8_t **pp, uint16_t &count); |
||
276 | bool PrintWordArray(uint8_t **pp, uint16_t &count, PRINTFUNC pf); |
||
277 | |||
278 | // Print functions for PrintWordArray |
||
279 | void PrintOperation(uint16_t op); |
||
280 | |||
281 | bool PrintPTPOperation(uint16_t op); |
||
282 | bool PrintMTPOperation(uint16_t op); |
||
283 | bool PrintPSOperation(uint16_t op); |
||
284 | bool PrintEOSOperation(uint16_t op); |
||
285 | |||
286 | void PrintEvent(uint16_t op); |
||
287 | void PrintDevProp(uint16_t op); |
||
288 | void PrintFormat(uint16_t op); |
||
289 | |||
290 | public: |
||
291 | DevInfoParser(); |
||
292 | virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset); |
||
293 | }; |
||
294 | |||
295 | #endif // __DEVINFOPARSER_H__ |