-
Notifications
You must be signed in to change notification settings - Fork 46
/
ptpconstitles.cpp
315 lines (296 loc) · 6.82 KB
/
ptpconstitles.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
This software may be distributed and modified under the terms of the GNU
General Public License version 2 (GPL2) as published by the Free Software
Foundation and appearing in the file GPL2.TXT included in the packaging of
this file. Please note that GPL2 Section 2[b] requires that all works based
on this software must also be made publicly available under the terms of
the GPL2 ("Copyleft").
Contact information
-------------------
Circuits At Home, LTD
Web : http://www.circuitsathome.com
e-mail : [email protected]
*/
#include "ptpconstitles.h"
const char* const ptpopNames[] PROGMEM =
{
msgUndefined,
msgGetDeviceInfo,
msgOpenSession,
msgCloseSession,
msgGetStorageIDs,
msgGetStorageInfo,
msgGetNumObjects,
msgGetObjectHandles,
msgGetObjectInfo,
msgGetObject,
msgGetThumb,
msgDeleteObject,
msgSendObjectInfo,
msgSendObject,
msgInitiateCapture,
msgFormatStore,
msgResetDevice,
msgSelfTest,
msgSetObjectProtection,
msgPowerDown,
msgGetDevicePropDesc,
msgGetDevicePropValue,
msgSetDevicePropValue,
msgResetDevicePropValue,
msgTerminateOpenCapture,
msgMoveObject,
msgCopyObject,
msgGetPartialObject,
msgInitiateOpenCapture
};
const char* const mtpopNames[] PROGMEM =
{
msgUndefined,
msgGetObjectPropsSupported,
msgGetObjectPropDesc,
msgGetObjectPropValue,
msgSetObjectPropValue,
msgGetObjectPropList,
msgSetObjectPropList,
msgGetInterdependentPropDesc,
msgSendObjectPropList
};
const char* const ptpevNames[] PROGMEM =
{
msgUndefined,
msgCancelTransaction,
msgObjectAdded,
msgObjectRemoved,
msgStoreAdded,
msgStoreRemoved,
msgDevicePropChanged,
msgObjectInfoChanged,
msgDeviceInfoChanged,
msgRequestObjectTransfer,
msgStoreFull,
msgDeviceReset,
msgStorageInfoChanged,
msgCaptureComplete,
msgUnreportedStatus
};
const char* const mtpevNames[] PROGMEM =
{
msgUndefined,
msgObjectPropChanged,
msgObjectPropDescChanged,
msgObjectReferencesChanged
};
const char* const ptpprNames[] PROGMEM =
{
msgUndefined,
msgBatteryLevel,
msgFunctionalMode,
msgImageSize,
msgCompressionSetting,
msgWhiteBalance,
msgRGBGain,
msgFNumber,
msgFocalLength,
msgFocusDistance,
msgFocusMode,
msgExposureMeteringMode,
msgFlashMode,
msgExposureTime,
msgExposureProgramMode,
msgExposureIndex,
msgExposureBiasCompensation,
msgDateTime,
msgCaptureDelay,
msgStillCaptureMode,
msgContrast,
msgSharpness,
msgDigitalZoom,
msgEffectMode,
msgBurstNumber,
msgBurstInterval,
msgTimelapseNumber,
msgTimelapseInterval,
msgFocusMeteringMode,
msgUploadURL,
msgArtist,
msgCopyrightInfo
};
const char* const mtpprNames[] PROGMEM =
{
msgUndefined,
msgSynchronization_Partner,
msgDevice_Friendly_Name,
msgVolume,
msgSupportedFormatsOrdered,
msgDeviceIcon,
msgSession_Initiator_Version_Info,
msgPerceived_Device_Type,
msgPlayback_Rate,
msgPlayback_Object,
msgPlayback_Container
};
const char* const acNames[] PROGMEM =
{
msgUndefined,
msgAssociation,
msgScript,
msgExecutable,
msgText,
msgHTML,
msgDPOF,
msgAIFF,
msgWAV,
msgMP3,
msgAVI,
msgMPEG,
msgASF,
msgQT
};
const char* const imNames[] PROGMEM =
{
msgUndefined,
msgEXIF_JPEG,
msgTIFF_EP,
msgFlashPix,
msgBMP,
msgCIFF,
msgUndefined_0x3806,
msgGIF,
msgJFIF,
msgPCD,
msgPICT,
msgPNG,
msgUndefined_0x380C,
msgTIFF,
msgTIFF_IT,
msgJP2,
msgJPX,
};
bool PrintPTPOperation(uint16_t op)
{
if ((op & 0xFF) <= (PTP_OC_InitiateOpenCapture & 0xFF))
{
E_Notify((char*)pgm_read_word(&ptpopNames[(op & 0xFF)]), 0x80);
return true;
}
return false;
}
bool PrintMTPOperation(uint16_t op)
{
if ((op & 0xFF) <= (MTP_OC_SendObjectPropList & 0xFF))
E_Notify((char*)pgm_read_word(&mtpopNames[(op & 0xFF)]), 0x80);
else
{
switch (op)
{
case MTP_OC_GetObjectReferences:
E_Notify(msgGetObjectReferences, 0x80);
break;
case MTP_OC_SetObjectReferences:
E_Notify(msgSetObjectReferences, 0x80);
break;
case MTP_OC_Skip:
E_Notify(msgSkip, 0x80);
break;
default:
return false;
}
}
return true;
}
void PrintEvent(uint16_t op)
{
if ((((op >> 8) & 0xFF) == 0x40) && ((op & 0xFF) <= (PTP_EC_UnreportedStatus & 0xFF)))
E_Notify((char*)pgm_read_word(&ptpevNames[(op & 0xFF)]), 0x80);
else
if ((((op >> 8) & 0xFF) == 0xC8) && ((op & 0xFF) <= (MTP_EC_ObjectReferencesChanged & 0xFF)))
E_Notify((char*)pgm_read_word(&mtpevNames[(op & 0xFF)]), 0x80);
else
E_Notify(msgVendorDefined, 0x80);
}
void PrintDevProp(uint16_t op)
{
if ((((op >> 8) & 0xFF) == 0x50) && ((op & 0xFF) <= (PTP_DPC_CopyrightInfo & 0xFF)))
E_Notify((char*)pgm_read_word(&ptpprNames[(op & 0xFF)]), 0x80);
else
if (((op >> 8) & 0xFF) == 0xD4)
{
if ( (op & 0xFF) <= (MTP_DPC_Perceived_Device_Type & 0xFF) )
E_Notify((char*)pgm_read_word(&mtpprNames[(op & 0xFF)]), 0x80);
else
{
switch (op)
{
case MTP_DPC_Playback_Rate:
E_Notify(msgPlayback_Rate, 0x80);
break;
case MTP_DPC_Playback_Object:
E_Notify(msgPlayback_Object, 0x80);
break;
case MTP_DPC_Playback_Container:
E_Notify(msgPlayback_Container, 0x80);
break;
default:
E_Notify(msgVendorDefined, 0x80);
}
}
}
else
E_Notify(msgVendorDefined, 0x80);
}
void PrintFormat(uint16_t op)
{
if ((((op >> 8) & 0xFF) == 0x30) && ((op & 0xFF) <= (PTP_OFC_QT & 0xFF)))
E_Notify((char*)pgm_read_word(&acNames[(op & 0xFF)]), 0x80);
else
if ((((op >> 8) & 0xFF) == 0x38) && ((op & 0xFF) <= (PTP_OFC_JPX & 0xFF)))
E_Notify((char*)pgm_read_word(&imNames[(op & 0xFF)]), 0x80);
else
{
switch (op)
{
case MTP_OFC_Undefined_Firmware:
E_Notify(msgUndefined_Firmware, 0x80);
break;
case MTP_OFC_Windows_Image_Format:
E_Notify(msgWindows_Image_Format, 0x80);
break;
case MTP_OFC_Undefined_Audio:
E_Notify(msgUndefined_Audio, 0x80);
break;
case MTP_OFC_WMA:
E_Notify(msgWMA, 0x80);
break;
case MTP_OFC_OGG:
E_Notify(msgOGG, 0x80);
break;
case MTP_OFC_AAC:
E_Notify(msgAAC, 0x80);
break;
case MTP_OFC_Audible:
E_Notify(msgAudible, 0x80);
break;
case MTP_OFC_FLAC:
E_Notify(msgFLAC, 0x80);
break;
case MTP_OFC_Undefined_Video:
E_Notify(msgUndefined_Video, 0x80);
break;
case MTP_OFC_WMV:
E_Notify(msgWMV, 0x80);
break;
case MTP_OFC_MP4_Container:
E_Notify(msgMP4_Container, 0x80);
break;
case MTP_OFC_MP2:
E_Notify(msgMP2, 0x80);
break;
case MTP_OFC_3GP_Container:
E_Notify(msg3GP_Container, 0x80);
break;
default:
E_Notify(msgVendorDefined, 0x80);
}
}
}