1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** USBX Component                                                        */
16 /**                                                                       */
17 /**   Device PIMA Class                                                   */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define UX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "ux_api.h"
28 #include "ux_device_class_pima.h"
29 #include "ux_device_stack.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    ux_device_class_pima_data.c                         PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Chaoqiong Xiao, Microsoft Corporation                               */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This module contains all the data definition used by the PIMA       */
45 /*    device class.                                                       */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*  CALLS                                                                 */
52 /*                                                                        */
53 /*    None                                                                */
54 /*                                                                        */
55 /*  CALLED BY                                                             */
56 /*                                                                        */
57 /*                                                                        */
58 /*  RELEASE HISTORY                                                       */
59 /*                                                                        */
60 /*    DATE              NAME                      DESCRIPTION             */
61 /*                                                                        */
62 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
63 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
64 /*                                            resulting in version 6.1    */
65 /*                                                                        */
66 /**************************************************************************/
67 
68 /* Define PIMA vendor extension descriptor. This is a regular string that needs to be put into unicode. */
69 UCHAR _ux_device_class_pima_vendor_extension_descriptor[] =     {
70 #ifdef UX_PIMA_WITH_MTP_SUPPORT
71                                                                 "microsoft.com: 1.0;  microsoft.com/WMPPD: 11.0; microsoft.com/WMPPD: 10.0; microsoft.com/WMDRMPD: 10.1;"
72 #else
73                                                                 0
74 #endif
75                                                                 };
76 
77 /* Define PIMA supported operations. The last entry MUST be a zero. The DeviceInfoSet command
78    will parse this array and compute the number of functions supported and return it to the
79    host.  */
80 
81 USHORT _ux_device_class_pima_supported_operations[] =            {
82 
83                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_DEVICE_INFO,
84                                                                 UX_DEVICE_CLASS_PIMA_OC_OPEN_SESSION,
85                                                                 UX_DEVICE_CLASS_PIMA_OC_CLOSE_SESSION,
86                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_STORAGE_IDS,
87                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_STORAGE_INFO,
88                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_NUM_OBJECTS,
89                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_OBJECT_HANDLES,
90                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_OBJECT_INFO,
91                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_OBJECT,
92                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_THUMB,
93                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_PARTIAL_OBJECT,
94                                                                 UX_DEVICE_CLASS_PIMA_OC_DELETE_OBJECT,
95                                                                 UX_DEVICE_CLASS_PIMA_OC_SEND_OBJECT_INFO,
96                                                                 UX_DEVICE_CLASS_PIMA_OC_SEND_OBJECT,
97                                                                 UX_DEVICE_CLASS_PIMA_OC_INITIATE_CAPTURE,
98                                                                 UX_DEVICE_CLASS_PIMA_OC_FORMAT_STORE,
99                                                                 UX_DEVICE_CLASS_PIMA_OC_RESET_DEVICE,
100 #ifdef UX_PIMA_WITH_MTP_SUPPORT
101                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_OBJECT_PROPS_SUPPORTED,
102                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_OBJECT_PROP_DESC,
103                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_OBJECT_PROP_VALUE,
104                                                                 UX_DEVICE_CLASS_PIMA_OC_SET_OBJECT_PROP_VALUE,
105                                                                 UX_DEVICE_CLASS_PIMA_OC_GET_OBJECT_REFERENCES,
106                                                                 UX_DEVICE_CLASS_PIMA_OC_SET_OBJECT_REFERENCES,
107 #endif
108                                                                 0
109                                                                 };
110 
111 
112 /* Define PIMA supported events. The last entry MUST be a zero. The DeviceInfoSet command
113    will parse this array and compute the number of functions supported and return it to the
114    host.  */
115 
116 USHORT _ux_device_class_pima_supported_events[] =                {
117 
118                                                                 UX_DEVICE_CLASS_PIMA_EC_CANCEL_TRANSACTION,
119                                                                 UX_DEVICE_CLASS_PIMA_EC_OBJECT_ADDED,
120                                                                 UX_DEVICE_CLASS_PIMA_EC_OBJECT_REMOVED,
121                                                                 UX_DEVICE_CLASS_PIMA_EC_STORE_ADDED,
122                                                                 UX_DEVICE_CLASS_PIMA_EC_STORE_REMOVED,
123                                                                 UX_DEVICE_CLASS_PIMA_EC_DEVICE_PROP_CHANGED,
124                                                                 UX_DEVICE_CLASS_PIMA_EC_OBJECT_INFO_CHANGED,
125                                                                 UX_DEVICE_CLASS_PIMA_EC_DEVICE_INFO_CHANGED,
126                                                                 UX_DEVICE_CLASS_PIMA_EC_REQUEST_OBJECT_TRANSFER,
127                                                                 UX_DEVICE_CLASS_PIMA_EC_STORE_FULL,
128                                                                 UX_DEVICE_CLASS_PIMA_EC_DEVICE_RESET,
129                                                                 UX_DEVICE_CLASS_PIMA_EC_STORAGE_INFO_CHANGED,
130                                                                 UX_DEVICE_CLASS_PIMA_EC_CAPTURE_COMPLETE,
131                                                                 UX_DEVICE_CLASS_PIMA_EC_UNREPORTED_STATUS,
132                                                                 0
133                                                                 };
134 
135 /* Define PIMA supported device properties. The last entry MUST be a zero. The DeviceInfoSet command
136    will parse this array and compute the number of functions supported and return it to the
137    host.  For each declared device property, a dataset must be created in the application.
138    This table is used is the application has not defined any device properties. */
139 USHORT _ux_device_class_pima_device_prop_supported[] =   {
140 
141                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_UNDEFINED,
142                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_BATTERY_LEVEL,
143                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_FUNCTIONAL_MODE,
144                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_IMAGE_SIZE,
145                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_COMPRESSION_SETTING,
146                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_WHITE_BALANCE,
147                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_RGB_GAIN,
148                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_F_NUMBER,
149                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_FOCAL_LENGTH,
150                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_FOCUS_DISTANCE,
151                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_FOCUS_MODE,
152                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_EXPOSURE_METERING_MODE,
153                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_FLASH_MODE,
154                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_EXPOSURE_TIME,
155                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_EXPOSURE_PROGRAM_MODE,
156                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_EXPOSURE_INDEX,
157                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_EXPOSURE_BIAS_COMPENSATION,
158                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_DATE_TIME,
159                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_CAPTURE_DELAY,
160                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_STILL_CAPTURE_MODE,
161                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_CONTRAST,
162                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_SHARPNESS,
163                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_DIGITAL_ZOOM,
164                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_EFFECT_MODE,
165                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_BURST_NUMBER,
166                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_BURST_INTERVAL,
167                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_TIME_LAPSE_NUMBER,
168                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_TIME_LAPSE_INTERVAL,
169                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_FOCUS_METERING_MODE,
170                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_UPLOAD_URL,
171                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_ARTIST,
172                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_COPYRIGHT_INFO,
173 #ifdef UX_PIMA_WITH_MTP_SUPPORT
174                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_SYNCHRONIZATION_PARTNER,
175                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_DEVICE_FRIENDLY_NAME,
176                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_VOLUME,
177                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_SUPPORTED_FORMATS_ORDERED,
178                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_DEVICE_ICON,
179                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_PLAYBACK_RATE,
180                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_PLAYBACK_OBJECT,
181                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_PLAYBACK_CONTAINER,
182                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_SESSION_INITIATOR_VERSION_INFO,
183                                                                 UX_DEVICE_CLASS_PIMA_DEV_PROP_PERCEIVED_DEVICE_TYPE,
184 #endif
185                                                                 0
186     };
187 
188 /* Define PIMA supported capture formats. The last entry MUST be a zero. The DeviceInfoSet command
189    will parse this array and compute the number of functions supported and return it to the
190    host.
191    This table is used is the application has not defined any capture formats. */
192 USHORT _ux_device_class_pima_supported_capture_formats[] =       {
193                                                                 0
194                                                                 };
195 
196 /* Define PIMA supported image formats. The last entry MUST be a zero. The DeviceInfoSet command
197    will parse this array and compute the number of formats supported and return it to the
198    host.
199    This table is used is the application has not defined any capture formats. */
200 USHORT _ux_device_class_pima_supported_image_formats[] =        {
201                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED,
202                                                                 UX_DEVICE_CLASS_PIMA_OFC_ASSOCIATION,
203                                                                 UX_DEVICE_CLASS_PIMA_OFC_SCRIPT,
204                                                                 UX_DEVICE_CLASS_PIMA_OFC_EXECUTABLE,
205                                                                 UX_DEVICE_CLASS_PIMA_OFC_TEXT,
206                                                                 UX_DEVICE_CLASS_PIMA_OFC_HTML,
207                                                                 UX_DEVICE_CLASS_PIMA_OFC_DPOF,
208                                                                 UX_DEVICE_CLASS_PIMA_OFC_AIFF,
209                                                                 UX_DEVICE_CLASS_PIMA_OFC_WAV,
210                                                                 UX_DEVICE_CLASS_PIMA_OFC_MP3,
211                                                                 UX_DEVICE_CLASS_PIMA_OFC_AVI,
212                                                                 UX_DEVICE_CLASS_PIMA_OFC_MPEG,
213                                                                 UX_DEVICE_CLASS_PIMA_OFC_ASF,
214                                                                 UX_DEVICE_CLASS_PIMA_OFC_DEFINED,
215                                                                 UX_DEVICE_CLASS_PIMA_OFC_EXIF_JPEG,
216                                                                 UX_DEVICE_CLASS_PIMA_OFC_TIFF_EP,
217                                                                 UX_DEVICE_CLASS_PIMA_OFC_FLASHPIX,
218                                                                 UX_DEVICE_CLASS_PIMA_OFC_BMP,
219                                                                 UX_DEVICE_CLASS_PIMA_OFC_CIFF,
220                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED,
221                                                                 UX_DEVICE_CLASS_PIMA_OFC_GIF,
222                                                                 UX_DEVICE_CLASS_PIMA_OFC_JFIF,
223                                                                 UX_DEVICE_CLASS_PIMA_OFC_CD,
224                                                                 UX_DEVICE_CLASS_PIMA_OFC_PICT,
225                                                                 UX_DEVICE_CLASS_PIMA_OFC_PNG,
226                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED,
227                                                                 UX_DEVICE_CLASS_PIMA_OFC_TIFF,
228                                                                 UX_DEVICE_CLASS_PIMA_OFC_TIFF_IT,
229                                                                 UX_DEVICE_CLASS_PIMA_OFC_JP2,
230                                                                 UX_DEVICE_CLASS_PIMA_OFC_JPX,
231 #ifdef UX_PIMA_WITH_MTP_SUPPORT
232                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED_FIRMWARE,
233                                                                 UX_DEVICE_CLASS_PIMA_OFC_WINDOWS_IMAGE_FORMAT,
234                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED_AUDIO,
235                                                                 UX_DEVICE_CLASS_PIMA_OFC_WMA,
236                                                                 UX_DEVICE_CLASS_PIMA_OFC_OGG,
237                                                                 UX_DEVICE_CLASS_PIMA_OFC_AAC,
238                                                                 UX_DEVICE_CLASS_PIMA_OFC_AUDIBLE,
239                                                                 UX_DEVICE_CLASS_PIMA_OFC_FLAC,
240                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED_VIDEO,
241                                                                 UX_DEVICE_CLASS_PIMA_OFC_WMV,
242                                                                 UX_DEVICE_CLASS_PIMA_OFC_MP4_CONTAINER,
243                                                                 UX_DEVICE_CLASS_PIMA_OFC_MP2,
244                                                                 UX_DEVICE_CLASS_PIMA_OFC_3GP_CONTAINER,
245                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED_COLLECTION,
246                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_MULTIMEDIA_ALBUM,
247                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_IMAGE_ALBUM,
248                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_AUDIO_ALBUM,
249                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_VIDEO_ALBUM,
250                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_AUDIO_AND_VIDEO_PLAYLIST,
251                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_CONTACT_GROUP,
252                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_MESSAGE_FOLDER,
253                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_CHAPTERED_PRODUCTION,
254                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_AUDIO_PLAYLIST,
255                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_VIDEO_PLAYLIST,
256                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_MEDIACAST,
257                                                                 UX_DEVICE_CLASS_PIMA_OFC_WPL_PLAYLIST,
258                                                                 UX_DEVICE_CLASS_PIMA_OFC_M3U_PLAYLIST,
259                                                                 UX_DEVICE_CLASS_PIMA_OFC_MPL_PLAYLIST,
260                                                                 UX_DEVICE_CLASS_PIMA_OFC_ASX_PLAYLIST,
261                                                                 UX_DEVICE_CLASS_PIMA_OFC_PLS_PLAYLIST,
262                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED_DOCUMENT,
263                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_DOCUMENT,
264                                                                 UX_DEVICE_CLASS_PIMA_OFC_XML_DOCUMENT,
265                                                                 UX_DEVICE_CLASS_PIMA_OFC_MICROSOFT_WORD_DOCUMENT,
266                                                                 UX_DEVICE_CLASS_PIMA_OFC_MHT_COMPILED_HTML_DOCUMENT,
267                                                                 UX_DEVICE_CLASS_PIMA_OFC_MICROSOFT_EXCEL_SPREADSHEET,
268                                                                 UX_DEVICE_CLASS_PIMA_OFC_MICROSOFT_POWERPOINT_PRESENTATION,
269                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED_MESSAGE,
270                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_MESSAGE,
271                                                                 UX_DEVICE_CLASS_PIMA_OFC_UNDEFINED_CONTACT,
272                                                                 UX_DEVICE_CLASS_PIMA_OFC_ABSTRACT_CONTACT,
273                                                                 UX_DEVICE_CLASS_PIMA_OFC_VCARD2,
274 #endif
275                                                                 0
276                                                                 };
277