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
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _ux_pictbridge_xml_function_root_xml PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Chaoqiong Xiao, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function decodes the "xml" tag */
45 /* */
46 /* INPUT */
47 /* */
48 /* pictbridge Pictbridge instance */
49 /* input_variable Pointer to variable */
50 /* input_string Pointer to string */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* Completion Status */
55 /* */
56 /* CALLS */
57 /* */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* _ux_pictbridge_object_parse */
62 /* */
63 /* RELEASE HISTORY */
64 /* */
65 /* DATE NAME DESCRIPTION */
66 /* */
67 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
68 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
69 /* resulting in version 6.1 */
70 /* */
71 /**************************************************************************/
_ux_pictbridge_xml_function_root_xml(UX_PICTBRIDGE * pictbridge,UCHAR * input_variable,UCHAR * input_string,UCHAR * xml_parameter)72 UINT _ux_pictbridge_xml_function_root_xml(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable,
73 UCHAR *input_string, UCHAR *xml_parameter)
74 {
75 UINT status;
76 UINT input_length = 0;
77 UINT length = 0;
78
79 UX_PARAMETER_NOT_USED(input_string);
80 UX_PARAMETER_NOT_USED(xml_parameter);
81 UX_PARAMETER_NOT_USED(pictbridge);
82
83 /* Get the length of the variable. */
84 status = _ux_utility_string_length_check(input_variable, &input_length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
85 if (status != UX_SUCCESS)
86 return(status);
87
88 /* Get the length of the "version " variable. */
89 status = _ux_utility_string_length_check(_ux_pictbridge_xml_variable_version, &length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
90 if (status != UX_SUCCESS)
91 return(status);
92
93 /* If length do not match, no need to check for a match. */
94 if (length == input_length)
95 {
96
97 /* Both length match, we may have a variable name match. Check the names */
98 if (_ux_utility_memory_compare(_ux_pictbridge_xml_variable_version,input_variable, length) == UX_SUCCESS)
99 {
100
101 /* The variable name is OK, we do not check the xml version. */
102 return(UX_SUCCESS);
103
104 }
105
106 }
107 /* We get here when we reached an unexpected end of the XML object. */
108 return(UX_ERROR);
109 }
110
111