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 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   Pictbridge Application                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /* Include necessary system files.  */
25 
26 #define UX_SOURCE_CODE
27 
28 #include "ux_api.h"
29 #include "ux_pictbridge.h"
30 #include "ux_device_class_pima.h"
31 
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _ux_pictbridge_dpsclient_input_abortjob                             */
38 /*                                                        PORTABLE C      */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Chaoqiong Xiao, Microsoft Corporation                               */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function creates the tag lines of the abort job                */
47 /*    request.                                                            */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    pictbridge                            Pictbridge instance           */
52 /*    pima_object_buffer                    Pointer to object buffer      */
53 /*    object_length                         Length of the object          */
54 /*    pima_object_buffer_updated            Updated Address of the object */
55 /*    object_length_updated                 Updated length                */
56 /*                                                                        */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    Completion Status                                                   */
61 /*                                                                        */
62 /*  CALLS                                                                 */
63 /*                                                                        */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    _ux_pictbridge_dpsclient_input_object_prepare                       */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
74 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
_ux_pictbridge_dpsclient_input_object_abortjob(UX_PICTBRIDGE * pictbridge,ULONG input_subcode,ULONG input_parameter,UCHAR * pima_object_buffer,ULONG object_length,UCHAR ** pima_object_buffer_updated,ULONG * object_length_updated)78 UINT _ux_pictbridge_dpsclient_input_object_abortjob(UX_PICTBRIDGE *pictbridge,
79                             ULONG input_subcode,
80                             ULONG input_parameter,
81                             UCHAR *pima_object_buffer,
82                             ULONG object_length,
83                             UCHAR **pima_object_buffer_updated,
84                             ULONG *object_length_updated)
85 {
86 
87 UINT                        status;
88 UX_PICTBRIDGE_JOBINFO       *jobinfo;
89 
90     UX_PARAMETER_NOT_USED(input_subcode);
91     UX_PARAMETER_NOT_USED(input_parameter);
92 
93 
94     /* We can start a new job. Fill in the JobConfig and PrintInfo structures. */
95     jobinfo = &pictbridge -> ux_pictbridge_jobinfo;
96 
97     /* Add the line <abortJob>  */
98     status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_abortjob,
99                                                 UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
100                                                 UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
101     if (status != UX_SUCCESS)
102         return(status);
103 
104     /* Add the line <abortStyle> xxxxxxxx </abortStyle> */
105     status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_abortstyle,
106                                             UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
107                                             UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_abort_style, &pima_object_buffer, &object_length);
108     if (status != UX_SUCCESS)
109         return(status);
110 
111     /* Add the line </abortJob>  */
112     status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_abortjob,
113                                                 UX_PICTBRIDGE_TAG_FLAG_END,
114                                                 UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
115     if (status != UX_SUCCESS)
116         return(status);
117 
118     /* Update the caller's object position.  */
119     *pima_object_buffer_updated = pima_object_buffer;
120 
121     /* Update the caller's object length .  */
122     *object_length_updated = object_length;
123 
124     /* Return completion status.  */
125     return(UX_SUCCESS);
126 }
127 
128