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_host_class_pima.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _ux_pictbridge_dpshost_output_object_configure_print_service */
38 /* PORTABLE C */
39 /* 6.1.11 */
40 /* AUTHOR */
41 /* */
42 /* Chaoqiong Xiao, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function creates the tag lines of the configure_print_service */
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_dpshost_object_get */
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 /* 04-25-2022 Yajun Xia Modified comment(s), */
77 /* internal clean up, */
78 /* resulting in version 6.1.11 */
79 /* */
80 /**************************************************************************/
_ux_pictbridge_dpshost_output_object_configure_print_service(UX_PICTBRIDGE * pictbridge,UCHAR * pima_object_buffer,ULONG object_length,UCHAR ** pima_object_buffer_updated,ULONG * object_length_updated)81 UINT _ux_pictbridge_dpshost_output_object_configure_print_service(UX_PICTBRIDGE *pictbridge,
82 UCHAR *pima_object_buffer,
83 ULONG object_length,
84 UCHAR **pima_object_buffer_updated,
85 ULONG *object_length_updated)
86 {
87
88 UINT status;
89
90
91 /* Add the line <configurePrintService> */
92 status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_configureprintservice,
93 UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
94 UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
95 if (status != UX_SUCCESS)
96 return(status);
97
98 /* Add the line <printServiceAvailable> xxxxxxxx </printServiceAvailable> */
99 status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_printserviceavailable,
100 UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
101 UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_print_service_available, &pima_object_buffer, &object_length);
102 if (status != UX_SUCCESS)
103 return(status);
104
105 /* Add the line <dpsVersions>major_minor major_minor</dpsVersions> */
106 status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsversions,
107 UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_MAJOR_MINOR,
108 UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsversions, &pima_object_buffer, &object_length);
109 if (status != UX_SUCCESS)
110 return(status);
111
112
113 /* Add the line <vendorName> ascii_string </vendorName> */
114 status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_vendorname,
115 UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
116 UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_product_name, &pima_object_buffer, &object_length);
117 if (status != UX_SUCCESS)
118 return(status);
119
120
121 /* Add the line <vendorSpecificVersion> major_minor </vendorSpecificVersion> */
122 status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_vendorspecificversion,
123 UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_MAJOR_MINOR,
124 UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_vendor_specific_version, &pima_object_buffer, &object_length);
125 if (status != UX_SUCCESS)
126 return(status);
127
128
129 /* Add the line <productName> ascii_string </productName> */
130 status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_productname,
131 UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
132 UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_product_name, &pima_object_buffer, &object_length);
133 if (status != UX_SUCCESS)
134 return(status);
135
136
137 /* Add the line <serialNo> ascii_string </serialNo> */
138 status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_serialno,
139 UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
140 UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_serial_no, &pima_object_buffer, &object_length);
141 if (status != UX_SUCCESS)
142 return(status);
143
144
145 /* Add the line </configurePrintService> */
146 status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_configureprintservice,
147 UX_PICTBRIDGE_TAG_FLAG_END,
148 UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
149 if (status != UX_SUCCESS)
150 return(status);
151
152 /* Update the caller's object position. */
153 *pima_object_buffer_updated = pima_object_buffer;
154
155 /* Update the caller's object length . */
156 *object_length_updated = object_length;
157
158 /* Return completion status. */
159 return(UX_SUCCESS);
160 }
161
162