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_               */
36 /*                                       capabilitychanged                */
37 /*                                                        PORTABLE C      */
38 /*                                                           6.1          */
39 /*                                                                        */
40 /*                                                                        */
41 /*                                                                        */
42 /*  AUTHOR                                                                */
43 /*                                                                        */
44 /*    Chaoqiong Xiao, Microsoft Corporation                               */
45 /*                                                                        */
46 /*  DESCRIPTION                                                           */
47 /*                                                                        */
48 /*    This function decodes the capabilitychanged tag                     */
49 /*                                                                        */
50 /*  INPUT                                                                 */
51 /*                                                                        */
52 /*    pictbridge                             Pictbridge instance          */
53 /*    input_variable                         Pointer to variable          */
54 /*    input_string                           Pointer to string            */
55 /*    xml_parameter                          XML parameter                */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    Completion Status                                                   */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*                                                                        */
64 /*  CALLED BY                                                             */
65 /*                                                                        */
66 /*    _ux_pictbridge_object_parse                                         */
67 /*                                                                        */
68 /*  RELEASE HISTORY                                                       */
69 /*                                                                        */
70 /*    DATE              NAME                      DESCRIPTION             */
71 /*                                                                        */
72 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
73 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
74 /*                                            resulting in version 6.1    */
75 /*                                                                        */
76 /**************************************************************************/
_ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged(UX_PICTBRIDGE * pictbridge,UCHAR * input_variable,UCHAR * input_string,UCHAR * xml_parameter)77 UINT  _ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged(UX_PICTBRIDGE *pictbridge,
78                             UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
79 {
80 
81 UINT    status;
82 ULONG   hexa_element;
83 
84     UX_PARAMETER_NOT_USED(input_string);
85     UX_PARAMETER_NOT_USED(input_variable);
86 
87     /* Get the capabilitychanged variable.  */
88     status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
89 
90     /* Check status.  */
91     if (status == UX_SUCCESS)
92     {
93 
94         /* Check the returned value. Must be one of 2 possibilities.  */
95         if (hexa_element == UX_PICTBRIDGE_CAPABILITY_CHANGED_FALSE        ||
96             hexa_element == UX_PICTBRIDGE_CAPABILITY_CHANGED_TRUE)
97         {
98 
99             /* Save this value.  */
100             pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_capabilitychanged = hexa_element;
101 
102             /* We are done. */
103             return(UX_SUCCESS);
104         }
105     }
106 
107     /* We get here when we reached an unexpected end of the XML object or a format error.  */
108     return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
109 
110 }
111 
112 
113