1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** USBX Component                                                        */
16 /**                                                                       */
17 /**   Pictbridge Application                                              */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /* Include necessary system files.  */
24 
25 #define UX_SOURCE_CODE
26 
27 #include "ux_api.h"
28 #include "ux_pictbridge.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason   */
36 /*                                                        PORTABLE C      */
37 /*                                                           6.1          */
38 /*                                                                        */
39 /*                                                                        */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Chaoqiong Xiao, Microsoft Corporation                               */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function decodes the jobendreason tag                          */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    pictbridge                             Pictbridge instance          */
51 /*    input_variable                         Pointer to variable          */
52 /*    input_string                           Pointer to string            */
53 /*    xml_parameter                          XML parameter                */
54 /*                                                                        */
55 /*  OUTPUT                                                                */
56 /*                                                                        */
57 /*    Completion Status                                                   */
58 /*                                                                        */
59 /*  CALLS                                                                 */
60 /*                                                                        */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    _ux_pictbridge_object_parse                                         */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
71 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
72 /*                                            resulting in version 6.1    */
73 /*                                                                        */
74 /**************************************************************************/
_ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason(UX_PICTBRIDGE * pictbridge,UCHAR * input_variable,UCHAR * input_string,UCHAR * xml_parameter)75 UINT  _ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason(UX_PICTBRIDGE *pictbridge,
76                             UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
77 {
78 
79 UINT    status;
80 ULONG   hexa_element;
81 
82     UX_PARAMETER_NOT_USED(input_string);
83     UX_PARAMETER_NOT_USED(input_variable);
84     UX_PARAMETER_NOT_USED(xml_parameter);
85 
86     /* Get the dpsprintservicestatus variable.  */
87     status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
88 
89     /* Check status.  */
90     if (status == UX_SUCCESS)
91     {
92 
93         /* Check the returned value. Must be one of 5 possibilities.  */
94         if (hexa_element == UX_PICTBRIDGE_JOB_END_REASON_NOT_ENDED ||
95             hexa_element == UX_PICTBRIDGE_JOB_END_REASON_NORMAL  ||
96             hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_9000000 ||
97             hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_9001000 ||
98             hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_OTHER)
99         {
100 
101             /* Save this value.  */
102             pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_jobendreason = hexa_element;
103 
104             /* We are done. */
105             return(UX_SUCCESS);
106         }
107     }
108 
109     /* We get here when we reached an unexpected end of the XML object or a format error.  */
110     return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
111 
112 }
113 
114