summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPProvost <[email protected]>2020-05-13 13:56:31 -0600
committerPProvost <[email protected]>2020-05-13 13:56:31 -0600
commit6c0ce19464239cfdffe7c633d09ddfac328b8c68 (patch)
tree19d73a5fe8b003f8071031986814a6d5a9fa2928
parentd82fa397b916c25931804122d86686deb0b98a9c (diff)
Added missing pictbridge
-rw-r--r--common/usbx_pictbridge/CMakeLists.txt107
-rw-r--r--common/usbx_pictbridge/inc/ux_pictbridge.h1040
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c219
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_data.c1361
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_abortjob.c101
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_capability.c111
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_configure_print_service.c106
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_continuejob.c100
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_device_status.c105
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_startjob.c101
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_abortjob.c125
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_configure_print_service.c144
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_continuejob.c108
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_get_capability.c283
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_prepare.c223
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_startjob.c245
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c142
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_send.c250
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_delete.c79
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_handles_get.c111
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_info_get.c102
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_info_send.c151
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_number_get.c84
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_register_event_callback_function.c81
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_start.c270
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_thread.c208
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_device_status.c160
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c163
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_send.c373
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_notification_callback.c119
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_object_get.c303
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c154
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_create.c186
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_get_capability.c275
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_get_device_status.c157
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_response_get.c287
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c374
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c328
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c183
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_element_to_decimal.c148
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c157
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c157
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c123
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_hexa_to_major_minor.c110
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_object_parse.c318
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_output_object_tag_line_add.c488
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_tag_name_get.c479
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_tag_name_scan.c118
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_getcapability_capability_layouts.c132
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_getcapability_capability_papertypes.c131
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged.c109
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_disconnectenable.c111
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_dpsprintservicestatus.c110
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorreason.c112
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorstatus.c111
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason.c111
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_newjobok.c109
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob.c118
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_cropping.c101
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_dateprint.c100
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filenameprint.c101
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filetype.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_fixedsize.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_imageoptimize.c100
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_layout.c100
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papersize.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papertype.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_quality.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo.c125
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_copies.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_copyid.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_croppingarea.c234
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_date.c102
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_fileid.c100
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_filename.c102
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_filepath.c102
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_prtid.c101
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_null.c82
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_croppings.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_dateprints.c100
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_filenameprints.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_filetypes.c98
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_fixedsizes.c98
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_imageoptimizes.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_layouts.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_papersizes.c98
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_papertypes.c98
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_qualities.c98
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_capabilitychanged.c109
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_disconnectenable.c109
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_dpsprintservicestatus.c110
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_errorreason.c112
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_errorstatus.c110
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_jobendreason.c112
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_newjobok.c110
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_result.c99
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_dps.c125
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_input.c85
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_output.c85
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_xml.c108
100 files changed, 16674 insertions, 0 deletions
diff --git a/common/usbx_pictbridge/CMakeLists.txt b/common/usbx_pictbridge/CMakeLists.txt
new file mode 100644
index 0000000..e59a024
--- /dev/null
+++ b/common/usbx_pictbridge/CMakeLists.txt
@@ -0,0 +1,107 @@
+target_sources(${PROJECT_NAME} PRIVATE
+ # {{BEGIN_TARGET_SOURCES}}
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_array_element_to_array_hexa.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_data.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_api_abortjob.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_api_capability.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_api_configure_print_service.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_api_continuejob.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_api_device_status.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_api_startjob.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_input_object_abortjob.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_input_object_configure_print_service.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_input_object_continuejob.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_input_object_get_capability.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_input_object_prepare.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_input_object_startjob.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_object_data_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_object_data_send.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_object_delete.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_object_handles_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_object_info_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_object_info_send.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_object_number_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_register_event_callback_function.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_start.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpsclient_thread.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_input_object_notify_device_status.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_input_object_notify_job_status.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_input_object_send.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_notification_callback.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_object_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_output_object_configure_print_service.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_output_object_create.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_output_object_get_capability.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_output_object_get_device_status.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_response_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_start.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_startjob.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_dpshost_thread.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_element_to_decimal.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_element_to_hexa.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_hexa_to_decimal_string.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_hexa_to_element.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_hexa_to_major_minor.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_object_parse.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_output_object_tag_line_add.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_tag_name_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_tag_name_scan.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_getcapability_capability_layouts.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_getcapability_capability_papertypes.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_notifydevicestatus_disconnectenable.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_notifydevicestatus_dpsprintservicestatus.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorreason.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorstatus.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_notifydevicestatus_newjobok.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_cropping.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_dateprint.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filenameprint.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filetype.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_fixedsize.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_imageoptimize.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_layout.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papersize.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papertype.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_jobconfig_quality.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo_copies.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo_copyid.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo_croppingarea.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo_date.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo_fileid.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo_filename.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo_filepath.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_input_startjob_printinfo_prtid.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_null.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_croppings.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_dateprints.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_filenameprints.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_filetypes.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_fixedsizes.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_imageoptimizes.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_layouts.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_papersizes.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_papertypes.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getcapability_capability_qualities.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getdevicestatus_capabilitychanged.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getdevicestatus_disconnectenable.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getdevicestatus_dpsprintservicestatus.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getdevicestatus_errorreason.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getdevicestatus_errorstatus.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getdevicestatus_jobendreason.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_getdevicestatus_newjobok.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_output_result.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_root_dps.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_root_input.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_root_output.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_pictbridge_xml_function_root_xml.c
+
+ # {{END_TARGET_SOURCES}}
+)
+
+target_include_directories(${PROJECT_NAME} PUBLIC
+ ${CMAKE_CURRENT_LIST_DIR}/inc
+)
diff --git a/common/usbx_pictbridge/inc/ux_pictbridge.h b/common/usbx_pictbridge/inc/ux_pictbridge.h
new file mode 100644
index 0000000..6ec8a7e
--- /dev/null
+++ b/common/usbx_pictbridge/inc/ux_pictbridge.h
@@ -0,0 +1,1040 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/**************************************************************************/
+/* */
+/* COMPONENT DEFINITION RELEASE */
+/* */
+/* ux_pictbridge.h PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This file contains all the header and extern functions used by the */
+/* USBX Pictbridge application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+
+#ifndef UX_PICTBRIDGE_H
+#define UX_PICTBRIDGE_H
+
+struct UX_PICTBRIDGE_STRUCT;
+
+/* Define the behaviour of this Pictbridge device : DPSHOST or DPSCLIENT.
+ This should be done in the project management tool. */
+#ifndef UX_PICTBRIDGE_DPSHOST_NO
+#define UX_PICTBRIDGE_DPSHOST
+#endif
+
+#ifndef UX_PICTBRIDGE_DPSCLIENT_NO
+#define UX_PICTBRIDGE_DPSCLIENT
+#endif
+
+#ifdef UX_PICTBRIDGE_DPSHOST
+#include "ux_host_class_pima.h"
+#endif
+
+#ifdef UX_PICTBRIDGE_DPSCLIENT
+#include "ux_device_class_pima.h"
+#endif
+
+
+/* Define PICTBRIDGE main equivalences. */
+
+#define UX_PICTBRIDGE_MAX_FILE_NAME_SIZE 63
+#define UX_PICTBRIDGE_MAX_TAG_SIZE 64
+#define UX_PICTBRIDGE_MAX_ELEMENT_SIZE 128
+#define UX_PICTBRIDGE_MAX_TAG_DEPTH 16
+#define UX_PICTBRIDGE_MAX_VARIABLE_SIZE 128
+#define UX_PICTBRIDGE_MAX_STRING_SIZE 128
+#define UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER 1024
+#define UX_PICTBRIDGE_MAX_EVENT_NUMBER 8
+#define UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE 16
+#define UX_PICTBRIDGE_OBJECT_SCRIPT 0x3002
+#define UX_PICTBRIDGE_THREAD_STACK_SIZE 2048
+#define UX_PICTBRIDGE_THREAD_PRIORITY_CLASS 20
+#define UX_PICTBRIDGE_LEADING_ZERO_ON 1
+#define UX_PICTBRIDGE_LEADING_ZERO_OFF 2
+#define UX_PICTBRIDGE_REQUEST 1
+#define UX_PICTBRIDGE_RESPONSE 2
+#define UX_PICTBRIDGE_ALL_CONTAINERS 0xFFFFFFFF
+
+#define UX_PICTBRIDGE_XML_LEAF ((void*)(ALIGN_TYPE)0xFFFFFFFF)
+#define UX_PICTBRIDGE_EVENT_TIMEOUT (30 * UX_PERIODIC_RATE)
+
+/* Define PICTBRIDGE OBJECT HANDLES. */
+
+#define UX_PICTBRIDGE_OBJECT_HANDLE_HOST_REQUEST 1
+#define UX_PICTBRIDGE_OBJECT_HANDLE_HOST_RESPONSE 1
+#define UX_PICTBRIDGE_OBJECT_HANDLE_CLIENT_REQUEST 2
+#define UX_PICTBRIDGE_OBJECT_HANDLE_PRINT 3
+
+/* Define PICTBRIDGE HOST\CLIENT state machine flags. */
+
+#define UX_PICTBRIDGE_STATE_MACHINE_IDLE 0x00000001
+#define UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING 0x00000002
+#define UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST 0x00000004
+#define UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST_PENDING 0x00000008
+#define UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST 0x00000010
+
+/* Define PICTBRIDGE event flags. */
+
+#define UX_PICTBRIDGE_EVENT_FLAG_CONFIGURE_PRINT_SERVICE 0x00000001
+#define UX_PICTBRIDGE_EVENT_FLAG_CAPABILITY 0x00000002
+#define UX_PICTBRIDGE_EVENT_FLAG_JOB_STATUS 0x00000004
+#define UX_PICTBRIDGE_EVENT_FLAG_DEVICE_STATUS 0x00000008
+#define UX_PICTBRIDGE_EVENT_FLAG_START_JOB 0x00000010
+#define UX_PICTBRIDGE_EVENT_FLAG_ABORT_JOB 0x00000020
+#define UX_PICTBRIDGE_EVENT_FLAG_CONTINUE_JOB 0x00000040
+#define UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_JOB_STATUS 0x00000080
+#define UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_DEVICE_STATUS 0x00000100
+
+#define UX_PICTBRIDGE_EVENT_FLAG_APPLICATION_1 0x00100000
+#define UX_PICTBRIDGE_EVENT_FLAG_APPLICATION_2 0x00200000
+#define UX_PICTBRIDGE_EVENT_FLAG_APPLICATION_3 0x00400000
+#define UX_PICTBRIDGE_EVENT_FLAG_APPLICATION_4 0x00800000
+
+#define UX_PICTBRIDGE_EVENT_FLAG_DISCOVERY 0x00010000
+#define UX_PICTBRIDGE_EVENT_FLAG_ERROR 0x80000000
+#define UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY 0x40000000
+
+/* Define PICTBRIDGE QUALITY API equivalences. */
+
+#define UX_PICTBRIDGE_API_QUALITIES 0x00000001
+#define UX_PICTBRIDGE_API_PAPER_SIZES 0x00000002
+#define UX_PICTBRIDGE_API_PAPER_TYPES 0x00000004
+#define UX_PICTBRIDGE_API_PAPER_TYPES_SIZE 0x00000008
+#define UX_PICTBRIDGE_API_FILE_TYPES 0x00000010
+#define UX_PICTBRIDGE_API_DATE_PRINTS 0x00000020
+#define UX_PICTBRIDGE_API_FILE_NAME_PRINTS 0x00000040
+#define UX_PICTBRIDGE_API_IMAGE_OPTIMIZES 0x00000080
+#define UX_PICTBRIDGE_API_LAYOUTS 0x00000100
+#define UX_PICTBRIDGE_API_LAYOUTS_SIZE 0x00000200
+#define UX_PICTBRIDGE_API_FIXED_SIZES 0x00000400
+#define UX_PICTBRIDGE_API_CROPPINGS 0x00000800
+#define UX_PICTBRIDGE_API_CHAR_REPERTOIRES 0x00001000
+
+/* Define PICTBRIDGE tag characters. */
+
+#define UX_PICTBRIDGE_TAG_CHAR_SPACE 0x20
+#define UX_PICTBRIDGE_TAG_CHAR_START_BRACKET 0x3C
+#define UX_PICTBRIDGE_TAG_CHAR_END_BRACKET 0x3E
+#define UX_PICTBRIDGE_TAG_CHAR_EQUAL 0x3D
+#define UX_PICTBRIDGE_TAG_CHAR_QUOTE 0x22
+#define UX_PICTBRIDGE_TAG_CHAR_CR 0x0d
+#define UX_PICTBRIDGE_TAG_CHAR_LF 0x0a
+#define UX_PICTBRIDGE_TAG_CHAR_SLASH 0x2f
+#define UX_PICTBRIDGE_TAG_CHAR_QUESTION_MARK 0x3f
+
+/* Define PICTBRIDGE tag flags. */
+
+#define UX_PICTBRIDGE_TAG_FLAG_BEGIN 0x00000001
+#define UX_PICTBRIDGE_TAG_FLAG_END 0x00000002
+#define UX_PICTBRIDGE_TAG_FLAG_TRAILING_SPACE 0x00000004
+#define UX_PICTBRIDGE_TAG_FLAG_CLOSING 0x00000008
+#define UX_PICTBRIDGE_TAG_FLAG_SELF_CLOSING 0x00000010
+#define UX_PICTBRIDGE_TAG_FLAG_CHAR_BEGIN 0x00000020
+#define UX_PICTBRIDGE_TAG_FLAG_QUOTE 0x00000040
+#define UX_PICTBRIDGE_TAG_FLAG_COMMENT 0x00000080
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA 0x00000100
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_DECIMAL 0x00000200
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_MAJOR_MINOR 0x00000400
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING 0x00000800
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA 0x00001000
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_DECIMAL 0x00002000
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_MAJOR_MINOR 0x00004000
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_STRING 0x00008000
+#define UX_PICTBRIDGE_TAG_FLAG_FORCE_LF 0x00010000
+#define UX_PICTBRIDGE_TAG_FLAG_IN_TAG 0x00020000
+#define UX_PICTBRIDGE_TAG_FLAG_IN_VARIABLE 0x00040000
+#define UX_PICTBRIDGE_TAG_FLAG_EXPECTING_STRING 0x00080000
+#define UX_PICTBRIDGE_TAG_FLAG_IN_STRING 0x00100000
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_DECIMAL_3DIGITS 0x00200000
+#define UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END 0x00400000
+
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE (UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA | \
+ UX_PICTBRIDGE_TAG_FLAG_VARIABLE_DECIMAL | \
+ UX_PICTBRIDGE_TAG_FLAG_VARIABLE_MAJOR_MINOR | \
+ UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING | \
+ UX_PICTBRIDGE_TAG_FLAG_VARIABLE_DECIMAL_3DIGITS)
+
+#define UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY (UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA | \
+ UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_DECIMAL | \
+ UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_MAJOR_MINOR | \
+ UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_STRING)
+
+/* Define PICTBRIDGE error codes. */
+
+#define UX_PICTBRIDGE_ERROR_UNDEFINED 0x00002000
+#define UX_PICTBRIDGE_ERROR_GENERAL_ERROR 0x00002002
+#define UX_PICTBRIDGE_ERROR_SESSION_NOT_OPEN 0x00002003
+#define UX_PICTBRIDGE_ERROR_INVALID_TRANSACTION_ID 0x00002004
+#define UX_PICTBRIDGE_ERROR_OPERATION_NOT_SUPPORTED 0x00002005
+#define UX_PICTBRIDGE_ERROR_PARAMETER_NOT_SUPPORTED 0x00002006
+#define UX_PICTBRIDGE_ERROR_INCOMPLETE_TRANSFER 0x00002007
+#define UX_PICTBRIDGE_ERROR_INVALID_STORAGE_ID 0x00002008
+#define UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE 0x00002009
+#define UX_PICTBRIDGE_ERROR_DEVICE_PROP_NOT_SUPPORTED 0x0000200A
+#define UX_PICTBRIDGE_ERROR_INVALID_OBJECT_FORMAT_CODE 0x0000200B
+#define UX_PICTBRIDGE_ERROR_STORE_FULL 0x0000200C
+#define UX_PICTBRIDGE_ERROR_OBJECT_WRITE_PROTECTED 0x0000200D
+#define UX_PICTBRIDGE_ERROR_STORE_READ_ONLY 0x0000200E
+#define UX_PICTBRIDGE_ERROR_ACCESS_DENIED 0x0000200F
+#define UX_PICTBRIDGE_ERROR_NO_THUMBNAIL_PRESENT 0x00002010
+#define UX_PICTBRIDGE_ERROR_SELF_TEST_FAILED 0x00002011
+#define UX_PICTBRIDGE_ERROR_PARTIAL_DELETION 0x00002012
+#define UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE 0x00002013
+#define UX_PICTBRIDGE_ERROR_FORMAT_UNSUPPORTED 0x00002014
+#define UX_PICTBRIDGE_ERROR_NO_VALID_OBJECT_INFO 0x00002015
+#define UX_PICTBRIDGE_ERROR_INVALID_CODE_FORMAT 0x00002016
+#define UX_PICTBRIDGE_ERROR_UNKNOWN_VENDOR_CODE 0x00002017
+#define UX_PICTBRIDGE_ERROR_CAPTURE_ALREADY_TERMINATED 0x00002018
+#define UX_PICTBRIDGE_ERROR_DEVICE_BUSY 0x00002019
+#define UX_PICTBRIDGE_ERROR_INVALID_PARENT_OBJECT 0x0000201A
+#define UX_PICTBRIDGE_ERROR_INVALID_DEVICE_PROP_FORMAT 0x0000201B
+#define UX_PICTBRIDGE_ERROR_INVALID_DEVICE_PROP_VALUE 0x0000201C
+#define UX_PICTBRIDGE_ERROR_INVALID_PARAMETER 0x0000201D
+#define UX_PICTBRIDGE_ERROR_SESSION_ALREADY_OPENED 0x0000201E
+#define UX_PICTBRIDGE_ERROR_TRANSACTION_CANCELED 0x0000201F
+#define UX_PICTBRIDGE_ERROR_DESTINATION_UNSUPPORTED 0x00002020
+#define UX_PICTBRIDGE_ERROR_OBJECT_ALREADY_OPENED 0x00002021
+#define UX_PICTBRIDGE_ERROR_OBJECT_ALREADY_CLOSED 0x00002022
+#define UX_PICTBRIDGE_ERROR_OBJECT_NOT_OPENED 0x00002023
+#define UX_PICTBRIDGE_ERROR_NO_DISCOVERY_SCRIPT 0x00002024
+#define UX_PICTBRIDGE_ERROR_SCRIPT_BUFFER_OVERFLOW 0x00002025
+#define UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR 0x00002026
+#define UX_PICTBRIDGE_ERROR_PARAMETER_UNKNOWN 0x00002027
+#define UX_PICTBRIDGE_ERROR_PARAMETER_MISSING 0x00002028
+#define UX_PICTBRIDGE_ERROR_EMPTY_LINE 0x00002029
+
+/* Define Pictbridge Event Codes. */
+
+#define UX_PICTBRIDGE_EC_UNDEFINED 0x00004000
+#define UX_PICTBRIDGE_EC_CANCEL_TRANSACTION 0x00004001
+#define UX_PICTBRIDGE_EC_OBJECT_ADDED 0x00004002
+#define UX_PICTBRIDGE_EC_OBJECT_REMOVED 0x00004003
+#define UX_PICTBRIDGE_EC_STORE_ADDED 0x00004004
+#define UX_PICTBRIDGE_EC_STORE_REMOVED 0x00004005
+#define UX_PICTBRIDGE_EC_DEVICE_PROP_CHANGED 0x00004006
+#define UX_PICTBRIDGE_EC_OBJECT_INFO_CHANGED 0x00004007
+#define UX_PICTBRIDGE_EC_DEVICE_INFO_CHANGED 0x00004008
+#define UX_PICTBRIDGE_EC_REQUEST_OBJECT_TRANSFER 0x00004009
+#define UX_PICTBRIDGE_EC_STORE_FULL 0x0000400A
+#define UX_PICTBRIDGE_EC_DEVICE_RESET 0x0000400B
+#define UX_PICTBRIDGE_EC_STORAGE_INFO_CHANGED 0x0000400C
+#define UX_PICTBRIDGE_EC_CAPTURE_COMPLETE 0x0000400D
+#define UX_PICTBRIDGE_EC_UNREPORTED_STATUS 0x0000400E
+
+/* Define Pictbridge Internal Event Codes. */
+
+#define UX_PICTBRIDGE_EC_START_JOB 0x00004100
+
+/* Define Pictbridge state machine. */
+#define UX_PICTBRIDGE_DPSCLIENT_DISCOVERY_PENDING 0x00000000
+#define UX_PICTBRIDGE_DPSCLIENT_DISCOVERY_COMPLETE 0x00000001
+
+
+/* Define Pictbridge XML Object input\output direction flags. */
+#define UX_PICTBRIDGE_OBJECT_DIRECTION_INPUT 0x00000001
+#define UX_PICTBRIDGE_OBJECT_DIRECTION_OUTPUT 0x00000002
+
+/* Define Pictbridge output request codes. */
+
+#define UX_PICTBRIDGE_OR_CONFIGURE_PRINT_SERVICE 0x00000001
+#define UX_PICTBRIDGE_OR_GET_CAPABILITY 0x00000002
+#define UX_PICTBRIDGE_OR_GET_JOB_STATUS 0x00000003
+#define UX_PICTBRIDGE_OR_GET_DEVICE_STATUS 0x00000004
+#define UX_PICTBRIDGE_OR_START_JOB 0x00000005
+#define UX_PICTBRIDGE_OR_ABORT_JOB 0x00000006
+#define UX_PICTBRIDGE_OR_CONTINUE_JOB 0x00000007
+#define UX_PICTBRIDGE_OR_NOTIFY_JOB_STATUS 0x00000008
+#define UX_PICTBRIDGE_OR_NOTIFY_DEVICE_STATUS 0x00000009
+
+/* Define Pictbridge input request codes. */
+
+#define UX_PICTBRIDGE_IR_CONFIGURE_PRINT_SERVICE 0x00000001
+#define UX_PICTBRIDGE_IR_GET_CAPABILITY 0x00000002
+#define UX_PICTBRIDGE_IR_GET_JOB_STATUS 0x00000003
+#define UX_PICTBRIDGE_IR_GET_DEVICE_STATUS 0x00000004
+#define UX_PICTBRIDGE_IR_START_JOB 0x00000005
+#define UX_PICTBRIDGE_IR_ABORT_JOB 0x00000006
+#define UX_PICTBRIDGE_IR_CONTINUE_JOB 0x00000007
+#define UX_PICTBRIDGE_IR_NOTIFY_JOB_STATUS 0x00000008
+#define UX_PICTBRIDGE_IR_NOTIFY_DEVICE_STATUS 0x00000009
+
+/* Define Pictbridge input request subfunction flags. */
+
+#define UX_PICTBRIDGE_IR_CPS_DPS_VERSIONS 0x00000001
+#define UX_PICTBRIDGE_IR_CPS_VENDOR_NAME 0x00000002
+#define UX_PICTBRIDGE_IR_CPS_VENDOR_SPECIFIC_VERSION 0x00000004
+#define UX_PICTBRIDGE_IR_CPS_PRODUCT_NAME 0x00000008
+#define UX_PICTBRIDGE_IR_CPS_SERIAL_NO 0x00000010
+
+#define UX_PICTBRIDGE_IR_GC_QUALITIES 0x00000001
+#define UX_PICTBRIDGE_IR_GC_PAPER_SIZES 0x00000002
+#define UX_PICTBRIDGE_IR_GC_PAPER_TYPES 0x00000004
+#define UX_PICTBRIDGE_IR_GC_PAPER_TYPES_SIZE 0x00000008
+#define UX_PICTBRIDGE_IR_GC_FILE_TYPES 0x00000010
+#define UX_PICTBRIDGE_IR_GC_DATE_PRINTS 0x00000020
+#define UX_PICTBRIDGE_IR_GC_FILE_NAME_PRINTS 0x00000040
+#define UX_PICTBRIDGE_IR_GC_IMAGE_OPTIMIZES 0x00000080
+#define UX_PICTBRIDGE_IR_GC_LAYOUTS 0x00000100
+#define UX_PICTBRIDGE_IR_GC_LAYOUTS_SIZE 0x00000200
+#define UX_PICTBRIDGE_IR_GC_FIXED_SIZES 0x00000400
+#define UX_PICTBRIDGE_IR_GC_CROPPINGS 0x00000800
+#define UX_PICTBRIDGE_IR_GC_CHAR_REPERTOIRES 0x00001000
+
+#define UX_PICTBRIDGE_IR_SJJC_QUALITY 0x00000001
+#define UX_PICTBRIDGE_IR_SJJC_PAPER_TYPE 0x00000002
+#define UX_PICTBRIDGE_IR_SJJC_PAPER_SIZE 0x00000004
+#define UX_PICTBRIDGE_IR_SJJC_FILE_TYPE 0x00000008
+#define UX_PICTBRIDGE_IR_SJJC_DATE_PRINT 0x00000010
+#define UX_PICTBRIDGE_IR_SJJC_FILE_NAME_PRINT 0x00000020
+#define UX_PICTBRIDGE_IR_SJJC_IMAGE_OPTIMIZE 0x00000040
+#define UX_PICTBRIDGE_IR_SJJC_LAYOUT 0x00000080
+#define UX_PICTBRIDGE_IR_SJJC_FIXED_SIZE 0x00000100
+#define UX_PICTBRIDGE_IR_SJJC_CROPPINGS 0x00000200
+
+#define UX_PICTBRIDGE_IR_SJPI_CROPPING_AREA 0x00000400
+#define UX_PICTBRIDGE_IR_SJPI_FILE_ID 0x00000800
+#define UX_PICTBRIDGE_IR_SJPI_FILE_NAME 0x00001000
+#define UX_PICTBRIDGE_IR_SJPI_DATE 0x00002000
+#define UX_PICTBRIDGE_IR_SJPI_COPIES 0x00004000
+#define UX_PICTBRIDGE_IR_SJPI_PRT_PID 0x00008000
+#define UX_PICTBRIDGE_IR_SJPI_FILE_PATH 0x00010000
+#define UX_PICTBRIDGE_IR_SJPI_COPY_ID 0x00020000
+
+#define UX_PICTBRIDGE_IR_NJS_PRT_PID 0x00000001
+#define UX_PICTBRIDGE_IR_NJS_FILE_PATH 0x00000002
+#define UX_PICTBRIDGE_IR_NJS_COPY_ID 0x00000004
+#define UX_PICTBRIDGE_IR_NJS_PROGRESS 0x00000008
+#define UX_PICTBRIDGE_IR_NJS_IMAGES_PRINTED 0x00000010
+
+
+/* Define parameter format masks. */
+#define UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK 0xFFFF0000
+#define UX_PICTBRIDGE_PARAMETER_MINOR_CODE_MASK 0x0000FFFF
+#define UX_PICTBRIDGE_ERROR_REASON_MINOR_CODE_MASK 0x0000FF00
+#define UX_PICTBRIDGE_ERROR_REASON_DETAIL_CODE_MASK 0x000000FF
+
+/* Define Pictbridge Qualities Codes. */
+
+#define UX_PICTBRIDGE_QUALITIES_DEFAULT 0x50000000
+#define UX_PICTBRIDGE_QUALITIES_NORMAL 0x50010000
+#define UX_PICTBRIDGE_QUALITIES_DRAFT 0x50020000
+#define UX_PICTBRIDGE_QUALITIES_FINE 0x50030000
+
+/* Define Pictbridge PaperSizes Codes. */
+
+#define UX_PICTBRIDGE_PAPER_SIZES_DEFAULT 0x51000000
+#define UX_PICTBRIDGE_PAPER_SIZES_L 0x51010000
+#define UX_PICTBRIDGE_PAPER_SIZES_2L 0x51020000
+#define UX_PICTBRIDGE_PAPER_SIZES_HAGAKI_POSTCARD 0x51030000
+#define UX_PICTBRIDGE_PAPER_SIZES_CARD_SIZE 0x51040000
+#define UX_PICTBRIDGE_PAPER_SIZES_100X150 0x51050000
+#define UX_PICTBRIDGE_PAPER_SIZES_4IX6I 0x51060000
+#define UX_PICTBRIDGE_PAPER_SIZES_8IX10I 0x51070000
+#define UX_PICTBRIDGE_PAPER_SIZES_LETTER 0x51080000
+#define UX_PICTBRIDGE_PAPER_SIZES_11IX17I 0x510A0000
+
+/* Define Pictbridge PaperTypes Codes. */
+
+#define UX_PICTBRIDGE_PAPER_TYPES_DEFAULT 0x52000000
+#define UX_PICTBRIDGE_PAPER_TYPES_PLAIN 0x52010000
+#define UX_PICTBRIDGE_PAPER_TYPES_PHOTO 0x52020000
+#define UX_PICTBRIDGE_PAPER_TYPES_FAST_PHOTO 0x52030000
+
+/* Define Pictbridge FileTypes Codes. */
+
+#define UX_PICTBRIDGE_FILE_TYPES_DEFAULT 0x53000000
+#define UX_PICTBRIDGE_FILE_TYPES_EXIF_JPEG 0x53010000
+#define UX_PICTBRIDGE_FILE_TYPES_OTHER_EXIF 0x53020000
+#define UX_PICTBRIDGE_FILE_TYPES_JPEG 0x53030000
+#define UX_PICTBRIDGE_FILE_TYPES_TIFF_EP 0x53040000
+#define UX_PICTBRIDGE_FILE_TYPES_FLASHPIX 0x53050000
+#define UX_PICTBRIDGE_FILE_TYPES_BMP 0x53060000
+#define UX_PICTBRIDGE_FILE_TYPES_CIFF 0x53070000
+#define UX_PICTBRIDGE_FILE_TYPES_GIF 0x53080000
+#define UX_PICTBRIDGE_FILE_TYPES_JFIF 0x53090000
+#define UX_PICTBRIDGE_FILE_TYPES_PCD 0x530A0000
+#define UX_PICTBRIDGE_FILE_TYPES_PICT 0x530B0000
+#define UX_PICTBRIDGE_FILE_TYPES_PNG 0x530C0000
+#define UX_PICTBRIDGE_FILE_TYPES_TIFF 0x530D0000
+#define UX_PICTBRIDGE_FILE_TYPES_TIFF_IT 0x530E0000
+#define UX_PICTBRIDGE_FILE_TYPES_JP2 0x530F0000
+#define UX_PICTBRIDGE_FILE_TYPES_JPX 0x53110000
+#define UX_PICTBRIDGE_FILE_TYPES_UNDEFINED 0x53120000
+#define UX_PICTBRIDGE_FILE_TYPES_ASSOCIATION 0x53130000
+#define UX_PICTBRIDGE_FILE_TYPES_SCRIPT 0x53140000
+#define UX_PICTBRIDGE_FILE_TYPES_EXECUTABLE 0x53150000
+#define UX_PICTBRIDGE_FILE_TYPES_TEXT 0x53160000
+#define UX_PICTBRIDGE_FILE_TYPES_HTML 0x53170000
+#define UX_PICTBRIDGE_FILE_TYPES_DPOF 0x53180000
+#define UX_PICTBRIDGE_FILE_TYPES_AIFF 0x53190000
+#define UX_PICTBRIDGE_FILE_TYPES_WAV 0x531A0000
+#define UX_PICTBRIDGE_FILE_TYPES_MP3 0x531B0000
+#define UX_PICTBRIDGE_FILE_TYPES_AVI 0x531C0000
+#define UX_PICTBRIDGE_FILE_TYPES_MPEG 0x531D0000
+#define UX_PICTBRIDGE_FILE_TYPES_ASF 0x531E0000
+
+/* Define Pictbridge action result codes. */
+
+#define UX_PICTBRIDGE_ACTION_RESULT_OK 0x10000000
+#define UX_PICTBRIDGE_ACTION_RESULT_NOT_EXECUTED 0x10010000
+#define UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_DEFAULT 0x10020000
+#define UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_UP 0x10020001
+#define UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_IP 0x10020002
+#define UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_MP 0x10020003
+#define UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_BO 0x10020004
+#define UX_PICTBRIDGE_ACTION_RESULT_NOT_RECOGNIZED 0x10030000
+
+/* Define Pictbridge DatePrints Codes. */
+
+#define UX_PICTBRIDGE_DATE_PRINTS_DEFAULT 0x54000000
+#define UX_PICTBRIDGE_DATE_PRINTS_OFF 0x54010000
+#define UX_PICTBRIDGE_DATE_PRINTS_ON 0x54020000
+
+/* Define Pictbridge FileNamePrints Codes. */
+
+#define UX_PICTBRIDGE_FILE_NAME_PRINTS_DEFAULT 0x55000000
+#define UX_PICTBRIDGE_FILE_NAME_PRINTS_OFF 0x55010000
+#define UX_PICTBRIDGE_FILE_NAME_PRINTS_ON 0x55020000
+
+/* Define Pictbridge ImageOptimizes Codes. */
+
+#define UX_PICTBRIDGE_IMAGE_OPTIMIZES_DEFAULT 0x56000000
+#define UX_PICTBRIDGE_IMAGE_OPTIMIZES_OFF 0x56010000
+#define UX_PICTBRIDGE_IMAGE_OPTIMIZES_ON 0x56020000
+
+/* Define Pictbridge Layouts Codes. */
+
+#define UX_PICTBRIDGE_LAYOUTS_DEFAULT 0x57000000
+#define UX_PICTBRIDGE_LAYOUTS_1_UP_BORDER 0x57010000
+#define UX_PICTBRIDGE_LAYOUTS_1_UP_LAYOUT 0x57020000
+#define UX_PICTBRIDGE_LAYOUTS_2_UP_LAYOUT 0x57030000
+#define UX_PICTBRIDGE_LAYOUTS_3_UP_LAYOUT 0x57040000
+#define UX_PICTBRIDGE_LAYOUTS_4_UP_LAYOUT 0x57050000
+#define UX_PICTBRIDGE_LAYOUTS_5_UP_LAYOUT 0x57060000
+#define UX_PICTBRIDGE_LAYOUTS_6_UP_LAYOUT 0x57070000
+#define UX_PICTBRIDGE_LAYOUTS_7_UP_LAYOUT 0x57080000
+#define UX_PICTBRIDGE_LAYOUTS_8_UP_LAYOUT 0x57090000
+#define UX_PICTBRIDGE_LAYOUTS_INDEX_PRINT 0x57FE0000
+#define UX_PICTBRIDGE_LAYOUTS_1_UP_BORDERLESS 0x57FF0000
+
+/* Define Pictbridge FixedSizes Codes. */
+
+#define UX_PICTBRIDGE_FIXED_SIZE_DEFAULT 0x58000000
+#define UX_PICTBRIDGE_FIXED_SIZE_2IX3I 0x58010000
+#define UX_PICTBRIDGE_FIXED_SIZE_35IX5I 0x58020000
+#define UX_PICTBRIDGE_FIXED_SIZE_4IX6I 0x58030000
+#define UX_PICTBRIDGE_FIXED_SIZE_5IX7I 0x58040000
+#define UX_PICTBRIDGE_FIXED_SIZE_8IX10I 0x58050000
+#define UX_PICTBRIDGE_FIXED_SIZE_254MMX178MM 0x58060000
+#define UX_PICTBRIDGE_FIXED_SIZE_110MMX74MM 0x58070000
+#define UX_PICTBRIDGE_FIXED_SIZE_6CMX8CM 0x58080000
+#define UX_PICTBRIDGE_FIXED_SIZE_7CMX10CM 0x58090000
+#define UX_PICTBRIDGE_FIXED_SIZE_9CMX13CM 0x580A0000
+#define UX_PICTBRIDGE_FIXED_SIZE_10CMX13CM 0x580B0000
+#define UX_PICTBRIDGE_FIXED_SIZE_15CMX21CM 0x580C0000
+#define UX_PICTBRIDGE_FIXED_SIZE_18CMX24CM 0x580D0000
+#define UX_PICTBRIDGE_FIXED_SIZE_A4 0x580E0000
+#define UX_PICTBRIDGE_FIXED_SIZE_LETTER 0x580F0000
+
+/* Define Pictbridge Croppings Codes. */
+
+#define UX_PICTBRIDGE_CROPPINGS_DEFAULT 0x59000000
+#define UX_PICTBRIDGE_CROPPINGS_OFF 0x59010000
+#define UX_PICTBRIDGE_CROPPINGS_ON 0x59020000
+
+/* Define Pictbridge Abort Style Codes. */
+
+#define UX_PICTBRIDGE_ABORT_STYLE_IMMEDIATELY 0x90000000
+#define UX_PICTBRIDGE_ABORT_STYLE_AFTER_CURRENT_PAGE 0x90010000
+
+/* Define Pictbridge Print Service Status Codes. */
+
+#define UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_ACTIVE 0x70000000
+#define UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE 0x70010000
+#define UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_PAUSED 0x70020000
+
+/* Define Pictbridge Print Service Status Codes. */
+
+#define UX_PICTBRIDGE_JOB_END_REASON_NOT_ENDED 0x71000000
+#define UX_PICTBRIDGE_JOB_END_REASON_NORMAL 0x71010000
+#define UX_PICTBRIDGE_JOB_END_REASON_ABORTED_9000000 0x71020000
+#define UX_PICTBRIDGE_JOB_END_REASON_ABORTED_9001000 0x71030000
+#define UX_PICTBRIDGE_JOB_END_REASON_ABORTED_OTHER 0x71040000
+
+/* Define Pictbridge Error Status Codes. */
+
+#define UX_PICTBRIDGE_ERROR_STATUS_NO_ERROR 0x72000000
+#define UX_PICTBRIDGE_ERROR_STATUS_WARNING 0x72010000
+#define UX_PICTBRIDGE_ERROR_STATUS_FATAL 0x72020000
+
+/* Define Pictbridge Error REASON Status Codes. */
+
+#define UX_PICTBRIDGE_ERROR_REASON_NO_REASON 0x73000000
+#define UX_PICTBRIDGE_ERROR_REASON_PAPER_RELATED 0x73010000
+#define UX_PICTBRIDGE_ERROR_REASON_INK_RELATED 0x73020000
+#define UX_PICTBRIDGE_ERROR_REASON_HARDWARE_RELATED 0x73030000
+#define UX_PICTBRIDGE_ERROR_REASON_FILE_RELATED 0x73040000
+
+/* Define Pictbridge Disconnect Enable Status Codes. */
+
+#define UX_PICTBRIDGE_DISCONNECT_ENABLE_FALSE 0x74000000
+#define UX_PICTBRIDGE_DISCONNECT_ENABLE_TRUE 0x74010000
+
+/* Define Pictbridge Capability Changed Status Codes. */
+
+#define UX_PICTBRIDGE_CAPABILITY_CHANGED_FALSE 0x75000000
+#define UX_PICTBRIDGE_CAPABILITY_CHANGED_TRUE 0x75010000
+
+/* Define Pictbridge New Job Status Codes. */
+
+#define UX_PICTBRIDGE_NEW_JOB_FALSE 0x76000000
+#define UX_PICTBRIDGE_NEW_JOB_TRUE 0x76010000
+
+/* Define Pictbridge Print Info structure. */
+typedef struct UX_PICTBRIDGE_PRINTINFO_STRUCT
+{
+
+ struct UX_PICTBRIDGE_PRINTINFO_STRUCT *ux_pictbridge_printinfo_next;
+ ULONG ux_pictbridge_printinfo_croppingarea_xcoordinate;
+ ULONG ux_pictbridge_printinfo_croppingarea_ycoordinate;
+ ULONG ux_pictbridge_printinfo_croppingarea_width;
+ ULONG ux_pictbridge_printinfo_croppingarea_height;
+ ULONG ux_pictbridge_printinfo_fileid;
+ UCHAR ux_pictbridge_printinfo_filename[UX_PICTBRIDGE_MAX_STRING_SIZE];
+ UCHAR ux_pictbridge_printinfo_date[UX_PICTBRIDGE_MAX_STRING_SIZE];
+ ULONG ux_pictbridge_printinfo_copies;
+ ULONG ux_pictbridge_printinfo_prtpid;
+ UCHAR ux_pictbridge_printinfo_filepath[UX_PICTBRIDGE_MAX_STRING_SIZE];
+ ULONG ux_pictbridge_printinfo_copyid;
+ ULONG ux_pictbridge_printinfo_current_page;
+ ULONG ux_pictbridge_printinfo_total_page;
+ ULONG ux_pictbridge_printinfo_images_printed;
+} UX_PICTBRIDGE_PRINTINFO;
+
+/* Define Pictbridge Job Info structure. */
+typedef struct UX_PICTBRIDGE_JOBINFO_STRUCT
+{
+
+ ULONG ux_pictbridge_jobinfo_status;
+ ULONG ux_pictbridge_jobinfo_quality;
+ ULONG ux_pictbridge_jobinfo_papertype;
+ ULONG ux_pictbridge_jobinfo_papersize;
+ ULONG ux_pictbridge_jobinfo_filetype;
+ ULONG ux_pictbridge_jobinfo_dateprint;
+ ULONG ux_pictbridge_jobinfo_filenameprint;
+ ULONG ux_pictbridge_jobinfo_imageoptimize;
+ ULONG ux_pictbridge_jobinfo_layout;
+ ULONG ux_pictbridge_jobinfo_fixedsize;
+ ULONG ux_pictbridge_jobinfo_cropping;
+ ULONG ux_pictbridge_jobinfo_abort_style;
+ VOID *ux_pictbridge_jobinfo_object;
+ UINT (*ux_pictbridge_jobinfo_object_data_read)(struct UX_PICTBRIDGE_STRUCT *pictbridge, ULONG object_handle, UCHAR *buffer, ULONG offset, ULONG length, ULONG *actual_length);
+ UINT (*ux_pictbridge_jobinfo_object_info_get) (struct UX_SLAVE_CLASS_PIMA_STRUCT *pima, ULONG object_handle, UX_SLAVE_CLASS_PIMA_OBJECT **object);
+ struct UX_PICTBRIDGE_PRINTINFO_STRUCT *ux_pictbridge_jobinfo_printinfo_start;
+ struct UX_PICTBRIDGE_PRINTINFO_STRUCT *ux_pictbridge_jobinfo_printinfo_current;
+} UX_PICTBRIDGE_JOBINFO;
+
+/* Define Pictbridge Device Info structure. */
+typedef struct UX_PICTBRIDGE_DEVINFO_STRUCT
+{
+
+ UCHAR ux_pictbridge_devinfo_vendor_name[UX_PICTBRIDGE_MAX_STRING_SIZE];
+ UCHAR ux_pictbridge_devinfo_product_name[UX_PICTBRIDGE_MAX_STRING_SIZE];
+ UCHAR ux_pictbridge_devinfo_serial_no[UX_PICTBRIDGE_MAX_STRING_SIZE];
+ ULONG ux_pictbridge_devinfo_dpsversions[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_vendor_specific_version;
+ ULONG ux_pictbridge_devinfo_print_service_available;
+ ULONG ux_pictbridge_devinfo_qualities[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_papersizes[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_papertypes[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_papertypes_papersize;
+ ULONG ux_pictbridge_devinfo_filetypes[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_dateprints[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_filenameprints[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_imageoptimizes[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_layouts[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_layouts_papersize;
+ ULONG ux_pictbridge_devinfo_fixedsizes[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_croppings[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_charrepertoires[UX_PICTBRIDGE_MAX_DEVINFO_ARRAY_SIZE];
+ ULONG ux_pictbridge_devinfo_dpsprintservicestatus;
+ ULONG ux_pictbridge_devinfo_jobendreason;
+ ULONG ux_pictbridge_devinfo_errorstatus;
+ ULONG ux_pictbridge_devinfo_errorreason;
+ ULONG ux_pictbridge_devinfo_disconnectenable;
+ ULONG ux_pictbridge_devinfo_capabilitychanged;
+ ULONG ux_pictbridge_devinfo_newjobok;
+ ULONG ux_pictbridge_devinfo_storage_size;
+
+} UX_PICTBRIDGE_DEVINFO;
+
+
+/* Define Pictbridge event structure. */
+typedef struct UX_PICTBRIDGE_EVENT_STRUCT
+{
+ ULONG ux_pictbridge_event_code;
+ ULONG ux_pictbridge_event_parameter_1;
+ ULONG ux_pictbridge_event_parameter_2;
+ ULONG ux_pictbridge_event_parameter_3;
+
+} UX_PICTBRIDGE_EVENT;
+
+/* Define Pictbridge structure. */
+typedef struct UX_PICTBRIDGE_STRUCT
+{
+
+ VOID *ux_pictbridge_pima;
+ ULONG ux_pictbridge_storage_ids[64];
+ ULONG ux_pictbridge_object_handles_array[64];
+ UX_PICTBRIDGE_EVENT ux_pictbridge_event_array[UX_PICTBRIDGE_MAX_EVENT_NUMBER];
+ UX_PICTBRIDGE_EVENT *ux_pictbridge_event_array_head;
+ UX_PICTBRIDGE_EVENT *ux_pictbridge_event_array_tail;
+ UX_PICTBRIDGE_EVENT *ux_pictbridge_event_array_end;
+ TX_SEMAPHORE ux_pictbridge_notification_semaphore;
+ UCHAR *ux_pictbridge_thread_stack;
+ TX_THREAD ux_pictbridge_thread;
+ TX_EVENT_FLAGS_GROUP ux_pictbridge_event_flags_group;
+ ULONG ux_pictbridge_operation_result;
+ ULONG ux_pictbridge_output_result;
+ ULONG ux_pictbridge_xml_report_direction;
+ ULONG ux_pictbridge_request_response;
+ ULONG ux_pictbridge_input_tags;
+ ULONG ux_pictbridge_input_request;
+ ULONG ux_pictbridge_discovery_state;
+ ULONG ux_pictbridge_host_client_state_machine;
+ UX_PICTBRIDGE_DEVINFO ux_pictbridge_dpslocal;
+ UX_PICTBRIDGE_DEVINFO ux_pictbridge_dpsclient;
+ UX_PICTBRIDGE_JOBINFO ux_pictbridge_jobinfo;
+ VOID *ux_pictbridge_storage;
+ VOID *ux_pictbridge_object_host;
+ VOID *ux_pictbridge_object_client;
+ VOID *ux_pictbridge_session;
+ VOID *ux_pictbridge_device;
+ UINT (*ux_pictbridge_application_object_data_write)(struct UX_PICTBRIDGE_STRUCT *pictbridge, UCHAR *buffer, ULONG offset, ULONG total_length, ULONG length);
+#ifdef UX_PICTBRIDGE_DPSCLIENT
+ UX_SLAVE_CLASS_PIMA_PARAMETER ux_pictbridge_pima_parameter;
+ UINT (*ux_pictbridge_dps_event_callback_function)(struct UX_PICTBRIDGE_STRUCT *pictbridge, UINT event_flag);
+#endif
+
+} UX_PICTBRIDGE;
+
+/* Define PICTBRIDGE XML Item structure. */
+
+typedef struct UX_PICTBRIDGE_XML_ITEM_STRUCT
+{
+ UCHAR ux_pictbridge_xml_item_tag_name[UX_PICTBRIDGE_MAX_TAG_SIZE];
+ ULONG ux_pictbridge_xml_item_tag_code;
+ struct UX_PICTBRIDGE_XML_ITEM_STRUCT *ux_pictbridge_xml_item_child;
+ struct UX_PICTBRIDGE_XML_ITEM_STRUCT *ux_pictbridge_xml_item_parent;
+ UINT (*ux_pictbridge_xml_item_function)(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+} UX_PICTBRIDGE_XML_ITEM;
+
+
+
+
+
+UINT _ux_pictbridge_xml_function_root_xml(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_root_dps(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_root_input(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_root_output(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_null(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_getcapability_capability_layouts(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_getcapability_capability_papertypes(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_quality(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_papersize(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_papertype(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_filetype(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_dateprint(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_filenameprint(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_imageoptimize(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_layout(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_fixedsize(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_cropping(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_croppingarea(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_fileid(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_filename(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_date(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_copies(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_prtpid(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_filepath(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_copyid(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_dpsprintservicestatus(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_errorstatus(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_errorreason(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_disconnectenable(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_newjobok(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_result(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_qualities(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_papersizes(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_filetypes(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_dateprints(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_filenameprints(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_imageoptimizes(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_fixedsizes(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_croppings(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_papertypes(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_layouts(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_dpsprintservicestatus(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_jobendreason(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_errorstatus(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_errorreason(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_disconnectenable(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_capabilitychanged(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_newjobok(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter);
+
+/* Remapping of pictbridge functions that point to a NULL function.. */
+
+#define _ux_pictbridge_xml_function_input_getfilelist_filetype _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getfilelist_parentfileid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getfilelist_maxnumids _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfilelist_fileids _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfilelist_numids _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getpartialfile_fileid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getpartialfile_offset _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getpartialfile_maxsize _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getpartialfile_bytesread _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getfile_fileid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfile_bytesread _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getthumb_fileid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getthumb_bytesread _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getfileid_fileid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfileinfo_filetype _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfileinfo_filesize _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfileinfo_thumbformat _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfileinfo_thumbsize _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getfileid_basepathid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getfileid_filepath _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfileid_basepathid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getfileid_filepath _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_notifydevicestatus _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_notifyjobstatus _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_notifyjobstatus_prtpid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_notifyjobstatus_filepath _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_notifyjobstatus_copyid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_notifyjobstatus_progress _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_notifyjobstatus_imagesprinted _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getdevicestatus _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_abortjob _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getjobstatus_prtpid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getjobstatus_filepath _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getjobstatus_copyid _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getjobstatus_progress _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getjobstatus_imagesprinted _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_printserviceavailable _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_dpsversion _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_vendorname _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_vendorspecificversion _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_productname _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_serialno _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_startjob _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_abortjob _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_continuejob _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_notifyjobstatus _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_notifydevicestatus _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getcapability_capability _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_qualities _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_papersizes _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_filetypes _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_dateprints _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_filenameprints _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_imageoptimizes _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_fixedsizes _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_croppings _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getcapability_capability_charrepertoires _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_getjobstatus _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_continuejob _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_dpsversion _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_vendorname _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_vendorspecificversion _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_productname _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_input_serialno _ux_pictbridge_xml_function_null
+#define _ux_pictbridge_xml_function_output_getcapability_capability_charrepertoires _ux_pictbridge_xml_function_null
+
+#ifdef UX_PICTBRIDGE_DPSCLIENT
+
+VOID _ux_pictbridge_dpsclient_thread(ULONG parameter);
+UINT _ux_pictbridge_dpsclient_object_data_get(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle, UCHAR *object_buffer, ULONG object_offset,
+ ULONG object_length_requested, ULONG *object_actual_length);
+UINT _ux_pictbridge_dpsclient_object_data_send(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle, ULONG phase,
+ UCHAR *object_buffer, ULONG object_offset,
+ ULONG object_length);
+UINT _ux_pictbridge_dpsclient_object_number_get(UX_SLAVE_CLASS_PIMA *pima, ULONG object_format_code, ULONG object_association, ULONG *number_objects);
+UINT _ux_pictbridge_dpsclient_object_info_get(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle,
+ UX_SLAVE_CLASS_PIMA_OBJECT **object);
+UINT _ux_pictbridge_dpsclient_object_info_send(UX_SLAVE_CLASS_PIMA *pima, UX_SLAVE_CLASS_PIMA_OBJECT *object,
+ ULONG storage_id, ULONG parent_object_handle, ULONG *object_handle);
+UINT _ux_pictbridge_dpsclient_object_delete(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle);
+UINT _ux_pictbridge_dpsclient_object_handles_get(UX_SLAVE_CLASS_PIMA *pima,
+ ULONG object_handles_format_code,
+ ULONG object_handles_association,
+ ULONG *object_handles_array,
+ ULONG object_handles_max_number);
+UINT _ux_pictbridge_dpsclient_input_object_prepare(UX_PICTBRIDGE *pictbridge,
+ ULONG input_function,
+ ULONG input_subfunction,
+ ULONG input_parameter);
+UINT _ux_pictbridge_dpsclient_input_object_configure_print_service(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated);
+UINT _ux_pictbridge_dpsclient_input_object_get_capability(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);
+UINT _ux_pictbridge_dpsclient_input_object_startjob(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);
+UINT _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);
+UINT _ux_pictbridge_dpsclient_input_object_continuejob(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);
+UINT _ux_pictbridge_dpsclient_start(UX_PICTBRIDGE *pictbridge);
+UINT _ux_pictbridge_dpsclient_api_configure_print_service(UX_PICTBRIDGE *pictbridge);
+UINT _ux_pictbridge_dpsclient_api_capability(UX_PICTBRIDGE *pictbridge, ULONG capability_code,
+ ULONG capability_parameter);
+UINT _ux_pictbridge_dpsclient_api_device_status(UX_PICTBRIDGE *pictbridge);
+UINT _ux_pictbridge_dpsclient_api_start_job(UX_PICTBRIDGE *pictbridge);
+UINT _ux_pictbridge_dpsclient_api_abort_job(UX_PICTBRIDGE *pictbridge);
+UINT _ux_pictbridge_dpsclient_api_continue_job(UX_PICTBRIDGE *pictbridge);
+UINT _ux_pictbridge_dpsclient_register_event_callback_function(UX_PICTBRIDGE *pictbridge,
+ UINT (*event_callback_function)(struct UX_PICTBRIDGE_STRUCT *pictbridge, UINT event_flag));
+
+
+/* Define Pictbridge Client API prototypes. */
+
+#define ux_pictbridge_dpsclient_object_data_get _ux_pictbridge_dpsclient_object_data_get
+#define ux_pictbridge_dpsclient_object_data_send _ux_pictbridge_dpsclient_object_data_send
+#define ux_pictbridge_dpsclient_object_number_get _ux_pictbridge_dpsclient_object_number_get
+#define ux_pictbridge_dpsclient_object_info_get _ux_pictbridge_dpsclient_object_info_get
+#define ux_pictbridge_dpsclient_object_info_send _ux_pictbridge_dpsclient_object_info_send
+#define ux_pictbridge_dpsclient_object_delete _ux_pictbridge_dpsclient_object_delete
+#define ux_pictbridge_dpsclient_object_handles_get _ux_pictbridge_dpsclient_object_handles_get
+#define ux_pictbridge_dpsclient_input_object_prepare _ux_pictbridge_dpsclient_input_object_prepare
+#define ux_pictbridge_dpsclient_input_object_configure_print_service _ux_pictbridge_dpsclient_input_object_configure_print_service
+#define ux_pictbridge_dpsclient_input_object_get_capability _ux_pictbridge_dpsclient_input_object_get_capability
+#define ux_pictbridge_dpsclient_input_object_startjob _ux_pictbridge_dpsclient_input_object_startjob
+#define ux_pictbridge_dpsclient_input_object_abortjob _ux_pictbridge_dpsclient_input_object_abortjob
+#define ux_pictbridge_dpsclient_input_object_continuejob _ux_pictbridge_dpsclient_input_object_continuejob
+#define ux_pictbridge_dpsclient_start _ux_pictbridge_dpsclient_start
+#define ux_pictbridge_dpsclient_api_configure_print_service _ux_pictbridge_dpsclient_api_configure_print_service
+#define ux_pictbridge_dpsclient_api_capability _ux_pictbridge_dpsclient_api_capability
+#define ux_pictbridge_dpsclient_api_device_status _ux_pictbridge_dpsclient_api_device_status
+#define ux_pictbridge_dpsclient_api_start_job _ux_pictbridge_dpsclient_api_start_job
+#define ux_pictbridge_dpsclient_api_abort_job _ux_pictbridge_dpsclient_api_abort_job
+#define ux_pictbridge_dpsclient_api_continue_job _ux_pictbridge_dpsclient_api_continue_job
+#define ux_pictbridge_dpsclient_register_event_callback_function _ux_pictbridge_dpsclient_register_event_callback_function
+
+
+#endif
+#ifdef UX_PICTBRIDGE_DPSHOST
+UINT _ux_pictbridge_dpshost_start(UX_PICTBRIDGE *pictbridge, UX_HOST_CLASS_PIMA *pima);
+UINT _ux_pictbridge_dpshost_startjob(UX_PICTBRIDGE *pictbridge);
+VOID _ux_pictbridge_dpshost_thread(ULONG parameter);
+VOID _ux_pictbridge_dpshost_notification_callback(UX_HOST_CLASS_PIMA_EVENT *pima_event);
+UINT _ux_pictbridge_dpshost_object_get(UX_PICTBRIDGE *pictbridge, ULONG object_handle);
+UINT _ux_pictbridge_dpshost_response_get(UX_PICTBRIDGE *pictbridge);
+UINT _ux_pictbridge_dpshost_input_object_send(UX_PICTBRIDGE *pictbridge, ULONG input_function);
+UINT _ux_pictbridge_dpshost_output_object_create(UX_PICTBRIDGE *pictbridge);
+UINT _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);
+
+UINT _ux_pictbridge_dpshost_input_object_notify_job_status(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated);
+
+UINT _ux_pictbridge_dpshost_input_object_notify_device_status(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated);
+
+UINT _ux_pictbridge_dpshost_output_object_get_capability(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated);
+
+UINT _ux_pictbridge_dpshost_output_object_get_device_status(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated);
+
+/* Define Pictbridge Client API prototypes. */
+
+#endif
+
+/* Define the XML schema root prototype. */
+extern UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_root[];
+
+/* Define pictbridge permanent function. */
+UINT _ux_pictbridge_object_parse(UX_PICTBRIDGE *pictbridge, UCHAR *xml_object_buffer,
+ ULONG xml_object_length);
+UINT _ux_pictbridge_array_element_to_array_hexa(UCHAR *element, ULONG *hexa_array);
+UINT _ux_pictbridge_element_to_decimal(UCHAR *element, ULONG *decimal_value);
+UINT _ux_pictbridge_element_to_hexa(UCHAR *element, ULONG *hexa_value);
+UINT _ux_pictbridge_hexa_to_element(ULONG hexa_value, UCHAR *element);
+UINT _ux_pictbridge_tag_name_get(UCHAR *input_buffer, ULONG input_length,
+ UCHAR *tag_name,
+ UCHAR *variable_name,
+ UCHAR *variable_string,
+ UCHAR *xml_parameter,
+ UCHAR **output_buffer, ULONG *output_length,
+ ULONG *tag_flag);
+UINT _ux_pictbridge_tag_name_scan(UX_PICTBRIDGE_XML_ITEM *tag_item,
+ UCHAR *tag_name,
+ UX_PICTBRIDGE_XML_ITEM **tag_entry);
+UINT _ux_pictbridge_hexa_to_major_minor(ULONG hexa_value, UCHAR *output_buffer);
+UINT _ux_pictbridge_hexa_to_decimal_string(ULONG hexa_value, UCHAR *decimal_string,
+ ULONG leading_zero_flag, ULONG max_digit_string_size);
+UINT _ux_pictbridge_object_tag_line_add(UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR *tag_element_string,
+ ULONG tag_flag,
+ UCHAR *tag_variable,
+ ULONG tag_variable_value,
+ VOID *tag_element,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated);
+
+UINT _ux_pictbridge_input_object_create(UX_PICTBRIDGE *pictbridge, ULONG input_function);
+
+
+
+/* Define external strings and xml tag lines. */
+extern UCHAR _ux_pictbridge_volume_description[];
+extern UCHAR _ux_pictbridge_volume_label[];
+extern UCHAR _ux_pictbridge_ddiscovery_name[];
+extern UCHAR _ux_pictbridge_hdiscovery_name[];
+extern UCHAR _ux_pictbridge_hrequest_name[];
+extern UCHAR _ux_pictbridge_hrsponse_name[];
+extern UCHAR _ux_pictbridge_drequest_name[];
+extern UCHAR _ux_pictbridge_drsponse_name[];
+extern UCHAR _ux_pictbridge_xml_tag_line_xmlversion[];
+extern UCHAR _ux_pictbridge_xml_tag_line_dpsxmlns[];
+extern UCHAR _ux_pictbridge_xml_tag_line_dps[];
+extern UCHAR _ux_pictbridge_xml_tag_line_output[];
+extern UCHAR _ux_pictbridge_xml_tag_line_input[];
+extern UCHAR _ux_pictbridge_xml_tag_line_result[];
+extern UCHAR _ux_pictbridge_xml_tag_line_configureprintservice[];
+extern UCHAR _ux_pictbridge_xml_tag_line_printserviceavailable[];
+extern UCHAR _ux_pictbridge_xml_tag_line_dpsversions[];
+extern UCHAR _ux_pictbridge_xml_tag_line_vendorname[];
+extern UCHAR _ux_pictbridge_xml_tag_line_vendorspecificversion[];
+extern UCHAR _ux_pictbridge_xml_tag_line_productname[];
+extern UCHAR _ux_pictbridge_xml_tag_line_serialno[];
+extern UCHAR _ux_pictbridge_xml_tag_line_capability[];
+extern UCHAR _ux_pictbridge_xml_tag_line_getcapability[];
+extern UCHAR _ux_pictbridge_xml_tag_line_qualities[];
+extern UCHAR _ux_pictbridge_xml_tag_line_papersizes[];
+extern UCHAR _ux_pictbridge_xml_tag_line_papertypes[];
+extern UCHAR _ux_pictbridge_xml_tag_line_filetypes[];
+extern UCHAR _ux_pictbridge_xml_tag_line_dateprints[];
+extern UCHAR _ux_pictbridge_xml_tag_line_filenameprints[];
+extern UCHAR _ux_pictbridge_xml_tag_line_imageoptimizes[];
+extern UCHAR _ux_pictbridge_xml_tag_line_layouts[];
+extern UCHAR _ux_pictbridge_xml_tag_line_fixedsizes[];
+extern UCHAR _ux_pictbridge_xml_tag_line_croppings[];
+extern UCHAR _ux_pictbridge_xml_tag_line_charrepertoires[];
+extern UCHAR _ux_pictbridge_xml_variable_papersize[];
+extern UCHAR _ux_pictbridge_xml_variable_version[];
+extern UCHAR _ux_pictbridge_xml_variable_xmlns[];
+extern UCHAR _ux_pictbridge_xml_string_xmlns[];
+extern UCHAR _ux_pictbridge_xml_tag_line_getdevicestatus[];
+extern UCHAR _ux_pictbridge_xml_tag_line_dpsprintservicestatus[];
+extern UCHAR _ux_pictbridge_xml_tag_line_jobendreason[];
+extern UCHAR _ux_pictbridge_xml_tag_line_errorstatus[];
+extern UCHAR _ux_pictbridge_xml_tag_line_errorreason[];
+extern UCHAR _ux_pictbridge_xml_tag_line_disconnectenable[];
+extern UCHAR _ux_pictbridge_xml_tag_line_capabilitychanged[];
+extern UCHAR _ux_pictbridge_xml_tag_line_newjobok[];
+extern UCHAR _ux_pictbridge_xml_tag_line_notifydevicestatus[];
+extern UCHAR _ux_pictbridge_xml_tag_line_notifyjobstatus[];
+extern UCHAR _ux_pictbridge_xml_tag_line_progress[];
+extern UCHAR _ux_pictbridge_xml_tag_line_imagesprinted[];
+extern UCHAR _ux_pictbridge_xml_tag_line_startjob[];
+extern UCHAR _ux_pictbridge_xml_tag_line_abortjob[];
+extern UCHAR _ux_pictbridge_xml_tag_line_abortstyle[];
+extern UCHAR _ux_pictbridge_xml_tag_line_continuejob[];
+
+extern UCHAR _ux_pictbridge_xml_tag_line_quality[];
+extern UCHAR _ux_pictbridge_xml_tag_line_papersize[];
+extern UCHAR _ux_pictbridge_xml_tag_line_papertype[];
+extern UCHAR _ux_pictbridge_xml_tag_line_filetype[];
+extern UCHAR _ux_pictbridge_xml_tag_line_dateprint[];
+extern UCHAR _ux_pictbridge_xml_tag_line_filenameprint[];
+extern UCHAR _ux_pictbridge_xml_tag_line_imageoptimize[];
+extern UCHAR _ux_pictbridge_xml_tag_line_layout[];
+extern UCHAR _ux_pictbridge_xml_tag_line_fixedsize[];
+extern UCHAR _ux_pictbridge_xml_tag_line_cropping[];
+extern UCHAR _ux_pictbridge_xml_tag_line_jobconfig[];
+extern UCHAR _ux_pictbridge_xml_tag_line_printinfo[];
+extern UCHAR _ux_pictbridge_xml_tag_line_fileid[];
+extern UCHAR _ux_pictbridge_xml_tag_line_filename[];
+extern UCHAR _ux_pictbridge_xml_tag_line_date[];
+
+#endif
+
+
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c b/common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c
new file mode 100644
index 0000000..c555fa0
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c
@@ -0,0 +1,219 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_array_element_to_array_hexa PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function translates an array of elements into an hexa array */
+/* */
+/* INPUT */
+/* */
+/* element Address of the element */
+/* hexa_array address of array */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_array_element_to_array_hexa(UCHAR *element, ULONG *hexa_array)
+{
+
+ULONG element_array_length;
+ULONG local_hexa_value;
+UCHAR element_content;
+UCHAR element_hexa;
+UCHAR *element_position;
+ULONG remaining_length;
+ULONG element_length;
+ULONG saved_element_length = 0;
+UINT string_length = UX_PICTBRIDGE_MAX_ELEMENT_SIZE;
+UINT status;
+
+
+ /* Get the string length. */
+ status = _ux_utility_string_length_check(element, &string_length, UX_PICTBRIDGE_MAX_ELEMENT_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the element length. */
+ element_array_length = string_length + 1;
+
+ /* Parse the entire element array. */
+ while(element_array_length != 0)
+ {
+
+ /* Search for the space if delimiter or the terminating 0. */
+ element_position = element;
+
+ /* The length must be saved. */
+ remaining_length = element_array_length;
+
+ /* Parse this element. */
+ while(remaining_length !=0)
+ {
+
+ /* Check for delimiter. */
+ if (*element_position == UX_PICTBRIDGE_TAG_CHAR_SPACE || *element_position == 0)
+ {
+
+ /* We found an element. Mark its end. */
+ *element_position = 0;
+
+ /* Get the string length, max length 8 for 32-bit hex value. */
+ status = _ux_utility_string_length_check(element, &string_length, 8);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the element length. */
+ element_length = string_length;
+
+ /* Save it. */
+ saved_element_length = element_length + 1;
+
+ /* Reset the local hexa value. */
+ local_hexa_value = 0;
+
+ /* We parse the element and build the hexa value one byte at a type. */
+ while(element_length)
+ {
+
+ /* Shift the previous content by 1 nibble. */
+ local_hexa_value = local_hexa_value << 4;
+
+ /* Get the element content. */
+ element_content = *element;
+
+ /* Check for the element content. Should be >0 <9 or 'A' to 'F'. */
+ if ((element_content >= '0' && element_content <= '9') ||
+ (element_content >= 'a' && element_content <= 'f') ||
+ (element_content >= 'A' && element_content <= 'F'))
+ {
+
+ /* We have a valid element content. Turn it into a hexa decimal value. */
+ if (element_content >= '0' && element_content <= '9')
+
+ /* We have a digit. */
+ element_hexa = (UCHAR)(element_content - '0');
+
+ else
+ {
+ /* We have a 'A' to 'F' or 'a' to 'f' value. */
+ if (element_content >= 'a' && element_content <= 'f')
+
+ /* We have a 'a' to 'f' char. */
+ element_hexa = (UCHAR)(element_content - 'a' + 10);
+
+ else
+
+ /* We have a 'A' to 'F' char. */
+ element_hexa = (UCHAR)(element_content - 'A' + 10);
+
+ }
+ }
+ else
+ {
+
+ /* Reset the last position in the array. */
+ *hexa_array = 0;
+
+ /* We have a syntax violation. */
+ return(UX_ERROR);
+ }
+
+ /* Add the found value to the current cumulated hexa value. */
+ local_hexa_value |= element_hexa;
+
+ /* Next position. */
+ element++;
+
+ /* Update length. */
+ element_length--;
+
+ }
+
+ /* We have finished building the 32 bit hexa value. Save it in the array. */
+ *hexa_array = local_hexa_value;
+
+ /* Next element in the array. */
+ hexa_array++;
+
+ /* We are done with this element. */
+ break;
+
+ }
+
+ else
+
+ /* Next element position. */
+ element_position++;
+
+ /* Adjust the remaining length. */
+ remaining_length--;
+ }
+
+ /* Increment the element position to the next one if there. */
+ element++;
+
+ /* Adjust the length of the array. */
+ element_array_length -= saved_element_length;
+
+ }
+
+ /* Reset the last position in the array. */
+ *hexa_array = 0;
+
+ /* Operation was successful. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_data.c b/common/usbx_pictbridge/src/ux_pictbridge_data.c
new file mode 100644
index 0000000..1c6f432
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_data.c
@@ -0,0 +1,1361 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** PictBridge Host Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+/**************************************************************************/
+/* */
+/* COMPONENT DEFINITION RELEASE */
+/* */
+/* ux_pictbridge_data PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This file contains all the data items for the pictbridge class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+
+/* Prototypes for all XML items. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_root[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_configureprintservice[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_configureprintservice[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getcapability[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getcapability[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getcapability_capability[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getcapability_capability[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getjobstatus[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getdevicestatus[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_startjob[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_startjob_printinfo[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_startjob_jobconfig[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_abortjob[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_notifyjobstatus[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_notifydevicestatus[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getfileid[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getfileid[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getfileinfo[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getfileinfo[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getthumb[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getthumb[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getfile[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getfile[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getpartialfile[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getpartialfile[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getfilelist[];
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getfilelist[];
+
+
+/* Define Pictbridge XML input get File List. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getfilelist[] =
+{
+ {
+ "fileType",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getfilelist_filetype,
+ },
+
+ {
+ "parentFileID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getfilelist_parentfileid,
+ },
+
+ {
+ "maxNumIDs",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getfilelist_maxnumids,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML output get File List. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getfilelist[] =
+{
+ {
+ "fileIDs",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfilelist_fileids,
+ },
+ {
+ "numIDs",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfilelist_numids,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML input get partial File. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getpartialfile[] =
+{
+ {
+ "fileID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getpartialfile_fileid,
+ },
+
+ {
+ "offset",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getpartialfile_offset,
+ },
+
+ {
+ "maxSize",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getpartialfile_maxsize,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML output get Partial File. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getpartialfile[] =
+{
+ {
+ "bytesRead",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getpartialfile_bytesread,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML input get File. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getfile[] =
+{
+ {
+ "fileID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getfile_fileid,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML output get File. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getfile[] =
+{
+ {
+ "bytesRead",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfile_bytesread,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML input get Thumb. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getthumb[] =
+{
+ {
+ "fileID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getthumb_fileid,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML output get Thumb. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getthumb[] =
+{
+ {
+ "bytesRead",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getthumb_bytesread,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+/* Define Pictbridge XML input get File Info. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getfileinfo[] =
+{
+ {
+ "fileID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getfileid_fileid,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML output get File ID. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getfileinfo[] =
+{
+ {
+ "fileType",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfileinfo_filetype,
+ },
+
+ {
+ "fileSize",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfileinfo_filesize,
+ },
+
+ {
+ "thumbFormat",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfileinfo_thumbformat,
+ },
+
+ {
+ "thumbsize",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfileinfo_thumbsize,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML input get File ID. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getfileid[] =
+{
+ {
+ "basePathID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getfileid_basepathid,
+ },
+
+ {
+ "filePath",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_getfileid_filepath,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML output get File ID. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getfileid[] =
+{
+ {
+ "basePathID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfileid_basepathid,
+ },
+
+ {
+ "filePath",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getfileid_filepath,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML output get device status. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_notifydevicestatus[] =
+{
+ {
+ "dpsPrintServiceStatus",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifydevicestatus_dpsprintservicestatus,
+ },
+
+ {
+ "jobEndReason",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason,
+ },
+
+ {
+ "errorStatus",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifydevicestatus_errorstatus,
+ },
+ {
+ "errorReason",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifydevicestatus_errorreason,
+ },
+ {
+ "disconnectEnable",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifydevicestatus_disconnectenable,
+ },
+
+ {
+ "capabilityChanged",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged,
+ },
+
+ {
+ "newJobOK",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifydevicestatus_newjobok,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML input notify job. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_notifyjobstatus[] =
+{
+ {
+ "prtPID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifyjobstatus_prtpid,
+ },
+ {
+ "filepath",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifyjobstatus_filepath,
+ },
+ {
+ "copyID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifyjobstatus_copyid,
+ },
+ {
+ "progress",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_notifyjobstatus_progress,
+ },
+ {
+ "imagesPrinted",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_output_notifyjobstatus_imagesprinted,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML input abort job. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_abortjob[] =
+{
+ {
+ "abortStyle",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_abortjob,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML input start job job config. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_startjob_jobconfig[] =
+{
+ {
+ "quality",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_quality,
+ },
+ {
+ "paperSize",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_papersize,
+ },
+ {
+ "paperType",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_papertype,
+ },
+ {
+ "fileType",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_filetype,
+ },
+ {
+ "datePrint",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_dateprint,
+ },
+ {
+ "fileNamePrint",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_filenameprint,
+ },
+ {
+ "imageOptimize",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_imageoptimize,
+ },
+ {
+ "layout",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_layout,
+ },
+ {
+ "fixedSize",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_fixedsize,
+ },
+ {
+ "cropping",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_jobconfig_cropping,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML input print info. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_startjob_printinfo[] =
+{
+ {
+ "croppingArea",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_printinfo_croppingarea,
+ },
+ {
+ "fileID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_printinfo_fileid,
+ },
+ {
+ "fileName",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_printinfo_filename,
+ },
+ {
+ "date",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_printinfo_date,
+ },
+ {
+ "copies",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_printinfo_copies,
+ },
+ {
+ "prtPID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_printinfo_prtpid,
+ },
+ {
+ "filepath",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_printinfo_filepath,
+ },
+ {
+ "copyID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_function_input_startjob_printinfo_copyid,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML input start job. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_startjob[] =
+{
+ {
+ "jobConfig",
+ 0,
+ _ux_pictbridge_xml_item_input_startjob_jobconfig,
+ _ux_pictbridge_xml_item_input,
+ UX_NULL,
+ },
+ {
+ "printInfo",
+ 0,
+ _ux_pictbridge_xml_item_input_startjob_printinfo,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_startjob_printinfo,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML output get device status. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getdevicestatus[] =
+{
+ {
+ "dpsPrintServiceStatus",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getdevicestatus_dpsprintservicestatus,
+ },
+
+ {
+ "jobEndReason",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getdevicestatus_jobendreason,
+ },
+
+ {
+ "errorStatus",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getdevicestatus_errorstatus,
+ },
+ {
+ "errorReason",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getdevicestatus_errorreason,
+ },
+ {
+ "disconnectEnable",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getdevicestatus_disconnectenable,
+ },
+
+ {
+ "capabilityChanged",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getdevicestatus_capabilitychanged,
+ },
+
+ {
+ "newJobOK",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getdevicestatus_newjobok,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML output get job status. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getjobstatus[] =
+{
+ {
+ "prtPID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getjobstatus_prtpid,
+ },
+ {
+ "filePath",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getjobstatus_filepath,
+ },
+ {
+ "copyID",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getjobstatus_copyid,
+ },
+
+ {
+ "progress",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getjobstatus_progress,
+ },
+
+ {
+ "imagesPrinted",
+ 0,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_getjobstatus_imagesprinted,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML input get capability elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getcapability_capability[] =
+{
+ {
+ "qualities",
+ UX_PICTBRIDGE_IR_GC_QUALITIES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_qualities,
+ },
+ {
+ "paperSizes",
+ UX_PICTBRIDGE_IR_GC_PAPER_SIZES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_papersizes,
+ },
+ {
+ "paperTypes",
+ UX_PICTBRIDGE_IR_GC_PAPER_TYPES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_papertypes,
+ },
+ {
+ "fileTypes",
+ UX_PICTBRIDGE_IR_GC_FILE_TYPES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_filetypes,
+ },
+ {
+ "datePrints",
+ UX_PICTBRIDGE_IR_GC_DATE_PRINTS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_dateprints,
+ },
+ {
+ "fileNamePrints",
+ UX_PICTBRIDGE_IR_GC_FILE_NAME_PRINTS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_filenameprints,
+ },
+ {
+ "imageOptimizes",
+ UX_PICTBRIDGE_IR_GC_IMAGE_OPTIMIZES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_imageoptimizes,
+ },
+ {
+ "layouts",
+ UX_PICTBRIDGE_IR_GC_LAYOUTS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_layouts,
+ },
+ {
+ "fixedSizes",
+ UX_PICTBRIDGE_IR_GC_FIXED_SIZES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_fixedsizes,
+ },
+ {
+ "croppings",
+ UX_PICTBRIDGE_IR_GC_CROPPINGS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_croppings,
+ },
+ {
+ "charRepertoires",
+ UX_PICTBRIDGE_IR_GC_CHAR_REPERTOIRES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_function_input_getcapability_capability_charrepertoires,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML get capability elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_getcapability[] =
+{
+ {
+ "capability",
+ 0,
+ _ux_pictbridge_xml_item_input_getcapability_capability,
+ _ux_pictbridge_xml_item_input,
+ UX_NULL,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+
+};
+
+/* Define Pictbridge XML output get capability elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getcapability_capability[] =
+{
+ {
+ "qualities",
+ UX_PICTBRIDGE_IR_GC_QUALITIES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_qualities,
+ },
+ {
+ "paperSizes",
+ UX_PICTBRIDGE_IR_GC_PAPER_SIZES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_papersizes,
+ },
+ {
+ "paperTypes",
+ UX_PICTBRIDGE_IR_GC_PAPER_TYPES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_papertypes,
+ },
+ {
+ "fileTypes",
+ UX_PICTBRIDGE_IR_GC_FILE_TYPES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_filetypes,
+ },
+ {
+ "datePrints",
+ UX_PICTBRIDGE_IR_GC_DATE_PRINTS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_dateprints,
+ },
+ {
+ "fileNamePrints",
+ UX_PICTBRIDGE_IR_GC_FILE_NAME_PRINTS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_filenameprints,
+ },
+ {
+ "imageOptimizes",
+ UX_PICTBRIDGE_IR_GC_IMAGE_OPTIMIZES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_imageoptimizes,
+ },
+ {
+ "layouts",
+ UX_PICTBRIDGE_IR_GC_LAYOUTS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_layouts,
+ },
+ {
+ "fixedSizes",
+ UX_PICTBRIDGE_IR_GC_FIXED_SIZES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_fixedsizes,
+ },
+ {
+ "croppings",
+ UX_PICTBRIDGE_IR_GC_CROPPINGS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_croppings,
+ },
+ {
+ "charRepertoires",
+ UX_PICTBRIDGE_IR_GC_CHAR_REPERTOIRES,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_function_output_getcapability_capability_charrepertoires,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+/* Define Pictbridge XML get capability elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_getcapability[] =
+{
+ {
+ "capability",
+ 0,
+ _ux_pictbridge_xml_item_output_getcapability_capability,
+ _ux_pictbridge_xml_item_output,
+ UX_NULL,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+
+};
+
+
+/* Define Pictbridge XML configure print service elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input_configureprintservice[] =
+{
+ {
+ "dpsVersions",
+ UX_PICTBRIDGE_IR_CPS_DPS_VERSIONS,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_dpsversion,
+ },
+ {
+ "vendorName",
+ UX_PICTBRIDGE_IR_CPS_VENDOR_NAME,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_vendorname,
+ },
+ {
+ "vendorSpecificVersion",
+ UX_PICTBRIDGE_IR_CPS_VENDOR_SPECIFIC_VERSION,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_vendorspecificversion,
+ },
+ {
+ "productName",
+ UX_PICTBRIDGE_IR_CPS_PRODUCT_NAME,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_productname,
+ },
+ {
+ "serialNo",
+ UX_PICTBRIDGE_IR_CPS_SERIAL_NO,
+ UX_PICTBRIDGE_XML_LEAF,
+ _ux_pictbridge_xml_item_input,
+ _ux_pictbridge_xml_function_input_serialno,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML configure print service elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output_configureprintservice[] =
+{
+ {
+ "printServiceAvailable",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_printserviceavailable,
+ },
+ {
+ "dpsVersions",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_dpsversion,
+ },
+ {
+ "vendorName",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_vendorname,
+ },
+ {
+ "vendorSpecificVersion",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_vendorspecificversion,
+ },
+ {
+ "productName",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_productname,
+ },
+ {
+ "serialNo",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_output,
+ _ux_pictbridge_xml_function_output_serialno,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+};
+
+
+/* Define Pictbridge XML input elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_input[] =
+{
+ {
+ "configurePrintService",
+ UX_PICTBRIDGE_IR_CONFIGURE_PRINT_SERVICE,
+ _ux_pictbridge_xml_item_input_configureprintservice,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getCapability",
+ UX_PICTBRIDGE_IR_GET_CAPABILITY,
+ _ux_pictbridge_xml_item_input_getcapability,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getDeviceStatus",
+ UX_PICTBRIDGE_IR_GET_DEVICE_STATUS,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getJobStatus",
+ UX_PICTBRIDGE_IR_GET_JOB_STATUS,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_input_getjobstatus,
+ },
+ {
+ "startJob",
+ UX_PICTBRIDGE_IR_START_JOB,
+ _ux_pictbridge_xml_item_input_startjob,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_input_startjob,
+ },
+ {
+ "abortJob",
+ UX_PICTBRIDGE_IR_ABORT_JOB,
+ _ux_pictbridge_xml_item_input_abortjob,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "continueJob",
+ UX_PICTBRIDGE_IR_CONTINUE_JOB,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_input_continuejob,
+ },
+ {
+ "notifyJobStatus",
+ UX_PICTBRIDGE_IR_NOTIFY_JOB_STATUS,
+ _ux_pictbridge_xml_item_input_notifyjobstatus,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_input_notifyjobstatus,
+ },
+ {
+ "notifyDeviceStatus",
+ UX_PICTBRIDGE_IR_NOTIFY_DEVICE_STATUS,
+ _ux_pictbridge_xml_item_input_notifydevicestatus,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_input_notifydevicestatus,
+ },
+ {
+ "getFileID",
+ 0,
+ _ux_pictbridge_xml_item_input_getfileid,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getFileInfo",
+ 0,
+ _ux_pictbridge_xml_item_input_getfileinfo,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getFile",
+ 0,
+ _ux_pictbridge_xml_item_input_getfile,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getPartialFile",
+ 0,
+ _ux_pictbridge_xml_item_input_getpartialfile,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getFileList",
+ 0,
+ _ux_pictbridge_xml_item_input_getfilelist,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getThumb",
+ 0,
+ _ux_pictbridge_xml_item_input_getthumb,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+
+};
+
+/* Define Pictbridge XML output elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_output[] =
+{
+ {
+ "result",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_output_result,
+ },
+ {
+ "configurePrintService",
+ UX_PICTBRIDGE_IR_CONFIGURE_PRINT_SERVICE,
+ _ux_pictbridge_xml_item_output_configureprintservice,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getCapability",
+ UX_PICTBRIDGE_IR_GET_CAPABILITY,
+ _ux_pictbridge_xml_item_output_getcapability,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getDeviceStatus",
+ UX_PICTBRIDGE_IR_GET_DEVICE_STATUS,
+ _ux_pictbridge_xml_item_output_getdevicestatus,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getJobStatus",
+ UX_PICTBRIDGE_IR_GET_JOB_STATUS,
+ _ux_pictbridge_xml_item_output_getjobstatus,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "startJob",
+ UX_PICTBRIDGE_IR_START_JOB,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_output_startjob,
+ },
+ {
+ "abortJob",
+ UX_PICTBRIDGE_IR_ABORT_JOB,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_output_abortjob,
+ },
+ {
+ "continueJob",
+ UX_PICTBRIDGE_IR_CONTINUE_JOB,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_output_continuejob,
+ },
+ {
+ "notifyJobStatus",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_output_notifyjobstatus,
+ },
+ {
+ "notifyDeviceStatus",
+ 0,
+ UX_NULL,
+ _ux_pictbridge_xml_item_root,
+ _ux_pictbridge_xml_function_output_notifydevicestatus,
+ },
+ {
+ "getFileID",
+ 0,
+ _ux_pictbridge_xml_item_output_getfileid,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getFileInfo",
+ 0,
+ _ux_pictbridge_xml_item_output_getfileinfo,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getFile",
+ 0,
+ _ux_pictbridge_xml_item_output_getfile,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getPartialFile",
+ 0,
+ _ux_pictbridge_xml_item_output_getpartialfile,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getFileList",
+ 0,
+ _ux_pictbridge_xml_item_output_getfilelist,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+ {
+ "getThumb",
+ 0,
+ _ux_pictbridge_xml_item_output_getthumb,
+ _ux_pictbridge_xml_item_root,
+ UX_NULL,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+
+};
+
+
+/* Define Pictbridge XML Root elements. */
+UX_PICTBRIDGE_XML_ITEM _ux_pictbridge_xml_item_root[] =
+{
+ {
+ "xml",
+ 0,
+ UX_NULL,
+ UX_NULL,
+ _ux_pictbridge_xml_function_root_xml,
+ },
+
+ {
+ "dps",
+ 0,
+ UX_NULL,
+ UX_NULL,
+ _ux_pictbridge_xml_function_root_dps,
+ },
+ {
+ "input",
+ 0,
+ _ux_pictbridge_xml_item_input,
+ UX_NULL,
+ _ux_pictbridge_xml_function_root_input,
+ },
+ {
+ "output",
+ 0,
+ _ux_pictbridge_xml_item_output,
+ UX_NULL,
+ _ux_pictbridge_xml_function_root_output,
+ },
+
+ { "\0", 0, UX_NULL, UX_NULL, UX_NULL }
+
+};
+
+
+/* Define Pictbridge Discovery file names. */
+UCHAR _ux_pictbridge_ddiscovery_name[] = "DDISCVRY.DPS";
+UCHAR _ux_pictbridge_hdiscovery_name[] = "HDISCVRY.DPS";
+UCHAR _ux_pictbridge_hrequest_name[] = "HREQUEST.DPS";
+UCHAR _ux_pictbridge_hrsponse_name[] = "HRSPONSE.DPS";
+UCHAR _ux_pictbridge_drequest_name[] = "DREQUEST.DPS";
+UCHAR _ux_pictbridge_drsponse_name[] = "DRSPONSE.DPS";
+
+/* Define Pictbridge client volume strings. */
+UCHAR _ux_pictbridge_volume_description[] = "PIMA Client Storage Volume";
+UCHAR _ux_pictbridge_volume_label[] = "PIMA Client Storage Label";
+
+/* Define Pictbridge XML tag lines or tag names. */
+UCHAR _ux_pictbridge_xml_tag_line_xmlversion[] = "?xml version=\"1.0\"?" ;
+UCHAR _ux_pictbridge_xml_tag_line_dpsxmlns[] = "dps xmlns=\"http://www.cipa.jp/dps/schema/\"";
+UCHAR _ux_pictbridge_xml_tag_line_dps[] = "dps";
+UCHAR _ux_pictbridge_xml_tag_line_output[] = "output";
+UCHAR _ux_pictbridge_xml_tag_line_input[] = "input";
+UCHAR _ux_pictbridge_xml_tag_line_result[] = "result";
+UCHAR _ux_pictbridge_xml_tag_line_configureprintservice[] = "configurePrintService";
+UCHAR _ux_pictbridge_xml_tag_line_printserviceavailable[] = "printServiceAvailable";
+UCHAR _ux_pictbridge_xml_tag_line_dpsversions[] = "dpsVersions";
+UCHAR _ux_pictbridge_xml_tag_line_vendorname[] = "vendorName";
+UCHAR _ux_pictbridge_xml_tag_line_vendorspecificversion[] = "vendorSpecificVersion";
+UCHAR _ux_pictbridge_xml_tag_line_productname[] = "productName";
+UCHAR _ux_pictbridge_xml_tag_line_serialno[] = "serialNo";
+UCHAR _ux_pictbridge_xml_tag_line_capability[] = "capability";
+UCHAR _ux_pictbridge_xml_tag_line_getcapability[] = "getCapability";
+UCHAR _ux_pictbridge_xml_tag_line_qualities[] = "qualities";
+UCHAR _ux_pictbridge_xml_tag_line_papersizes[] = "paperSizes";
+UCHAR _ux_pictbridge_xml_tag_line_papertypes[] = "paperTypes";
+UCHAR _ux_pictbridge_xml_tag_line_filetypes[] = "fileTypes";
+UCHAR _ux_pictbridge_xml_tag_line_dateprints[] = "datePrints";
+UCHAR _ux_pictbridge_xml_tag_line_filenameprints[] = "fileNamePrints";
+UCHAR _ux_pictbridge_xml_tag_line_imageoptimizes[] = "imageOptimizes";
+UCHAR _ux_pictbridge_xml_tag_line_layouts[] = "layouts";
+UCHAR _ux_pictbridge_xml_tag_line_fixedsizes[] = "fixedSizes";
+UCHAR _ux_pictbridge_xml_tag_line_croppings[] = "croppings";
+UCHAR _ux_pictbridge_xml_tag_line_charrepertoires[] = "charRepertoires";
+UCHAR _ux_pictbridge_xml_tag_line_getdevicestatus[] = "getDeviceStatus";
+UCHAR _ux_pictbridge_xml_tag_line_dpsprintservicestatus[] = "dpsPrintServiceStatus";
+UCHAR _ux_pictbridge_xml_tag_line_jobendreason[] = "jobEndReason";
+UCHAR _ux_pictbridge_xml_tag_line_errorstatus[] = "errorStatus";
+UCHAR _ux_pictbridge_xml_tag_line_errorreason[] = "errorReason";
+UCHAR _ux_pictbridge_xml_tag_line_disconnectenable[] = "disconnectEnable";
+UCHAR _ux_pictbridge_xml_tag_line_capabilitychanged[] = "capabilityChanged";
+UCHAR _ux_pictbridge_xml_tag_line_newjobok[] = "newJobOK";
+UCHAR _ux_pictbridge_xml_tag_line_notifydevicestatus[] = "notifyDeviceStatus";
+UCHAR _ux_pictbridge_xml_tag_line_notifyjobstatus[] = "notifyJobStatus";
+UCHAR _ux_pictbridge_xml_tag_line_progress[] = "progress";
+UCHAR _ux_pictbridge_xml_tag_line_imagesprinted[] = "imagesPrinted";
+UCHAR _ux_pictbridge_xml_tag_line_startjob[] = "startJob";
+UCHAR _ux_pictbridge_xml_tag_line_abortjob[] = "abortJob";
+UCHAR _ux_pictbridge_xml_tag_line_abortstyle[] = "abortStyle";
+UCHAR _ux_pictbridge_xml_tag_line_continuejob[] = "continueJob";
+UCHAR _ux_pictbridge_xml_tag_line_quality[] = "quality";
+UCHAR _ux_pictbridge_xml_tag_line_papersize[] = "paperSize";
+UCHAR _ux_pictbridge_xml_tag_line_papertype[] = "paperType";
+UCHAR _ux_pictbridge_xml_tag_line_filetype[] = "fileType";
+UCHAR _ux_pictbridge_xml_tag_line_dateprint[] = "datePrint";
+UCHAR _ux_pictbridge_xml_tag_line_filenameprint[] = "fileNamePrint";
+UCHAR _ux_pictbridge_xml_tag_line_imageoptimize[] = "imageOptimize";
+UCHAR _ux_pictbridge_xml_tag_line_layout[] = "layout";
+UCHAR _ux_pictbridge_xml_tag_line_fixedsize[] = "fixedSize";
+UCHAR _ux_pictbridge_xml_tag_line_cropping[] = "cropping";
+UCHAR _ux_pictbridge_xml_tag_line_jobconfig[] = "jobConfig";
+UCHAR _ux_pictbridge_xml_tag_line_printinfo[] = "printInfo";
+UCHAR _ux_pictbridge_xml_tag_line_fileid[] = "fileID";
+UCHAR _ux_pictbridge_xml_tag_line_filename[] = "fileName";
+UCHAR _ux_pictbridge_xml_tag_line_date[] = "date";
+
+/* Define Pictbridge XML variable names. */
+UCHAR _ux_pictbridge_xml_variable_papersize[] = "paperSize";
+UCHAR _ux_pictbridge_xml_variable_version[] = "version";
+UCHAR _ux_pictbridge_xml_variable_xmlns[] = "xmlns";
+
+/* Define Pictbridge XML string names. */
+UCHAR _ux_pictbridge_xml_string_xmlns[] = "http://www.cipa.jp/dps/schema/";
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_abortjob.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_abortjob.c
new file mode 100644
index 0000000..ff6dc4f
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_abortjob.c
@@ -0,0 +1,101 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_api_abort_job PORTABLE C */
+/* 6.0 */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the start job function */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_api_abort_job(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+ULONG actual_flags;
+
+ /* Prepare the object for capability. */
+ status = _ux_pictbridge_dpsclient_input_object_prepare(pictbridge, UX_PICTBRIDGE_OR_ABORT_JOB, 0, 0);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* We should wait for the host to send a script with the response. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_ABORT_JOB,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(UX_EVENT_ERROR);
+
+ /* Ensure the flag was set. */
+ if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_ABORT_JOB)
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+
+ else
+
+ /* Return completion status. */
+ return(UX_ERROR);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_capability.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_capability.c
new file mode 100644
index 0000000..2240449
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_capability.c
@@ -0,0 +1,111 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_api_configure_print_service PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the configure_print_service */
+/* request and then output the request to the printer. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* capability_code What capability to get */
+/* capability_parameter Optional parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_delay_ms Delay ms */
+/* _ux_pictbridge_dps_client_input_object_prepare */
+/* _ux_utility_event_flags_get */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_object_get */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_api_capability(UX_PICTBRIDGE *pictbridge, ULONG capability_code,
+ ULONG capability_parameter)
+{
+UINT status;
+ULONG actual_flags;
+
+ /* Wait for 100 ms to give a chance to the host to send a request before the client can post a Object Added event. */
+ _ux_utility_delay_ms(100);
+
+ /* Prepare the object for capability. */
+ status = _ux_pictbridge_dpsclient_input_object_prepare(pictbridge, UX_PICTBRIDGE_OR_GET_CAPABILITY,
+ capability_code, capability_parameter);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* We should wait for the host to send a script with the response. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_CAPABILITY,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(UX_EVENT_ERROR);
+
+ /* Ensure the flag was set. */
+ if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_CAPABILITY)
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+
+ else
+
+ /* Return completion status. */
+ return(UX_ERROR);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_configure_print_service.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_configure_print_service.c
new file mode 100644
index 0000000..8a78915
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_configure_print_service.c
@@ -0,0 +1,106 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_api_configure_print_service PORTABLE C */
+/* 6.0 */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the configure_print_service */
+/* request and then output the request to the printer. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_delay_ms Delay ms */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_object_get */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_api_configure_print_service(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+ULONG actual_flags;
+
+ /* Wait for 100 ms to give a chance to the host to send a request before the client can post a Object Added event. */
+ _ux_utility_delay_ms(100);
+
+ /* Prepare the object for configure print service. */
+ status = _ux_pictbridge_dpsclient_input_object_prepare(pictbridge, UX_PICTBRIDGE_OR_CONFIGURE_PRINT_SERVICE, 0, 0);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* We should wait for the host to send a script with the response. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_CONFIGURE_PRINT_SERVICE,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(UX_EVENT_ERROR);
+
+ /* Ensure the flag was set. */
+ if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_CONFIGURE_PRINT_SERVICE)
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+
+ else
+
+ /* Return completion status. */
+ return(UX_ERROR);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_continuejob.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_continuejob.c
new file mode 100644
index 0000000..7d34b5f
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_continuejob.c
@@ -0,0 +1,100 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_api_abort_job PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the start job function */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_api_continue_job(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+ULONG actual_flags;
+
+ /* Prepare the object for capability. */
+ status = _ux_pictbridge_dpsclient_input_object_prepare(pictbridge, UX_PICTBRIDGE_OR_CONTINUE_JOB, 0, 0);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* We should wait for the host to send a script with the response. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_CONTINUE_JOB,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(UX_EVENT_ERROR);
+
+ /* Ensure the flag was set. */
+ if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_CONTINUE_JOB)
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+
+ else
+
+ /* Return completion status. */
+ return(UX_ERROR);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_device_status.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_device_status.c
new file mode 100644
index 0000000..66a2416
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_device_status.c
@@ -0,0 +1,105 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_api_device_status PORTABLE C */
+/* 6.0 */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the device status function */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_delay_ms Delay ms */
+/* */
+/* CALLED BY */
+/* */
+/* application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_api_device_status(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+ULONG actual_flags;
+
+ /* Wait for 100 ms to give a chance to the host to send a request before the client can post a Object Added event. */
+ _ux_utility_delay_ms(100);
+
+ /* Prepare the object for capability. */
+ status = _ux_pictbridge_dpsclient_input_object_prepare(pictbridge, UX_PICTBRIDGE_OR_GET_DEVICE_STATUS, 0, 0);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* We should wait for the host to send a script with the response. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_DEVICE_STATUS,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(UX_EVENT_ERROR);
+
+ /* Ensure the flag was set. */
+ if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_DEVICE_STATUS)
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+
+ else
+
+ /* Return completion status. */
+ return(UX_ERROR);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_startjob.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_startjob.c
new file mode 100644
index 0000000..5e29c95
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_api_startjob.c
@@ -0,0 +1,101 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_api_start_job PORTABLE C */
+/* 6.0 */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the start job function */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_api_start_job(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+ULONG actual_flags;
+
+ /* Prepare the object for capability. */
+ status = _ux_pictbridge_dpsclient_input_object_prepare(pictbridge, UX_PICTBRIDGE_OR_START_JOB, 0, 0);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* We should wait for the host to send a script with the response. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_START_JOB,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(UX_EVENT_ERROR);
+
+ /* Ensure the flag was set. */
+ if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_START_JOB)
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+
+ else
+
+ /* Return completion status. */
+ return(UX_ERROR);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_abortjob.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_abortjob.c
new file mode 100644
index 0000000..3767e38
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_abortjob.c
@@ -0,0 +1,125 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_input_abortjob */
+/* PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the abort job */
+/* request. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpsclient_input_object_prepare */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _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)
+{
+
+UINT status;
+UX_PICTBRIDGE_JOBINFO *jobinfo;
+
+ UX_PARAMETER_NOT_USED(input_subcode);
+ UX_PARAMETER_NOT_USED(input_parameter);
+
+
+ /* We can start a new job. Fill in the JobConfig and PrintInfo structures. */
+ jobinfo = &pictbridge -> ux_pictbridge_jobinfo;
+
+ /* Add the line <abortJob> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_abortjob,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <abortStyle> xxxxxxxx </abortStyle> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_abortstyle,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_abort_style, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </abortJob> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_abortjob,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_configure_print_service.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_configure_print_service.c
new file mode 100644
index 0000000..2f28bd0
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_configure_print_service.c
@@ -0,0 +1,144 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_input_object_configure_print_service */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the configure_print_service */
+/* request. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpsclient_input_object_prepare */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_input_object_configure_print_service(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated)
+{
+
+UINT status;
+
+ /* Add the line <configurePrintService> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_configureprintservice,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <dpsVersions>major_minor major_minor</dpsVersions> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsversions,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsversions, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <vendorName> ascii_string </vendorName> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_vendorname,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_product_name, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <vendorSpecificVersion> major_minor </vendorSpecificVersion> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_vendorspecificversion,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_MAJOR_MINOR,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_vendor_specific_version, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <productName> ascii_string </productName> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_productname,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_product_name, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <serialNo> ascii_string </serialNo> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_serialno,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_serial_no, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </configurePrintService> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_configureprintservice,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_continuejob.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_continuejob.c
new file mode 100644
index 0000000..1b49ef5
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_continuejob.c
@@ -0,0 +1,108 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_input_continuejob */
+/* PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the continue job */
+/* request. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpsclient_input_object_prepare */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_input_object_continuejob(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)
+{
+
+UINT status;
+
+
+ UX_PARAMETER_NOT_USED(pictbridge);
+ UX_PARAMETER_NOT_USED(input_subcode);
+ UX_PARAMETER_NOT_USED(input_parameter);
+
+ /* Add the line <continueJob/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_continuejob,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_get_capability.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_get_capability.c
new file mode 100644
index 0000000..72e8ec4
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_get_capability.c
@@ -0,0 +1,283 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_input_get_capability */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the capability */
+/* request. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpsclient_input_object_prepare */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_input_object_get_capability(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)
+{
+
+UINT status;
+
+
+ /* Add the line <getcapability> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_getcapability,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <capability> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_capability,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Check was subcode we need to for this request. The API might be sending one or multiple requests. */
+ if (input_subcode & UX_PICTBRIDGE_API_QUALITIES)
+ {
+ /* Add the line <qualities/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_qualities,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Check was subcode we need to for this request. The API might be sending one or multiple requests. */
+ if (input_subcode & UX_PICTBRIDGE_API_PAPER_SIZES)
+ {
+ /* Add the line <paperSizes/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_papersizes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Check was subcode we need to for this request. The API might be sending one or multiple requests. */
+ if (input_subcode & UX_PICTBRIDGE_API_PAPER_SIZES)
+ {
+
+ /* Check if we had a paper size value specified in the input report. */
+ if (input_parameter != 0)
+ {
+ /* Add the line <paperTypes paperSize = "xxxxxxxx"/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_papertypes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ _ux_pictbridge_xml_variable_papersize,
+ input_parameter,
+ UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+ else
+ {
+ /* Add the line <paperTypes/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_papertypes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0,
+ (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_papertypes, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (input_subcode & UX_PICTBRIDGE_API_FILE_TYPES)
+ {
+ /* Add the line <fileTypes/> */
+ _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_filetypes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL , &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (input_subcode & UX_PICTBRIDGE_API_DATE_PRINTS)
+ {
+ /* Add the line <datePrints/> */
+ _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dateprints,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL , &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (input_subcode & UX_PICTBRIDGE_API_FILE_NAME_PRINTS)
+ {
+ /* Add the line <namePrints/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_filenameprints,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (input_subcode & UX_PICTBRIDGE_API_IMAGE_OPTIMIZES)
+ {
+ /* Add the line <imageOptimizes/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_imageoptimizes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (input_subcode & UX_PICTBRIDGE_API_LAYOUTS)
+ {
+
+ /* Check if we had a paper size value specified in the input report. */
+ if (input_parameter != 0)
+ {
+ /* Add the line <layouts paperSize = "xxxxxxxx"/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_layouts,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ _ux_pictbridge_xml_variable_papersize,
+ input_parameter,
+ UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+ else
+ {
+ /* Add the line <layouts/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_layouts,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0,
+ UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (input_subcode & UX_PICTBRIDGE_API_FIXED_SIZES)
+ {
+ /* Add the line <fixedSizes/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_fixedsizes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0,
+ UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (input_subcode & UX_PICTBRIDGE_API_CROPPINGS)
+ {
+ /* Add the line <croppings/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_croppings,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (input_subcode & UX_PICTBRIDGE_API_CHAR_REPERTOIRES)
+ {
+ /* Add the line <charRepertoires/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_charrepertoires,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0,
+ UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Add the line </capability> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_capability,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </getcapability> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_getcapability,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_prepare.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_prepare.c
new file mode 100644
index 0000000..0ddca53
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_prepare.c
@@ -0,0 +1,223 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_input_object_prepare PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function prepares a client input object to be sent. */
+/* This function puts a interrupt notification for the host to issue */
+/* a get object request. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_function input function */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_input_object_prepare(UX_PICTBRIDGE *pictbridge,
+ ULONG input_function,
+ ULONG input_subfunction,
+ ULONG input_parameter)
+{
+UINT status;
+ULONG object_length;
+UCHAR *pima_object_buffer;
+UX_SLAVE_CLASS_PIMA *pima;
+UX_SLAVE_CLASS_PIMA_OBJECT *pima_object;
+ULONG actual_flags;
+
+
+ /* Check the status of pictbridge, if we are in a host request cycle, cannot add object now. */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST)
+ {
+
+ /* Add to the state machine the client pending request. */
+ pictbridge -> ux_pictbridge_host_client_state_machine |= UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING;
+
+ /* We should wait for the state machine to allow our operation. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(UX_EVENT_ERROR);
+
+ }
+
+ /* Change the state machine to client request. */
+ pictbridge -> ux_pictbridge_host_client_state_machine |= UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST;
+
+ /* Get the pima instance from the pictbridge container. */
+ pima = (UX_SLAVE_CLASS_PIMA *) pictbridge -> ux_pictbridge_pima;
+
+ /* Get the address of the object container. We choose the client container. */
+ pima_object = pictbridge -> ux_pictbridge_object_client;
+
+ /* Get the object buffer address. */
+ pima_object_buffer = pima_object -> ux_device_class_pima_object_buffer;
+
+ /* Reset the object length. */
+ object_length = 0;
+
+ /* Clear the object memory buffer. */
+ _ux_utility_memory_set(pima_object_buffer, 0, UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER);
+
+ /* Add the line <?xml version="1.0"?> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_xmlversion,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <dps xmlns="http://www.cipa.jp/dps/schema/"> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsxmlns,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <input> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_input,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Look into the tag code from the input object and proceed to individual functions. */
+ switch (input_function)
+ {
+
+
+ case UX_PICTBRIDGE_OR_CONFIGURE_PRINT_SERVICE :
+
+ status = _ux_pictbridge_dpsclient_input_object_configure_print_service(pictbridge, pima_object_buffer, object_length,
+ &pima_object_buffer, &object_length);
+ break;
+
+ case UX_PICTBRIDGE_OR_GET_CAPABILITY :
+
+ status = _ux_pictbridge_dpsclient_input_object_get_capability(pictbridge, input_subfunction, input_parameter, pima_object_buffer, object_length,
+ &pima_object_buffer, &object_length);
+ break;
+
+ case UX_PICTBRIDGE_OR_START_JOB :
+
+ status = _ux_pictbridge_dpsclient_input_object_startjob(pictbridge, input_subfunction, input_parameter, pima_object_buffer, object_length,
+ &pima_object_buffer, &object_length);
+ break;
+
+ case UX_PICTBRIDGE_OR_ABORT_JOB :
+
+ status = _ux_pictbridge_dpsclient_input_object_abortjob(pictbridge, input_subfunction, input_parameter, pima_object_buffer, object_length,
+ &pima_object_buffer, &object_length);
+ break;
+
+ case UX_PICTBRIDGE_OR_CONTINUE_JOB :
+
+ status = _ux_pictbridge_dpsclient_input_object_continuejob(pictbridge, input_subfunction, input_parameter, pima_object_buffer, object_length,
+ &pima_object_buffer, &object_length);
+ break;
+
+ case UX_PICTBRIDGE_OR_GET_DEVICE_STATUS :
+
+ /* Add the line <getDeviceStatus/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_getdevicestatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+
+ break;
+
+ default :
+
+ /* Function not yet supported. We should never come here anyway. */
+ status = (UX_ERROR);
+ }
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </input> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_input,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </dps> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dps,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the length of the object and store it into the object data set. */
+ pima_object -> ux_device_class_pima_object_length = object_length;
+ pima_object -> ux_device_class_pima_object_compressed_size = object_length;
+
+ /* Save the handle for this object. */
+ pima_object -> ux_device_class_pima_object_handle_id = UX_PICTBRIDGE_OBJECT_HANDLE_CLIENT_REQUEST;
+
+ /* We need to change the file name to DREQUEST.DPS. Encode the file name from ascii format into Unicode. */
+ _ux_utility_string_to_unicode(_ux_pictbridge_drequest_name, pima_object -> ux_device_class_pima_object_filename);
+
+ /* Send the notification to the host that an object has been added. */
+ status = _ux_device_class_pima_object_add(pima, UX_PICTBRIDGE_OBJECT_HANDLE_CLIENT_REQUEST);
+
+ /* Return completion status. */
+ return(status);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_startjob.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_startjob.c
new file mode 100644
index 0000000..6d7bdec
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_input_object_startjob.c
@@ -0,0 +1,245 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_input_start_job */
+/* PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the start job */
+/* request. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpsclient_input_object_prepare */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_input_object_startjob(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)
+{
+
+UINT status;
+UX_PICTBRIDGE_JOBINFO *jobinfo;
+UX_PICTBRIDGE_PRINTINFO *printinfo;
+
+ UX_PARAMETER_NOT_USED(input_subcode);
+ UX_PARAMETER_NOT_USED(input_parameter);
+
+ /* We can start a new job. Fill in the JobConfig and PrintInfo structures. */
+ jobinfo = &pictbridge -> ux_pictbridge_jobinfo;
+ printinfo = jobinfo -> ux_pictbridge_jobinfo_printinfo_start;
+
+ /* Add the line <startJob> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_startjob,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <jobConfig> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_jobconfig,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <quality> xxxxxxxx </quality> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_quality,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_quality, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <paperType> xxxxxxxx </paperType> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_papertype,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_papertype, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <paperSize> xxxxxxxx </paperSize> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_papersize,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_papersize, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <fileType> xxxxxxxx </fileType> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_filetype,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_filetype, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <datePrint> xxxxxxxx </datePrint> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dateprint,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_dateprint, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <fileNamePrint> xxxxxxxx </fileNamePrint> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_filenameprint,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_filenameprint, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <imageOptimize> xxxxxxxx </imageOptimize> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_imageoptimize,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_imageoptimize, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <layout> xxxxxxxx </layout> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_layout,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) jobinfo -> ux_pictbridge_jobinfo_layout, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </jobConfig> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_jobconfig,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add all the printInfo. */
+ while (printinfo != UX_NULL)
+ {
+
+ /* Add the line <printInfo> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_printinfo,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <fileID> xxxxxxxx </fileID> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_fileid,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) printinfo -> ux_pictbridge_printinfo_fileid,
+ &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Check if there is filename string. */
+ if (printinfo -> ux_pictbridge_printinfo_filename[0] != '\0')
+ {
+
+ /* Add the line <fileName> xxxxxxxx </fileName> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_filename,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *) printinfo -> ux_pictbridge_printinfo_filename,
+ &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Check if there is date string. */
+ if (printinfo -> ux_pictbridge_printinfo_date[0] != '\0')
+ {
+
+ /* Add the line <date> xxxxxxxx </date> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_date,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *) printinfo -> ux_pictbridge_printinfo_date,
+ &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Add the line </printInfo> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_printinfo,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Go to next print info. */
+ printinfo = printinfo -> ux_pictbridge_printinfo_next;
+ }
+
+ /* Add the line </startJob> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_startjob,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c
new file mode 100644
index 0000000..225dac6
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c
@@ -0,0 +1,142 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_object_data_get PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function returns the data of the object. */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_object_data_get(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle, UCHAR *object_buffer, ULONG object_offset,
+ ULONG object_length_requested, ULONG *object_actual_length)
+{
+UX_PICTBRIDGE *pictbridge;
+UX_SLAVE_CLASS_PIMA_OBJECT *object_info;
+UCHAR *pima_object_buffer;
+ULONG actual_length;
+UINT status;
+
+ /* Get the pointer to the Pictbridge instance. */
+ pictbridge = (UX_PICTBRIDGE *)pima -> ux_device_class_pima_application;
+
+ /* Check the object handle. If this is handle 1 or 2 , we need to return the XML script object.
+ If the handle is not 1 or 2, this is a JPEG picture or other object to be printed. */
+ if ((object_handle == UX_PICTBRIDGE_OBJECT_HANDLE_HOST_RESPONSE) || (object_handle == UX_PICTBRIDGE_OBJECT_HANDLE_CLIENT_REQUEST))
+ {
+
+ /* Check what XML object is requested. It is either a request script or a response. */
+ if (object_handle == UX_PICTBRIDGE_OBJECT_HANDLE_HOST_RESPONSE)
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+ else
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_client;
+
+ /* Is this the correct handle ? */
+ if (object_info -> ux_device_class_pima_object_handle_id == object_handle)
+ {
+
+ /* Get the pointer to the object buffer. */
+ pima_object_buffer = object_info -> ux_device_class_pima_object_buffer;
+
+ /* Copy the demanded object data portion. */
+ _ux_utility_memory_copy(object_buffer, pima_object_buffer + object_offset, object_length_requested);
+
+ /* Update the length requested. for a demo, we do not do any checking. */
+ *object_actual_length = object_length_requested;
+
+ /* What cycle are we in ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST)
+ {
+ /* Check if we are blocking for a client request. */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING)
+
+ /* Yes we are pending, send an event to release the pending request. */
+ _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY, TX_OR);
+
+ /* Since we are in host request, this indicates we are done with the cycle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine = UX_PICTBRIDGE_STATE_MACHINE_IDLE;
+
+ }
+
+ /* We have copied the requested data. Return OK. */
+ return(UX_SUCCESS);
+ }
+ }
+ else
+ {
+ /* Get the object info from the job info structure. */
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object;
+
+ /* Obtain the data from the application jobinfo callback. */
+ status = pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object_data_read(pictbridge, object_handle, object_buffer, object_offset,
+ object_length_requested, &actual_length);
+
+ /* Save the length returned. */
+ *object_actual_length = actual_length;
+
+ /* Return the application status. */
+ return(status);
+
+ }
+ /* Could not find the handle. */
+ return(UX_DEVICE_CLASS_PIMA_RC_INVALID_OBJECT_HANDLE);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_send.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_send.c
new file mode 100644
index 0000000..fec5f5b
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_send.c
@@ -0,0 +1,250 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_object_data_send PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function accepts the data of the object. */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_object_data_send(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle,
+ ULONG phase,
+ UCHAR *object_buffer,
+ ULONG object_offset,
+ ULONG object_length)
+{
+UINT status;
+UX_PICTBRIDGE *pictbridge;
+UX_SLAVE_CLASS_PIMA_OBJECT *object_info;
+ULONG event_flag = 0;
+UCHAR *pima_object_buffer;
+
+
+ /* Get the pointer to the Pictbridge instance. */
+ pictbridge = (UX_PICTBRIDGE *)pima -> ux_device_class_pima_application;
+
+ /* Get the pointer to the pima object. */
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+
+ /* Is this the correct handle ? */
+ if (object_info -> ux_device_class_pima_object_handle_id == object_handle)
+ {
+
+ /* Get the pointer to the object buffer. */
+ pima_object_buffer = object_info -> ux_device_class_pima_object_buffer;
+
+ /* Check the phase. We should wait for the object to be completed and the response sent back
+ before parsing the object. */
+ if (phase == UX_DEVICE_CLASS_PIMA_OBJECT_TRANSFER_PHASE_ACTIVE)
+ {
+
+ /* Check if it will fit in our buffer. */
+ if (object_offset + object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Copy the demanded object data portion. */
+ _ux_utility_memory_copy(pima_object_buffer + object_offset, object_buffer, object_length);
+
+ /* Save the length of this object. */
+ object_info -> ux_device_class_pima_object_length = object_length;
+
+ /* We are not done yet. */
+ return(UX_SUCCESS);
+ }
+
+ /* We now have the entire script into memory. Parse the object and execute the script. */
+ status = _ux_pictbridge_object_parse(pictbridge, pima_object_buffer,
+ object_info -> ux_device_class_pima_object_compressed_size);
+
+ /* Analyze the status from the parsing and determine the result code to be sent back. */
+ switch (status)
+ {
+ case UX_SUCCESS :
+
+ /* Set the result code to OK. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_OK;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_IP;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_PARAMETER_UNKNOWN :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_UP;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_PARAMETER_MISSING :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_MP;
+ break;
+
+ default :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_DEFAULT;
+ break;
+ }
+
+ /* We may have a complete event. We only raise the event flag if the completion was successful. */
+ if (pictbridge -> ux_pictbridge_operation_result == UX_PICTBRIDGE_ACTION_RESULT_OK)
+ {
+
+ /* Check what command we got back from the host. */
+ switch (pictbridge -> ux_pictbridge_input_request)
+ {
+
+ case UX_PICTBRIDGE_IR_CONFIGURE_PRINT_SERVICE :
+
+ /* Set event to configure print service. */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_CONFIGURE_PRINT_SERVICE;
+ break;
+
+ case UX_PICTBRIDGE_IR_GET_CAPABILITY :
+
+ /* Set event to capability. */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_CAPABILITY;
+ break;
+
+ case UX_PICTBRIDGE_IR_GET_JOB_STATUS :
+
+ /* Set event to capability. */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_JOB_STATUS;
+ break;
+
+ case UX_PICTBRIDGE_IR_GET_DEVICE_STATUS :
+
+ /* Set event to device status. */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_DEVICE_STATUS;
+ break;
+
+ case UX_PICTBRIDGE_IR_START_JOB :
+
+ /* Set event to start job . */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_START_JOB;
+ break;
+
+ case UX_PICTBRIDGE_IR_ABORT_JOB :
+
+ /* Set event to abort job. */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_ABORT_JOB;
+ break;
+
+ case UX_PICTBRIDGE_IR_CONTINUE_JOB :
+
+ /* Set event to continue job. */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_CONTINUE_JOB;
+ break;
+
+ case UX_PICTBRIDGE_IR_NOTIFY_JOB_STATUS :
+
+ /* Set event to notify job status. */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_JOB_STATUS;
+ break;
+
+ case UX_PICTBRIDGE_IR_NOTIFY_DEVICE_STATUS :
+
+ /* Set event to notify device status. */
+ event_flag = UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_DEVICE_STATUS;
+ break;
+
+
+ default :
+ /* Function not yet supported. */
+ break;
+ }
+
+ /* Send event to the application. */
+ _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group, event_flag, TX_OR);
+
+
+ }
+ else
+ {
+
+ /* We have an error of some kind. Wake up the application with error event. */
+ _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_ERROR, TX_OR);
+
+ }
+
+ /* What cycle are we in ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST)
+ {
+
+ /* Since we are in client request, this indicates we are done with the cycle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine = UX_PICTBRIDGE_STATE_MACHINE_IDLE;
+
+ }
+
+ /* We have executed the script. */
+ return(UX_SUCCESS);
+
+ }
+
+ /* Could not find the handle. */
+ return(UX_DEVICE_CLASS_PIMA_RC_INVALID_OBJECT_HANDLE);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_delete.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_delete.c
new file mode 100644
index 0000000..154f0de
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_delete.c
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_object_delete PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function deletes a local object. */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_object_delete(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle)
+{
+
+ UX_PARAMETER_NOT_USED(pima);
+ UX_PARAMETER_NOT_USED(object_handle);
+
+ /* This function is not really usefull in PictBridge. */
+ return(UX_SUCCESS);
+
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_handles_get.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_handles_get.c
new file mode 100644
index 0000000..a84ac90
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_handles_get.c
@@ -0,0 +1,111 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_object_handles_get PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function returns the handles array. */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_object_handles_get(UX_SLAVE_CLASS_PIMA *pima,
+ ULONG object_handles_format_code,
+ ULONG object_handles_association,
+ ULONG *object_handles_array,
+ ULONG object_handles_max_number)
+{
+UX_PICTBRIDGE *pictbridge;
+UX_SLAVE_CLASS_PIMA_OBJECT *object_info;
+
+ UX_PARAMETER_NOT_USED(object_handles_association);
+ UX_PARAMETER_NOT_USED(object_handles_max_number);
+
+ /* Get the pointer to the Pictbridge instance. */
+ pictbridge = (UX_PICTBRIDGE *) pima -> ux_device_class_pima_application;
+
+ /* Set the pima pointe to the pictbridge instance. */
+ pictbridge -> ux_pictbridge_pima = (VOID *) pima;
+
+ /* We say we have one object but the caller might specify different format code and associations. */
+ object_info = pictbridge -> ux_pictbridge_object_client;
+
+ /* Insert in the array the number of found handles so far : 0. */
+ _ux_utility_long_put((UCHAR *)object_handles_array, 0);
+
+ /* Check the type demanded. */
+ if (object_handles_format_code == 0 || object_handles_format_code == 0xFFFFFFFF ||
+ object_info -> ux_device_class_pima_object_format == object_handles_format_code)
+ {
+
+ /* Insert in the array the number of found handles. This handle is for the client XML script. */
+ _ux_utility_long_put((UCHAR *)object_handles_array, 1);
+
+ /* Adjust the array to point after the number of elements. */
+ object_handles_array++;
+
+ /* We have a candidate. Store the handle. */
+ _ux_utility_long_put((UCHAR *)object_handles_array, object_info -> ux_device_class_pima_object_handle_id);
+
+ }
+
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_info_get.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_info_get.c
new file mode 100644
index 0000000..ac18110
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_info_get.c
@@ -0,0 +1,102 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_object_info_get PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function returns the information of the object. */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_object_info_get(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle,
+ UX_SLAVE_CLASS_PIMA_OBJECT **object)
+{
+
+UX_PICTBRIDGE *pictbridge;
+UX_SLAVE_CLASS_PIMA_OBJECT *object_info;
+
+
+ /* Get the pointer to the Pictbridge instance. */
+ pictbridge = (UX_PICTBRIDGE *)pima -> ux_device_class_pima_application;
+
+ /* Check the object handle. If this is handle 1 or 2 , we need to return the XML script object.
+ If the handle is not 1 or 2, this is a JPEG picture or other object to be printed. */
+ if ((object_handle == UX_PICTBRIDGE_OBJECT_HANDLE_HOST_RESPONSE) || (object_handle == UX_PICTBRIDGE_OBJECT_HANDLE_CLIENT_REQUEST))
+ {
+ /* Check what XML object is requested. It is either a request script or a response. */
+ if (object_handle == UX_PICTBRIDGE_OBJECT_HANDLE_HOST_RESPONSE)
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+ else
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_client;
+ }
+
+ else
+
+ /* Get the object info from the application. */
+ return pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object_info_get(pima, object_handle, object);
+
+ /* Return the pointer to this object. */
+ *object = object_info;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_info_send.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_info_send.c
new file mode 100644
index 0000000..1e14127
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_info_send.c
@@ -0,0 +1,151 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_object_info_send PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* Receive the info data set of a new object to be stored. */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_object_info_send(UX_SLAVE_CLASS_PIMA *pima, UX_SLAVE_CLASS_PIMA_OBJECT *object,
+ ULONG storage_id,
+ ULONG parent_object_handle,
+ ULONG *object_handle)
+{
+UX_PICTBRIDGE *pictbridge;
+UX_SLAVE_CLASS_PIMA_OBJECT *object_info;
+UCHAR string_discovery_name[UX_PICTBRIDGE_MAX_FILE_NAME_SIZE + 1]; /* +1 for null-terminator */
+UINT length, length1;
+
+ UX_PARAMETER_NOT_USED(storage_id);
+ UX_PARAMETER_NOT_USED(parent_object_handle);
+
+ /* Get the pointer to the Pictbridge instance. */
+ pictbridge = (UX_PICTBRIDGE *)pima -> ux_device_class_pima_application;
+
+ /* We only have one object. */
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+
+ /* Copy the demanded object info set. */
+ _ux_utility_memory_copy(object_info, object, UX_SLAVE_CLASS_PIMA_OBJECT_DATA_LENGTH);
+
+ /* Store the object handle. In Pictbridge we only receive XML scripts so the handle is hardwired to 1. */
+ object_info -> ux_device_class_pima_object_handle_id = 1;
+ *object_handle = 1;
+
+ /* Check state machine. If we are in discovery pending mode, check file name of this object. */
+ if (pictbridge -> ux_pictbridge_discovery_state == UX_PICTBRIDGE_DPSCLIENT_DISCOVERY_PENDING)
+ {
+
+ /* We are in the discovery mode. Check for file name. It must match HDISCVRY.DPS in Unicode mode. */
+ /* Check if this is a script. */
+ if (object_info -> ux_device_class_pima_object_format == UX_DEVICE_CLASS_PIMA_OFC_SCRIPT)
+ {
+
+ /* Yes this is a script. We need to search for the HDISCVRY.DPS file name.
+ Get the file name length (without null-terminator). */
+ length1 = (UINT)(*object_info -> ux_device_class_pima_object_filename);
+
+ /* Now, compare it to the HDISCVRY.DPS file name. Check length first. */
+ if (length1 <= UX_PICTBRIDGE_MAX_FILE_NAME_SIZE)
+ {
+
+ /* Invalidate length, on error it's untouched. */
+ length = UX_PICTBRIDGE_MAX_FILE_NAME_SIZE + 1;
+ _ux_utility_string_length_check(_ux_pictbridge_hdiscovery_name, &length, UX_PICTBRIDGE_MAX_FILE_NAME_SIZE);
+ if (length == length1)
+ {
+
+ /* Get the file name in a ascii format (with null-terminator). */
+ _ux_utility_unicode_to_string(object_info -> ux_device_class_pima_object_filename, string_discovery_name);
+
+ /* So far, the length of name of the files are the same.
+ Compare names now (since length is same just compare without null-terminator). */
+ if (_ux_utility_memory_compare(_ux_pictbridge_hdiscovery_name, string_discovery_name,
+ length) == UX_SUCCESS)
+ {
+
+ /* We are done with discovery of the printer. We can now send notifications when the camera wants to print an object. */
+ pictbridge -> ux_pictbridge_discovery_state = UX_PICTBRIDGE_DPSCLIENT_DISCOVERY_COMPLETE;
+
+ /* Set an event flag if the application is listening. */
+ _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_DISCOVERY, TX_OR);
+
+ /* There is no object during the discovery cycle. */
+ return(UX_SUCCESS);
+ }
+ }
+ }
+ }
+ }
+
+ /* What cycle are we in ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine == UX_PICTBRIDGE_STATE_MACHINE_IDLE)
+
+ /* Since we are in idle state, we must have received a request from the host. */
+ pictbridge -> ux_pictbridge_host_client_state_machine = UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST;
+
+
+ /* We have copied the requested data. Return OK. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_number_get.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_number_get.c
new file mode 100644
index 0000000..232cfdb
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_number_get.c
@@ -0,0 +1,84 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_object_number_get PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function returns the number of objects. */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_object_number_get(UX_SLAVE_CLASS_PIMA *pima,
+ ULONG object_format_code,
+ ULONG object_association,
+ ULONG *number_objects)
+{
+
+ UX_PARAMETER_NOT_USED(pima);
+ UX_PARAMETER_NOT_USED(object_format_code);
+ UX_PARAMETER_NOT_USED(object_association);
+
+ /* We force the number of objects to be 1 only here. This will be the xml scripts. */
+ *number_objects = 1;
+
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_register_event_callback_function.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_register_event_callback_function.c
new file mode 100644
index 0000000..bd8d6ca
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_register_event_callback_function.c
@@ -0,0 +1,81 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_stack.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_register_ PORTABLE C */
+/* 6.0 */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function register user callback function */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* event_callback_function Pointer to callback function */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_register_event_callback_function(UX_PICTBRIDGE *pictbridge, UINT (*event_callback_function)(struct UX_PICTBRIDGE_STRUCT *pictbridge, UINT event_flag))
+{
+
+ /* Store the user callback function. */
+ pictbridge -> ux_pictbridge_dps_event_callback_function = event_callback_function;
+
+ /* Always return success. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_start.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_start.c
new file mode 100644
index 0000000..6c6cea7
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_start.c
@@ -0,0 +1,270 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_stack.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_start PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function starts the DPS client (usually a camera or phone) */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpsclient_start(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+UX_SLAVE_CLASS_PIMA_OBJECT *object_info;
+
+ /* Allocate 1 object for the host. */
+ pictbridge -> ux_pictbridge_object_host = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, sizeof(UX_SLAVE_CLASS_PIMA_OBJECT));
+
+ /* Check status. */
+ if (pictbridge -> ux_pictbridge_object_host == UX_NULL)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Initialize status to success for things going on. */
+ status = UX_SUCCESS;
+
+ /* Allocate 1 object for the client. */
+ pictbridge -> ux_pictbridge_object_client = (VOID *)_ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, sizeof(UX_SLAVE_CLASS_PIMA_OBJECT));
+
+ /* Check status. */
+ if (pictbridge -> ux_pictbridge_object_client == UX_NULL)
+ status = (UX_MEMORY_INSUFFICIENT);
+
+ /* Allocate 1 object for the job. */
+ if (status == UX_SUCCESS)
+ {
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object = (VOID *)_ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, sizeof(UX_SLAVE_CLASS_PIMA_OBJECT));
+
+ /* Check status. */
+ if (pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object == UX_NULL)
+ status = (UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Allocate some memory for the XML objects. For the client script. */
+ if (status == UX_SUCCESS)
+ {
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_client;
+ object_info -> ux_device_class_pima_object_buffer = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER);
+
+ /* Check status. */
+ if (object_info -> ux_device_class_pima_object_buffer == UX_NULL)
+ status = (UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Allocate some memory for the XML objects. For the host script. */
+ if (status == UX_SUCCESS)
+ {
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+ object_info -> ux_device_class_pima_object_buffer = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER);
+
+ /* Check status. */
+ if (object_info -> ux_device_class_pima_object_buffer == UX_NULL)
+ return(UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Create a event flag group for the client to communicate with the application. */
+ if (status == UX_SUCCESS)
+ {
+ status = _ux_utility_event_flags_create(&pictbridge -> ux_pictbridge_event_flags_group, "ux_pictbridge_client_event_flag");
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* Do not proceed if error. */
+ status = (UX_EVENT_ERROR);
+ }
+
+ /* Create the semaphore to wake up the thread. */
+ if (status == UX_SUCCESS)
+ {
+ status = _ux_utility_semaphore_create(&pictbridge -> ux_pictbridge_notification_semaphore, "ux_pictbridge_client_semaphore", 0);
+ if (status != UX_SUCCESS)
+
+ /* Do not proceed if error. */
+ status = (UX_SEMAPHORE_ERROR);
+ }
+
+ /* Allocate a Thread stack. */
+ if (status == UX_SUCCESS)
+ {
+ pictbridge -> ux_pictbridge_thread_stack =
+ _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, UX_PICTBRIDGE_THREAD_STACK_SIZE);
+
+ /* Check the completion status. */
+ if (pictbridge -> ux_pictbridge_thread_stack == UX_NULL)
+
+ /* Do not proceed if error. */
+ return(UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Create the pictbridge class thread. */
+ if (status == UX_SUCCESS)
+ {
+ status = _ux_utility_thread_create(&pictbridge -> ux_pictbridge_thread,
+ "ux_pictbridge_thread", _ux_pictbridge_dpsclient_thread,
+ (ULONG)(ALIGN_TYPE) pictbridge,
+ pictbridge -> ux_pictbridge_thread_stack,
+ UX_PICTBRIDGE_THREAD_STACK_SIZE,
+ UX_PICTBRIDGE_THREAD_PRIORITY_CLASS,
+ UX_PICTBRIDGE_THREAD_PRIORITY_CLASS,
+ TX_NO_TIME_SLICE, TX_AUTO_START);
+
+ /* Check the completion status. */
+ if (status != UX_SUCCESS)
+
+ /* Do not proceed if error. */
+ status = (UX_THREAD_ERROR);
+
+ UX_THREAD_EXTENSION_PTR_SET(&(pictbridge -> ux_pictbridge_thread), pictbridge)
+ }
+
+ /* Go on to next step. */
+ if (status == UX_SUCCESS)
+ {
+ /* Initialize the pictbridge request/response state to request expected. */
+ pictbridge -> ux_pictbridge_request_response = UX_PICTBRIDGE_REQUEST;
+
+ /* Set the host/client cycle to idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine = UX_PICTBRIDGE_STATE_MACHINE_IDLE;
+
+ /* Initialize the first XML object valid in the pictbridge instance. Initialize the handle, type and file name.
+ The storage handle and the object handle have a fixed value of 1 in our implementation. */
+ object_info = pictbridge -> ux_pictbridge_object_client;
+ object_info -> ux_device_class_pima_object_format = UX_DEVICE_CLASS_PIMA_OFC_SCRIPT;
+ object_info -> ux_device_class_pima_object_storage_id = 1;
+ object_info -> ux_device_class_pima_object_handle_id = 2;
+ _ux_utility_string_to_unicode(_ux_pictbridge_ddiscovery_name, object_info -> ux_device_class_pima_object_filename);
+
+ /* Initialize the head and tail of the notification round robin buffers.
+ At first, the head and tail are pointing to the beginning of the array. */
+ pictbridge -> ux_pictbridge_event_array_head = pictbridge -> ux_pictbridge_event_array;
+ pictbridge -> ux_pictbridge_event_array_tail = pictbridge -> ux_pictbridge_event_array;
+ pictbridge -> ux_pictbridge_event_array_end = pictbridge -> ux_pictbridge_event_array + UX_PICTBRIDGE_MAX_EVENT_NUMBER;
+
+ /* Initialize the pima device parameter. */
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_manufacturer = pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_vendor_name;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_model = pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_product_name;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_serial_number = pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_serial_no;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_id = 1;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_type = UX_DEVICE_CLASS_PIMA_STC_FIXED_RAM;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_file_system_type = UX_DEVICE_CLASS_PIMA_FSTC_GENERIC_FLAT;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_access_capability = UX_DEVICE_CLASS_PIMA_AC_READ_WRITE;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_max_capacity_low = pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_storage_size;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_max_capacity_high = 0;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_free_space_low = pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_storage_size;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_free_space_high = 0;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_free_space_image = 0;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_description = _ux_pictbridge_volume_description;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_storage_volume_label = _ux_pictbridge_volume_label;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_number_get = _ux_pictbridge_dpsclient_object_number_get;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_handles_get = _ux_pictbridge_dpsclient_object_handles_get;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_info_get = _ux_pictbridge_dpsclient_object_info_get;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_data_get = _ux_pictbridge_dpsclient_object_data_get;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_info_send = _ux_pictbridge_dpsclient_object_info_send;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_data_send = _ux_pictbridge_dpsclient_object_data_send;
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_object_delete = _ux_pictbridge_dpsclient_object_delete;
+
+ /* Store the instance owner. */
+ pictbridge -> ux_pictbridge_pima_parameter.ux_device_class_pima_parameter_application = (VOID *) pictbridge;
+
+ /* Initialize the device pima class. The class is connected with interface 0 */
+ status = _ux_device_stack_class_register(_ux_system_slave_class_pima_name, _ux_device_class_pima_entry,
+ 1, 0, (VOID *)&pictbridge -> ux_pictbridge_pima_parameter);
+ }
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Free resources allocated so far. */
+ if (pictbridge -> ux_pictbridge_thread.tx_thread_id != TX_EMPTY)
+ _ux_utility_thread_delete(&pictbridge -> ux_pictbridge_thread);
+ if (pictbridge -> ux_pictbridge_thread_stack)
+ _ux_utility_memory_free(pictbridge -> ux_pictbridge_thread_stack);
+ if (pictbridge -> ux_pictbridge_notification_semaphore.tx_semaphore_id != TX_EMPTY)
+ _ux_utility_semaphore_delete(&pictbridge -> ux_pictbridge_notification_semaphore);
+ if (pictbridge -> ux_pictbridge_event_flags_group.tx_event_flags_group_id != TX_EMPTY)
+ _ux_utility_event_flags_delete(&pictbridge -> ux_pictbridge_event_flags_group);
+ if (pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object)
+ {
+ _ux_utility_memory_free(pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object);
+ }
+ if (pictbridge -> ux_pictbridge_object_client)
+ {
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_client;
+ if (object_info -> ux_device_class_pima_object_buffer)
+ _ux_utility_memory_free(object_info -> ux_device_class_pima_object_buffer);
+ _ux_utility_memory_free(pictbridge -> ux_pictbridge_object_client);
+ }
+ object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+ if (object_info -> ux_device_class_pima_object_buffer)
+ _ux_utility_memory_free(object_info -> ux_device_class_pima_object_buffer);
+ _ux_utility_memory_free(pictbridge -> ux_pictbridge_object_host);
+
+ /* Do not proceed if error. */
+ return(status);
+ }
+
+ /* We are done. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_thread.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_thread.c
new file mode 100644
index 0000000..e6391e8
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_thread.c
@@ -0,0 +1,208 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_device_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpsclient_thread PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This is the Pictbridge dpsclient thread that receives and execute */
+/* commands from the dpshost. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+VOID _ux_pictbridge_dpsclient_thread(ULONG parameter)
+{
+
+UX_PICTBRIDGE *pictbridge;
+ULONG actual_flags;
+UINT status = UX_SUCCESS;
+ULONG object_length;
+UCHAR *pima_object_buffer;
+UX_SLAVE_CLASS_PIMA *pima;
+UX_SLAVE_CLASS_PIMA_OBJECT *pima_object;
+
+ /* Cast the parameter passed in the thread into the pictbridge pointer. */
+ UX_THREAD_EXTENSION_PTR_GET(pictbridge, UX_PICTBRIDGE, parameter)
+
+ /* Loop forever waiting for changes signaled through the semaphore. */
+ while (1)
+ {
+
+ /* Report errors via error handler. */
+ if (status != UX_SUCCESS)
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, status);
+
+ /* We should wait for the host to send a script with a command. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, (UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_JOB_STATUS |
+ UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_DEVICE_STATUS),
+ TX_OR_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Check the status. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* The event flag is meaningful. What did we get ? */
+ if ((actual_flags & UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_JOB_STATUS) || (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_DEVICE_STATUS))
+ {
+
+ /* We need to send a response now. */
+ /* Get the pima instance from the pictbridge container. */
+ pima = (UX_SLAVE_CLASS_PIMA *) pictbridge -> ux_pictbridge_pima;
+
+ /* Get the address of the object container. We need the host container here, as it is a response for the host. */
+ pima_object = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+
+ /* Get the object buffer address. */
+ pima_object_buffer = pima_object -> ux_device_class_pima_object_buffer;
+
+ /* Reset the object length. */
+ object_length = 0;
+
+ /* Clear the object memory buffer. */
+ _ux_utility_memory_set(pima_object_buffer, 0, UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER);
+
+ /* Add the line <?xml version="1.0"?> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_xmlversion,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Add the line <dps xmlns="http://www.cipa.jp/dps/schema/"> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsxmlns,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Add the line <output> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_output,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Add the line <result> xxxxxxxx </result> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_result,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_operation_result, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Check what function was demanded. */
+ if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_NOTIFY_JOB_STATUS)
+
+ /* Add the line <notifyJobStatus/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_notifyjobstatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+
+ else
+
+
+ /* Add the line <notifyDeviceStatus/> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_notifydevicestatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Add the line </output> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_output,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Add the line </dps> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dps,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Get the length of the object and store it into the object data set. */
+ pima_object -> ux_device_class_pima_object_length = object_length;
+ pima_object -> ux_device_class_pima_object_compressed_size = object_length;
+
+ /* Save the handle for this object. */
+ pima_object -> ux_device_class_pima_object_handle_id = UX_PICTBRIDGE_OBJECT_HANDLE_HOST_RESPONSE;
+
+ /* We need to change the file name to DRSPONSE.DPS. Encode the file name from ascii format into Unicode. */
+ _ux_utility_string_to_unicode(_ux_pictbridge_drsponse_name, pima_object -> ux_device_class_pima_object_filename);
+
+ /* Send the notification to the host that an object has been added. */
+ status = _ux_device_class_pima_object_add(pima, UX_PICTBRIDGE_OBJECT_HANDLE_HOST_RESPONSE);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Check if user registered callback function is present. */
+ if (pictbridge -> ux_pictbridge_dps_event_callback_function != UX_NULL)
+ {
+
+ /* Call the user callback function. */
+ (pictbridge -> ux_pictbridge_dps_event_callback_function)(pictbridge, actual_flags);
+ }
+
+ }
+ }
+ }
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_device_status.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_device_status.c
new file mode 100644
index 0000000..76f2231
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_device_status.c
@@ -0,0 +1,160 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_input_object_notify__device_status */
+/* PORTABLE C */
+/* 6.0 */
+
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the input object for the */
+/* notification of the device status. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_input_object_notify_device_status(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated)
+{
+
+UINT status = UX_SUCCESS;
+
+
+ /* Add the line <notifyDeviceStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_notifydevicestatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <dpsPrintserviceStatus> xxxxxxxx </dpsPrintserviceStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsprintservicestatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <jobEndReason> xxxxxxxx </jobEndReason> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_jobendreason,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_jobendreason, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <errorStatus> xxxxxxxx </errorStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_errorstatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_errorstatus, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <errorReason> xxxxxxxx </errorReason> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_errorreason,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_errorreason, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <disconnectEnable> xxxxxxxx </disconnectEnable> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_disconnectenable,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_disconnectenable, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <capabilityChanged> xxxxxxxx </capabilityChanged> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_capabilitychanged,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_capabilitychanged, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <newJobOK> xxxxxxxx </newJobOK> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_newjobok,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </notifyDeviceStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_notifydevicestatus,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(status);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c
new file mode 100644
index 0000000..5f5092d
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c
@@ -0,0 +1,163 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_input_object_notify_job_status */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the input object for the */
+/* notification of the job status. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* _device_status */
+/* */
+/* CALLED BY */
+/* */
+/* */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_input_object_notify_job_status(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated)
+{
+UX_PICTBRIDGE_JOBINFO *jobinfo;
+UX_PICTBRIDGE_PRINTINFO *printinfo;
+UINT status = UX_SUCCESS;
+
+ /* Get the jobinfo structure pointer. */
+ jobinfo = &pictbridge -> ux_pictbridge_jobinfo;
+
+ /* Get the current printinfo structure. */
+ printinfo = jobinfo -> ux_pictbridge_jobinfo_printinfo_current;
+
+ /* Add the line <notifyJobStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_notifyjobstatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <progress> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_progress,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Insert 001/001 from current page/total pages in the current printjob. */
+
+ /* Check length to go. */
+ object_length += 7;
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ status = UX_MEMORY_INSUFFICIENT;
+
+ /* Insert xxx decimal. */
+ status = _ux_pictbridge_hexa_to_decimal_string(printinfo -> ux_pictbridge_printinfo_current_page, pima_object_buffer, UX_PICTBRIDGE_LEADING_ZERO_ON, 3);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the address of the destination. */
+ pima_object_buffer += 3;
+
+ /* Insert the '/' between both pages. */
+ *pima_object_buffer++ = '/';
+
+ /* Insert the decimal value of total pages. */
+ status = _ux_pictbridge_hexa_to_decimal_string(printinfo -> ux_pictbridge_printinfo_total_page, pima_object_buffer, UX_PICTBRIDGE_LEADING_ZERO_ON, 3);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the address. */
+ pima_object_buffer += 3;
+
+ /* Add the line </progress> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_progress,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <imagesPrinted> xxxxxxxx </imagesPrinted> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_imagesprinted,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_DECIMAL_3DIGITS,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) printinfo -> ux_pictbridge_printinfo_images_printed, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </notifyJobStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_notifyjobstatus,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_send.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_send.c
new file mode 100644
index 0000000..05deb33
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_send.c
@@ -0,0 +1,373 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_input_object_send PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates an input report for the dpshost */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_function input tag */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_input_object_send(UX_PICTBRIDGE *pictbridge, ULONG input_function)
+{
+UINT status;
+ULONG object_length;
+UCHAR *pima_object_buffer;
+UX_HOST_CLASS_PIMA *pima;
+UX_HOST_CLASS_PIMA_SESSION *pima_session;
+UX_HOST_CLASS_PIMA_OBJECT *pima_object;
+ULONG requested_length;
+ULONG object_handle;
+ULONG actual_flags;
+
+ /* Check the state machine. */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine != UX_PICTBRIDGE_STATE_MACHINE_IDLE)
+ {
+
+ /* Set the state machine to Host Request pending. */
+ pictbridge -> ux_pictbridge_host_client_state_machine |= UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST_PENDING;
+
+ /* Wait for the client event pending request to be completed. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Reset the state machine to not Host Request pending. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST_PENDING;
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(UX_ERROR);
+
+ }
+
+ /* Change state machine to host request pending. */
+ pictbridge -> ux_pictbridge_host_client_state_machine |= UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST;
+
+ /* Get the pima instance from the pictbridge container. */
+ pima = (UX_HOST_CLASS_PIMA *) pictbridge -> ux_pictbridge_pima;
+
+ /* And now the session since we use it. */
+ pima_session = (UX_HOST_CLASS_PIMA_SESSION *)pictbridge -> ux_pictbridge_session;
+
+ /* Get the address of the object container. */
+ pima_object = (UX_HOST_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+
+ /* Get the object buffer address. */
+ pima_object_buffer = pima_object -> ux_host_class_pima_object_buffer;
+
+ /* Reset the object length. */
+ object_length = 0;
+
+ /* Clear the object memory buffer. */
+ _ux_utility_memory_set(pima_object_buffer, 0, UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER);
+
+ /* Add the line <?xml version="1.0"?> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_xmlversion,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <dps xmlns="http://www.cipa.jp/dps/schema/"> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsxmlns,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+
+ /* Add the line <input> */
+ if (status == UX_SUCCESS)
+ {
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_input,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ }
+
+ /* Look into the tag code from the input object and proceed to individual functions. */
+ if (status == UX_SUCCESS)
+ {
+ switch (input_function)
+ {
+
+ case UX_PICTBRIDGE_IR_NOTIFY_JOB_STATUS :
+
+ /* Insert the notifyJobStatus tag lines. */
+ status = _ux_pictbridge_dpshost_input_object_notify_job_status(pictbridge, pima_object_buffer, object_length, &pima_object_buffer, &object_length);
+ break;
+
+ case UX_PICTBRIDGE_IR_NOTIFY_DEVICE_STATUS :
+
+ /* Insert the notifyDeviceStatus tag lines. */
+ status = _ux_pictbridge_dpshost_input_object_notify_device_status(pictbridge, pima_object_buffer, object_length, &pima_object_buffer, &object_length);
+ break;
+
+ default :
+
+ /* Function not yet supported. We should never come here anyway. */
+ status = UX_ERROR;
+
+ }
+ }
+
+ /* Add the line </input> */
+ if (status == UX_SUCCESS)
+ {
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_input,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ }
+
+ /* Add the line </dps> */
+ if (status == UX_SUCCESS)
+ {
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dps,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ }
+
+ /* Handle error. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Do we have a pending client event ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING)
+ {
+
+ /* Yes, so we need to set the event that advertise the completion of the host request. */
+ _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND);
+
+ }
+
+ /* Change state machine to idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST;
+ return(UX_ERROR);
+ }
+
+ /* Store the length of the new object waiting to be sent out.
+ We do not store the length into the object itself since this function is
+ host\client agnostic. */
+ pima_object -> ux_host_class_pima_object_length = object_length;
+
+ /* Get the length of the object and store it into the object data set. */
+ pima_object -> ux_host_class_pima_object_compressed_size = object_length;
+
+ /* We need to change the file name to HREQUEST.DPS. Encode the file name from ascii format into Unicode. */
+ _ux_utility_string_to_unicode(_ux_pictbridge_hrequest_name, pima_object -> ux_host_class_pima_object_filename);
+
+ /* Set the object handle. */
+ object_handle = 1;
+
+ /* Send a script info. */
+ status = _ux_host_class_pima_object_info_send(pima, pima_session, 0, 0, pima_object);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Do we have a pending client event ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING)
+ {
+
+ /* Yes, so we need to set the event that advertise the completion of the host request. */
+ status = _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND);
+
+ }
+
+ /* Change state machine to idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST;
+
+ /* Return status. */
+ return(status);
+ }
+
+
+
+
+ /* Open the object. */
+ status = _ux_host_class_pima_object_open(pima, pima_session,
+ object_handle,
+ pima_object);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Do we have a pending client event ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING)
+ {
+
+ /* Yes, so we need to set the event that advertise the completion of the host request. */
+ status = _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND);
+
+ }
+
+ /* Change state machine to idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST;
+
+ /* Return status. */
+ return(status);
+ }
+
+ /* Get the object length. */
+ object_length = pima_object -> ux_host_class_pima_object_compressed_size;
+
+ /* Recall the object buffer address. */
+ pima_object_buffer = pima_object -> ux_host_class_pima_object_buffer;
+
+ /* Send all the object data. */
+ while(object_length != 0)
+ {
+
+ /* Calculate what length to request. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+
+ /* Request maximum length. */
+ requested_length = UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER;
+
+ else
+
+ /* Request remaining length. */
+ requested_length = object_length;
+
+
+ /* Send the object data. */
+ status = _ux_host_class_pima_object_send(pima, pima_session, pima_object,
+ pima_object_buffer, requested_length);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Abort the transfer. */
+ _ux_host_class_pima_object_transfer_abort(pima, pima_session, object_handle, pima_object);
+
+ /* Do we have a pending client event ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING)
+ {
+
+ /* Yes, so we need to set the event that advertise the completion of the host request. */
+ status = _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND);
+
+ }
+
+ /* Change state machine to idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST;
+
+ /* Return status. */
+ return(status);
+
+ }
+
+ /* We have sent some data, update the length remaining. */
+ object_length -= requested_length;
+ }
+
+ /* Close the object. */
+ status = _ux_host_class_pima_object_close(pima, pima_session, object_handle, pima_object);
+
+ /* Check the status. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Do we have a pending client event ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING)
+ {
+
+ /* Yes, so we need to set the event that advertise the completion of the host request. */
+ status = _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND);
+
+ }
+
+ /* Change state machine to idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST;
+
+ /* Return status. */
+ return(status);
+ }
+
+
+ /* Wait for the response from the device. */
+ status = _ux_pictbridge_dpshost_response_get(pictbridge);
+
+
+ /* Do we have a pending client event ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING)
+ {
+
+ /* Yes, so we need to set the event that advertise the completion of the host request. */
+ status = _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND);
+
+ }
+
+ /* Change state machine to idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_HOST_REQUEST;
+
+ /* Return status. */
+ return(status);
+
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_notification_callback.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_notification_callback.c
new file mode 100644
index 0000000..f965b1a
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_notification_callback.c
@@ -0,0 +1,119 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_notification_callback PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function gets a notification of an event and passes it to */
+/* a pictbridge thread. */
+/* */
+/* INPUT */
+/* */
+/* pima_event Event notification structure */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+VOID _ux_pictbridge_dpshost_notification_callback(UX_HOST_CLASS_PIMA_EVENT *pima_event)
+{
+
+UX_HOST_CLASS_PIMA *pima;
+UX_PICTBRIDGE *pictbridge;
+UX_PICTBRIDGE_EVENT *pictbridge_next_event;
+UX_PICTBRIDGE_EVENT *pictbridge_event;
+
+ /* Get the pointer to the Pima instance. */
+ pima = pima_event -> ux_host_class_pima_event_pima_instance;
+
+ /* Get the pointer to the Pictbridge application. */
+ pictbridge = (UX_PICTBRIDGE *) pima -> ux_host_class_pima_application;
+
+ /* Compute the next entry in the event array. */
+ if ((pictbridge -> ux_pictbridge_event_array_head + 1) == pictbridge -> ux_pictbridge_event_array_end)
+
+ /* Start at the beginning of the list. */
+ pictbridge_next_event = pictbridge -> ux_pictbridge_event_array;
+ else
+
+ /* Point to the next entry in the event array. */
+ pictbridge_next_event = pictbridge -> ux_pictbridge_event_array_head + 1;
+
+ /* Check to see if we can store this event. */
+ if (pictbridge_next_event == pictbridge -> ux_pictbridge_event_array_tail)
+
+ /* No place to store this event, throw it away. */
+ return;
+
+ /* Current storage is in the current head. */
+ pictbridge_event = pictbridge -> ux_pictbridge_event_array_head;
+
+ /* Store the event in the pictbridge event queue. */
+ pictbridge_event -> ux_pictbridge_event_code = pima_event -> ux_host_class_pima_event_code;
+ pictbridge_event -> ux_pictbridge_event_parameter_1 = pima_event -> ux_host_class_pima_event_parameter_1;
+ pictbridge_event -> ux_pictbridge_event_parameter_2 = pima_event -> ux_host_class_pima_event_parameter_2;
+ pictbridge_event -> ux_pictbridge_event_parameter_3 = pima_event -> ux_host_class_pima_event_parameter_3;
+
+ /* Advance the pictbridge event queue head. */
+ pictbridge -> ux_pictbridge_event_array_head = pictbridge_next_event;
+
+ /* Wake up the Pictbridge notification handler thread. */
+ _ux_utility_semaphore_put(&pictbridge -> ux_pictbridge_notification_semaphore);
+
+ /* We are done. */
+ return;
+
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_object_get.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_object_get.c
new file mode 100644
index 0000000..8ae7905
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_object_get.c
@@ -0,0 +1,303 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_object_get PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function obtains an object and execute its script. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* object_handle Object handle */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_thread */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_object_get(UX_PICTBRIDGE *pictbridge, ULONG object_handle)
+{
+UINT status;
+UX_HOST_CLASS_PIMA *pima;
+UX_HOST_CLASS_PIMA_SESSION *pima_session;
+UX_HOST_CLASS_PIMA_OBJECT *pima_object;
+ULONG object_length;
+ULONG requested_length;
+ULONG actual_length;
+UCHAR *object_buffer;
+UCHAR object_file_name[UX_PICTBRIDGE_MAX_FILE_NAME_SIZE + 1]; /* +1 for null-terminator */
+UINT length, length1;
+
+ /* Get the pima instance from the pictbridge container. */
+ pima = (UX_HOST_CLASS_PIMA *) pictbridge -> ux_pictbridge_pima;
+
+ /* And now the session since we use it. */
+ pima_session = (UX_HOST_CLASS_PIMA_SESSION *) pictbridge -> ux_pictbridge_session;
+
+ /* Get the address of the object container. */
+ pima_object = (UX_HOST_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+
+ /* Get the object info structure. */
+ status = _ux_host_class_pima_object_info_get(pima, pima_session,
+ object_handle, pima_object);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Return an error. */
+ return(UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE);
+ }
+
+ /* Check if this is a script. If the object is not a script or does not contain the
+ File Name we expect, we ignore it. */
+ if (pima_object -> ux_host_class_pima_object_format == UX_HOST_CLASS_PIMA_OFC_SCRIPT)
+ {
+
+ /* Yes this is a script. We need to search for the DREQUEST.DPS file name.
+ Get the file name length (without null-terminator). */
+ length1 = (UINT)(*pima_object -> ux_host_class_pima_object_filename);
+
+ /* Check the file name from this script. It should be in the form DREQUEST.DPS. */
+ if (length1 <= UX_PICTBRIDGE_MAX_FILE_NAME_SIZE)
+ {
+
+ /* Invalidate length, on error it's untouched. */
+ length = UX_PICTBRIDGE_MAX_FILE_NAME_SIZE + 1;
+ _ux_utility_string_length_check(_ux_pictbridge_drequest_name, &length, UX_PICTBRIDGE_MAX_FILE_NAME_SIZE);
+ if (length == length1)
+ {
+
+ /* Get the file name in a ascii format (with null-terminator). */
+ _ux_utility_unicode_to_string(pima_object -> ux_host_class_pima_object_filename, object_file_name);
+
+ /* So far, the length of name of the files are the same.
+ Compare names now (since length is same just compare without null-terminator). */
+ if (_ux_utility_memory_compare(_ux_pictbridge_drequest_name, object_file_name,
+ length) == UX_SUCCESS)
+ {
+
+ /* Yes this is a script. Get the entire object in memory. */
+ /* Get script length from the object info. */
+ object_length = pima_object -> ux_host_class_pima_object_compressed_size;
+
+ /* Check for overflow. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_BUFFER_OVERFLOW);
+
+ /* Open the object. */
+ status = _ux_host_class_pima_object_open(pima, pima_session, object_handle, pima_object);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Set the object buffer pointer. */
+ object_buffer = pima_object -> ux_host_class_pima_object_buffer;
+
+ /* Obtain all the object data. */
+ while(object_length != 0)
+ {
+
+ /* Calculate what length to request. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+
+ /* Request maximum length. */
+ requested_length = UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER;
+
+ else
+
+ /* Request remaining length. */
+ requested_length = object_length;
+
+ /* Get the object data. */
+ status = _ux_host_class_pima_object_get(pima, pima_session, object_handle, pima_object,
+ object_buffer, requested_length, &actual_length);
+ if (status != UX_SUCCESS)
+ {
+
+ /* We had a problem, abort the transfer. */
+ _ux_host_class_pima_object_transfer_abort(pima, pima_session, object_handle, pima_object);
+
+ /* And close the object. */
+ _ux_host_class_pima_object_close(pima, pima_session, object_handle, pima_object);
+
+ return(status);
+ }
+
+ /* We have received some data, update the length remaining. */
+ object_length -= actual_length;
+
+ /* Update the buffer address. */
+ object_buffer += actual_length;
+ }
+
+ /* Close the object. */
+ status = _ux_host_class_pima_object_close(pima, pima_session, object_handle, pima_object);
+
+ /* Check the error. */
+ if (status != UX_SUCCESS)
+ return(UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE);
+
+ /* We now have the entire script into memory. Parse the object and execute the script. */
+ status = _ux_pictbridge_object_parse(pictbridge, pima_object -> ux_host_class_pima_object_buffer,
+ pima_object -> ux_host_class_pima_object_compressed_size);
+
+ /* Analyze the status from the parsing and determine the result code to be sent back. */
+ switch (status)
+ {
+ case UX_SUCCESS :
+
+ /* Set the result code to OK. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_OK;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_IP;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_PARAMETER_UNKNOWN :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_UP;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_PARAMETER_MISSING :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_MP;
+ break;
+
+ default :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_DEFAULT;
+ break;
+ }
+
+ /* We have completed the parsing of the XML object. We will send an object back to the client.
+ Generate the output report. */
+ status = _ux_pictbridge_dpshost_output_object_create(pictbridge);
+
+ /* Get the length of the object and store it into the object data set. */
+ pima_object -> ux_host_class_pima_object_compressed_size = pima_object -> ux_host_class_pima_object_length;
+
+ /* We need to change the file name to DRSPONSE.DPS. Encode the file name from ascii format into Unicode. */
+ _ux_utility_string_to_unicode(_ux_pictbridge_hrsponse_name, pima_object -> ux_host_class_pima_object_filename);
+
+ /* Send a script info. */
+ status = _ux_host_class_pima_object_info_send(pima, pima_session, 0, 0, pima_object);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Open the object. */
+ status = _ux_host_class_pima_object_open(pima, pima_session,
+ object_handle,
+ pima_object);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the object length. */
+ object_length = pima_object -> ux_host_class_pima_object_compressed_size;
+
+ /* Recall the object buffer address. */
+ object_buffer = pima_object -> ux_host_class_pima_object_buffer;
+
+ /* Send all the object data. */
+ while(object_length != 0)
+ {
+
+ /* Calculate what length to request. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+
+ /* Request maximum length. */
+ requested_length = UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER;
+
+ else
+
+ /* Request remaining length. */
+ requested_length = object_length;
+
+
+ /* Send the object data. */
+ status = _ux_host_class_pima_object_send(pima, pima_session, pima_object,
+ object_buffer, requested_length);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Abort the transfer. */
+ _ux_host_class_pima_object_transfer_abort(pima, pima_session, object_handle, pima_object);
+
+ return(status);
+ }
+
+ /* We have sent some data, update the length remaining. */
+ object_length -= requested_length;
+ }
+
+ /* Close the object. */
+ status = _ux_host_class_pima_object_close(pima, pima_session, object_handle, pima_object);
+
+ /* Check the status. */
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+ }
+ }
+ }
+
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c
new file mode 100644
index 0000000..b24031a
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c
@@ -0,0 +1,154 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_output_object_configure PORTABLE C */
+/* _print_service */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the configure_print_service */
+/* request. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_object_get */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _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)
+{
+
+UINT status;
+
+
+ /* Add the line <configurePrintService> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_configureprintservice,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <printServiceAvailable> xxxxxxxx </printServiceAvailable> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_printserviceavailable,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_print_service_available, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <dpsVersions>major_minor major_minor</dpsVersions> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsversions,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_MAJOR_MINOR,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsversions, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+
+ /* Add the line <vendorName> ascii_string </vendorName> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_vendorname,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_product_name, &pima_object_buffer, &object_length);
+
+
+ /* Add the line <vendorSpecificVersion> major_minor </vendorSpecificVersion> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_vendorspecificversion,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_MAJOR_MINOR,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_vendor_specific_version, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+
+ /* Add the line <productName> ascii_string </productName> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_productname,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_product_name, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+
+ /* Add the line <serialNo> ascii_string </serialNo> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_serialno,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_serial_no, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+
+ /* Add the line </configurePrintService> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_configureprintservice,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_create.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_create.c
new file mode 100644
index 0000000..7b08340
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_create.c
@@ -0,0 +1,186 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_output_object_create PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates an output report based on the parsing of */
+/* a previous input object. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_object_get */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_output_object_create(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+ULONG object_length;
+UCHAR *pima_object_buffer;
+UX_HOST_CLASS_PIMA_OBJECT *pima_object;
+
+ /* Get the address of the object container. */
+ pima_object = (UX_HOST_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+
+ /* And its buffer address. */
+ pima_object_buffer = pima_object -> ux_host_class_pima_object_buffer;
+
+ /* Reset the object length. */
+ object_length = 0;
+
+ /* Clear the object memory buffer. */
+ _ux_utility_memory_set(pima_object_buffer, 0, UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER);
+
+
+ /* Add the line <?xml version="1.0"?> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_xmlversion,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <dps xmlns="http://www.cipa.jp/dps/schema/"> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsxmlns,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <output> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_output,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <result> xxxxxxxx </result> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_result,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_operation_result, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Look into the tag code from the input object and proceed to individual functions. */
+ switch (pictbridge -> ux_pictbridge_input_request)
+ {
+
+ case UX_PICTBRIDGE_IR_CONFIGURE_PRINT_SERVICE :
+
+ /* Insert the ConfigurePrintService tag lines. */
+ status = _ux_pictbridge_dpshost_output_object_configure_print_service(pictbridge, pima_object_buffer, object_length, &pima_object_buffer, &object_length);
+ break;
+
+ case UX_PICTBRIDGE_IR_GET_CAPABILITY :
+
+ /* Insert the Getcapability tag lines. */
+ status = _ux_pictbridge_dpshost_output_object_get_capability(pictbridge, pima_object_buffer, object_length, &pima_object_buffer, &object_length);
+ break;
+ case UX_PICTBRIDGE_IR_GET_JOB_STATUS :
+ case UX_PICTBRIDGE_IR_GET_DEVICE_STATUS :
+
+ /* Insert the getDeviceStatus tag lines. */
+ status = _ux_pictbridge_dpshost_output_object_get_device_status(pictbridge, pima_object_buffer, object_length, &pima_object_buffer, &object_length);
+ break;
+ case UX_PICTBRIDGE_IR_START_JOB :
+
+ /* The Start Job adds the line </startJob> after the result. Weird syntax ! */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_startjob,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF | UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+
+
+ status = UX_SUCCESS;
+ break;
+
+ case UX_PICTBRIDGE_IR_ABORT_JOB :
+ case UX_PICTBRIDGE_IR_CONTINUE_JOB :
+ case UX_PICTBRIDGE_IR_NOTIFY_JOB_STATUS :
+ case UX_PICTBRIDGE_IR_NOTIFY_DEVICE_STATUS :
+
+ default :
+ /* Function not yet supported. */
+
+ /* We have a syntax error ! */
+ status = (UX_ERROR);
+ }
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </output> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_output,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </dps> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dps,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Store the length of the new object waiting to be sent out.
+ We do not store the length into the object itself since this function is
+ host\client agnostic. */
+ pima_object -> ux_host_class_pima_object_length = object_length;
+
+ /* Return completion status. */
+ return(status);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_get_capability.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_get_capability.c
new file mode 100644
index 0000000..1177ae6
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_get_capability.c
@@ -0,0 +1,275 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_output_object_get_capability PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the get_capability request */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_object_get */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_output_object_get_capability(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated)
+{
+
+UINT status;
+
+ /* Add the line <getcapability> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_getcapability,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+
+ /* Add the line <capability> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_capability,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_QUALITIES)
+ {
+ /* Add the line <qualities> xxxxxxxx </qualities> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_qualities,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0, (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_qualities, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_PAPER_SIZES)
+ {
+ /* Add the line <paperSizes> xxxxxxxx </paperSizes> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_papersizes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0, (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_papersizes, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_PAPER_TYPES)
+ {
+
+ /* Check if we had a paper size value specified in the input report. */
+ if (pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_papertypes_papersize != 0)
+
+ /* Add the line <paperTypes paperSize = "xxxxxxxx"> xxxxxxxx yyyyyyyy </paperTypes> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_papertypes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ _ux_pictbridge_xml_variable_papersize, pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_papertypes_papersize,
+ (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_papertypes, &pima_object_buffer, &object_length);
+
+ else
+
+ /* Add the line <paperTypes> xxxxxxxx yyyyyyyy </paperTypes> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_papertypes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0,
+ (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_papertypes, &pima_object_buffer, &object_length);
+
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_FILE_TYPES)
+ {
+ /* Add the line <fileTypes> xxxxxxxx </fileTypes> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_filetypes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0, (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_filetypes, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_DATE_PRINTS)
+ {
+ /* Add the line <datePrints> xxxxxxxx </datePrints> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dateprints,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0, (VOID *) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dateprints, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_FILE_NAME_PRINTS)
+ {
+ /* Add the line <namePrints> xxxxxxxx </namePrints> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_filenameprints,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0, (VOID *) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_filenameprints, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_IMAGE_OPTIMIZES)
+ {
+ /* Add the line <imageOptimizes> xxxxxxxx </imageOptimizes> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_imageoptimizes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0, (VOID *) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_imageoptimizes, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_LAYOUTS)
+ {
+
+ /* Check if we had a paper size value specified in the input report. */
+ if (pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_layouts_papersize != 0)
+
+
+ /* Add the line <layouts paperSize = "xxxxxxxx"> xxxxxxxx yyyyyyyy </layouts> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_layouts,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ _ux_pictbridge_xml_variable_papersize, pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_layouts_papersize,
+ (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_layouts, &pima_object_buffer, &object_length);
+
+ else
+
+ /* Add the line <layouts> xxxxxxxx yyyyyyyy </layouts> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_layouts,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0,
+ (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_layouts, &pima_object_buffer, &object_length);
+
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_FIXED_SIZES)
+ {
+ /* Add the line <fixedSizes> xxxxxxxx yyyyyyyy </fixedSizes> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_fixedsizes,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0,
+ (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_fixedsizes, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_CROPPINGS)
+ {
+ /* Add the line <croppings> xxxxxxxx yyyyyyyy</croppings> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_croppings,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0, (VOID *) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_croppings, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_CHAR_REPERTOIRES)
+ {
+ /* Add the line <charRepertoires> xxxxxxxx yyyyyyyy </charRepertoires> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_charrepertoires,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA,
+ UX_NULL, 0,
+ (VOID *) &pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_charrepertoires, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+
+ /* Add the line </capability> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_capability,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+
+ /* Add the line </getcapability> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_getcapability,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_get_device_status.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_get_device_status.c
new file mode 100644
index 0000000..8425cdd
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_get_device_status.c
@@ -0,0 +1,157 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_output_object_get_device_status */
+/* PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function creates the tag lines of the get_capability request */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_object_get */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_output_object_get_device_status(UX_PICTBRIDGE *pictbridge,
+ UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated)
+{
+
+UINT status;
+
+
+ /* Add the line <getDeviceStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_getdevicestatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_FORCE_LF,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <dpsPrintserviceStatus> xxxxxxxx </dpsPrintserviceStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_dpsprintservicestatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <jobEndReason> xxxxxxxx </jobEndReason> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_jobendreason,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_jobendreason, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <errorStatus> xxxxxxxx </errorStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_errorstatus,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_errorstatus, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <errorReason> xxxxxxxx </errorReason> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_errorreason,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_errorreason, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <disconnectEnable> xxxxxxxx </disconnectEnable> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_disconnectenable,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_disconnectenable, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <capabilityChanged> xxxxxxxx </capabilityChanged> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_capabilitychanged,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_capabilitychanged, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line <newJobOK> xxxxxxxx </newJobOK> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_newjobok,
+ UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA,
+ UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Add the line </getDeviceStatus> */
+ status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_getdevicestatus,
+ UX_PICTBRIDGE_TAG_FLAG_END,
+ UX_NULL, 0, UX_NULL, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_response_get.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_response_get.c
new file mode 100644
index 0000000..325d1fe
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_response_get.c
@@ -0,0 +1,287 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_response_get PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function obtains a response. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_thread */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_response_get(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+UX_HOST_CLASS_PIMA *pima;
+UX_HOST_CLASS_PIMA_SESSION *pima_session;
+UX_HOST_CLASS_PIMA_OBJECT *pima_object;
+ULONG object_length;
+ULONG requested_length;
+ULONG actual_length;
+UCHAR *object_buffer;
+UCHAR object_file_name[UX_PICTBRIDGE_MAX_FILE_NAME_SIZE + 1]; /* +1 for null-terminator */
+ULONG object_handle;
+UX_PICTBRIDGE_EVENT *pictbridge_event;
+UINT length, length1;
+
+ /* Get the pima instance from the pictbridge container. */
+ pima = (UX_HOST_CLASS_PIMA *) pictbridge -> ux_pictbridge_pima;
+
+ /* And now the session since we use it. */
+ pima_session = (UX_HOST_CLASS_PIMA_SESSION *) pictbridge -> ux_pictbridge_session;
+
+ /* Get the address of the object container. */
+ pima_object = (UX_HOST_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+
+ /* Wait for the semaphore to be put by the root hub or a regular hub. */
+ _ux_utility_semaphore_get(&pictbridge -> ux_pictbridge_notification_semaphore, UX_WAIT_FOREVER);
+
+ /* Check if there is an event. Normally there should be at least one since we got awaken. */
+ if (pictbridge -> ux_pictbridge_event_array_tail != pictbridge -> ux_pictbridge_event_array_head)
+ {
+
+ /* Get the current event tail. */
+ pictbridge_event = pictbridge -> ux_pictbridge_event_array_tail;
+
+ /* Analyze the event type. */
+ switch (pictbridge_event -> ux_pictbridge_event_code)
+ {
+
+
+ /* The DSC client is informing us that an object is ready. */
+ case UX_PICTBRIDGE_EC_OBJECT_ADDED :
+ case UX_PICTBRIDGE_EC_REQUEST_OBJECT_TRANSFER :
+
+ /* Obtain the object handle. */
+ object_handle = pictbridge_event -> ux_pictbridge_event_parameter_1;
+ break;
+
+ default :
+ return(UX_ERROR);
+ }
+
+ /* Compute the next entry in the event array. */
+ if ((pictbridge -> ux_pictbridge_event_array_tail + 1) == pictbridge -> ux_pictbridge_event_array_end)
+
+ /* Start at the beginning of the list. */
+ pictbridge_event = pictbridge -> ux_pictbridge_event_array;
+ else
+
+ /* Point to the next entry in the event array. */
+ pictbridge_event = pictbridge -> ux_pictbridge_event_array_tail + 1;
+
+ /* Now, store the new event tail. */
+ pictbridge -> ux_pictbridge_event_array_tail = pictbridge_event;
+
+ }
+
+ else
+
+ /* We have an error. Got awaken for nothing ! */
+ return(UX_ERROR);
+
+ /* Get the object info structure. */
+ status = _ux_host_class_pima_object_info_get(pima, pima_session,
+ object_handle, pima_object);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Return an error. */
+ return(UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE);
+ }
+
+ /* Check if this is a script. If the object is not a script or does not contain the
+ File Name we expect, we ignore it. */
+ if (pima_object -> ux_host_class_pima_object_format == UX_HOST_CLASS_PIMA_OFC_SCRIPT)
+ {
+
+ /* Yes this is a script. We need to search for the DRSPONSE.DPS file name.
+ Get the file name length (without null-terminator). */
+ length1 = (UINT)(*pima_object -> ux_host_class_pima_object_filename);
+
+ /* Check the file name from this script. It should be in the form DRSPONSE.DPS. */
+ if (length1 <= UX_PICTBRIDGE_MAX_FILE_NAME_SIZE)
+ {
+
+ /* Invalidate length, on error it's untouched. */
+ length = UX_PICTBRIDGE_MAX_FILE_NAME_SIZE + 1;
+ _ux_utility_string_length_check(_ux_pictbridge_drsponse_name, &length, UX_PICTBRIDGE_MAX_FILE_NAME_SIZE);
+ if (length == length1)
+ {
+
+ /* Get the file name in a ascii format (with null-terminator). */
+ _ux_utility_unicode_to_string(pima_object -> ux_host_class_pima_object_filename, object_file_name);
+
+ /* So far, the length of name of the files are the same.
+ Compare names now (since length is same just compare without null-terminator). */
+ if (_ux_utility_memory_compare(_ux_pictbridge_drsponse_name, object_file_name,
+ length) == UX_SUCCESS)
+ {
+
+ /* Yes this is a script. Get the entire object in memory. */
+ /* Get script length from the object info. */
+ object_length = pima_object -> ux_host_class_pima_object_compressed_size;
+
+ /* Check for overflow. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_BUFFER_OVERFLOW);
+
+ /* Open the object. */
+ status = _ux_host_class_pima_object_open(pima, pima_session, object_handle, pima_object);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Set the object buffer pointer. */
+ object_buffer = pima_object -> ux_host_class_pima_object_buffer;
+
+ /* Obtain all the object data. */
+ while(object_length != 0)
+ {
+
+ /* Calculate what length to request. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+
+ /* Request maximum length. */
+ requested_length = UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER;
+
+ else
+
+ /* Request remaining length. */
+ requested_length = object_length;
+
+ /* Get the object data. */
+ status = _ux_host_class_pima_object_get(pima, pima_session, object_handle, pima_object,
+ object_buffer, requested_length, &actual_length);
+ if (status != UX_SUCCESS)
+ {
+
+ /* We had a problem, abort the transfer. */
+ _ux_host_class_pima_object_transfer_abort(pima, pima_session, object_handle, pima_object);
+
+ /* And close the object. */
+ _ux_host_class_pima_object_close(pima, pima_session, object_handle, pima_object);
+
+ return(status);
+ }
+
+ /* We have received some data, update the length remaining. */
+ object_length -= actual_length;
+
+ /* Update the buffer address. */
+ object_buffer += actual_length;
+ }
+
+ /* Close the object. */
+ status = _ux_host_class_pima_object_close(pima, pima_session, object_handle, pima_object);
+
+ /* Check the error. */
+ if (status != UX_SUCCESS)
+ return(UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE);
+
+ /* We now have the entire script into memory. Parse the object and execute the script. */
+ status = _ux_pictbridge_object_parse(pictbridge, pima_object -> ux_host_class_pima_object_buffer,
+ pima_object -> ux_host_class_pima_object_compressed_size);
+
+ /* Analyze the status from the parsing and determine the result code. */
+ switch (status)
+ {
+ case UX_SUCCESS :
+
+ /* Set the result code to OK. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_OK;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_IP;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_PARAMETER_UNKNOWN :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_UP;
+ break;
+
+ case UX_PICTBRIDGE_ERROR_PARAMETER_MISSING :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_MP;
+ break;
+
+ default :
+
+ /* Set the result code to Error. */
+ pictbridge -> ux_pictbridge_operation_result = UX_PICTBRIDGE_ACTION_RESULT_NOT_SUPPORTED_DEFAULT;
+ break;
+ }
+
+ if (status != UX_SUCCESS)
+ return(status);
+ }
+ }
+ }
+ }
+
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c
new file mode 100644
index 0000000..b9bc4d8
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c
@@ -0,0 +1,374 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_start PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function starts the DPS host (usually a printer). */
+/* */
+/* INPUT */
+/* */
+/* pima Pima instance associated */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_start(UX_PICTBRIDGE *pictbridge, UX_HOST_CLASS_PIMA *pima)
+{
+UINT status;
+ULONG object_index;
+UCHAR string_discovery_name[UX_PICTBRIDGE_MAX_FILE_NAME_SIZE + 1]; /* +1 for null-terminator */
+UX_HOST_CLASS_PIMA_OBJECT *pima_object;
+UX_HOST_CLASS_PIMA_SESSION *pima_session;
+UINT length, length1;
+
+ /* Store the pima instance in the pictbridge container. */
+ pictbridge -> ux_pictbridge_pima = (VOID *) pima;
+
+ /* We need to allocate memory for the pima structures contained in the pictbridge instance : Storage. */
+ pictbridge -> ux_pictbridge_storage = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, sizeof(UX_HOST_CLASS_PIMA_STORAGE));
+
+ /* Check the completion status. */
+ if (pictbridge -> ux_pictbridge_storage == UX_NULL)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Initialize status to success for things going on. */
+ status = UX_SUCCESS;
+
+ /* We need to allocate memory for the pima structures contained in the pictbridge instance : host object. */
+ pictbridge -> ux_pictbridge_object_host = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, sizeof(UX_HOST_CLASS_PIMA_OBJECT));
+
+ /* Get the address of the object container. */
+ pima_object = (UX_HOST_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_object_host;
+
+ /* Check the completion status. */
+ if (pictbridge -> ux_pictbridge_object_host == UX_NULL)
+ status = (UX_MEMORY_INSUFFICIENT);
+ else
+ {
+
+ /* Allocate some memory for the script object. */
+ pima_object -> ux_host_class_pima_object_buffer = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER);
+ if (pima_object -> ux_host_class_pima_object_buffer == UX_NULL)
+ status = (UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* We need to allocate memory for the pima structures contained in the pictbridge instance : session. */
+ if (status == UX_SUCCESS)
+ {
+ pictbridge -> ux_pictbridge_session = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, sizeof(UX_HOST_CLASS_PIMA_SESSION));
+
+ /* Check the completion status. */
+ if (pictbridge -> ux_pictbridge_session == UX_NULL)
+ status = (UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Go on if no error. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* We need to allocate memory for the pima structures contained in the pictbridge instance : device. */
+ pictbridge -> ux_pictbridge_device = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, sizeof(UX_HOST_CLASS_PIMA_DEVICE));
+
+ /* Check the completion status. */
+ if (pictbridge -> ux_pictbridge_device == UX_NULL)
+ status = (UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Go on if no error. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Store the Pictbridge instance in the pima application. This is used for the Pima callback
+ into the Pictbridge (or other application) layer. */
+ pima -> ux_host_class_pima_application = (VOID *) pictbridge;
+
+ /* State machine for the dpshost is idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine = UX_PICTBRIDGE_STATE_MACHINE_IDLE;
+
+ /* Create the semaphore to wake up the thread. */
+ status = _ux_utility_semaphore_create(&pictbridge -> ux_pictbridge_notification_semaphore, "ux_pictbridge_notification_semaphore", 0);
+ if (status != UX_SUCCESS)
+ status = (UX_SEMAPHORE_ERROR);
+ }
+
+ /* Go on if no error. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Allocate a Thread stack. */
+ pictbridge -> ux_pictbridge_thread_stack =
+ _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, UX_PICTBRIDGE_THREAD_STACK_SIZE);
+
+ /* Check the completion status. */
+ if (pictbridge -> ux_pictbridge_thread_stack == UX_NULL)
+ status = (UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Go on if no error. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Create the pictbridge class thread. */
+ status = _ux_utility_thread_create(&pictbridge -> ux_pictbridge_thread,
+ "ux_pictbridge_thread", _ux_pictbridge_dpshost_thread,
+ (ULONG)(ALIGN_TYPE) pictbridge,
+ pictbridge -> ux_pictbridge_thread_stack,
+ UX_PICTBRIDGE_THREAD_STACK_SIZE,
+ UX_PICTBRIDGE_THREAD_PRIORITY_CLASS,
+ UX_PICTBRIDGE_THREAD_PRIORITY_CLASS,
+ TX_NO_TIME_SLICE, TX_AUTO_START);
+
+ /* Check the completion status. */
+ if (status != UX_SUCCESS)
+ status = (UX_THREAD_ERROR);
+
+ UX_THREAD_EXTENSION_PTR_SET(&(pictbridge -> ux_pictbridge_thread), pictbridge)
+ }
+
+ /* Free up resources if there is error. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Check and free pictbridge -> ux_pictbridge_thread. */
+ if (pictbridge -> ux_pictbridge_thread.tx_thread_id != TX_EMPTY)
+ _ux_utility_thread_delete(&pictbridge -> ux_pictbridge_thread);
+
+ /* Check and free pictbridge -> ux_pictbridge_thread_stack. */
+ if (pictbridge -> ux_pictbridge_thread_stack)
+ _ux_utility_memory_free(pictbridge -> ux_pictbridge_thread_stack);
+
+ /* Check and free pictbridge -> ux_pictbridge_notification_semaphore. */
+ if (pictbridge -> ux_pictbridge_notification_semaphore.tx_semaphore_id != TX_EMPTY)
+ _ux_utility_semaphore_delete(&pictbridge -> ux_pictbridge_notification_semaphore);
+
+ /* Check and free pictbridge -> ux_pictbridge_device. */
+ if (pictbridge -> ux_pictbridge_device)
+ _ux_utility_memory_free(pictbridge -> ux_pictbridge_device);
+
+ /* Check and free pictbridge -> ux_pictbridge_session. */
+ if (pictbridge -> ux_pictbridge_session)
+ _ux_utility_memory_free(pictbridge -> ux_pictbridge_session);
+
+ /* Check and free pictbridge -> ux_pictbridge_object_host (pima_object). */
+ if (pima_object)
+ {
+ if (pima_object -> ux_host_class_pima_object_buffer)
+ _ux_utility_memory_free(pima_object -> ux_host_class_pima_object_buffer);
+ _ux_utility_memory_free(pima_object);
+ }
+
+ /* Free pictbridge -> ux_pictbridge_storage. */
+ _ux_utility_memory_free(pictbridge -> ux_pictbridge_storage);
+
+ return(status);
+ }
+
+ /* Save the session in a properly casted format. */
+ pima_session = (UX_HOST_CLASS_PIMA_SESSION *)pictbridge->ux_pictbridge_session;
+
+ /* Initialize the pictbridge state machine to request expected. */
+ pictbridge -> ux_pictbridge_request_response = UX_PICTBRIDGE_REQUEST;
+
+ /* Initialize the head and tail of the notification round robin buffers.
+ At first, the head and tail are pointing to the beginning of the array. */
+ pictbridge -> ux_pictbridge_event_array_head = pictbridge -> ux_pictbridge_event_array;
+ pictbridge -> ux_pictbridge_event_array_tail = pictbridge -> ux_pictbridge_event_array;
+ pictbridge -> ux_pictbridge_event_array_end = pictbridge -> ux_pictbridge_event_array + UX_PICTBRIDGE_MAX_EVENT_NUMBER;
+
+ /* Get the device info . */
+ status = _ux_host_class_pima_device_info_get(pima, (UX_HOST_CLASS_PIMA_DEVICE *)pictbridge -> ux_pictbridge_device);
+ if (status != UX_SUCCESS)
+ return(UX_PICTBRIDGE_ERROR_GENERAL_ERROR);
+
+ /* Set a callback for the pima session notification. */
+ pima_session -> ux_host_class_pima_session_event_callback = _ux_pictbridge_dpshost_notification_callback;
+
+ /* Open a pima session. */
+ status = _ux_host_class_pima_session_open(pima, pima_session);
+ if (status != UX_SUCCESS)
+ return(UX_PICTBRIDGE_ERROR_SESSION_NOT_OPEN);
+
+ /* Get the number of storage IDs. */
+ status = _ux_host_class_pima_storage_ids_get(pima, pima_session,
+ pictbridge -> ux_pictbridge_storage_ids,
+ 64);
+ if (status != UX_SUCCESS)
+ {
+ /* Close the pima session. */
+ status = _ux_host_class_pima_session_close(pima, pima_session);
+
+ return(UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE);
+ }
+
+ /* Get the first storage ID info container. */
+ status = _ux_host_class_pima_storage_info_get(pima, pima_session,
+ pictbridge -> ux_pictbridge_storage_ids[0],
+ (UX_HOST_CLASS_PIMA_STORAGE *)pictbridge -> ux_pictbridge_storage);
+ if (status != UX_SUCCESS)
+ {
+ /* Close the pima session. */
+ status = _ux_host_class_pima_session_close(pictbridge -> ux_pictbridge_pima, pima_session);
+
+ return(UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE);
+ }
+
+ /* Get the number of objects on the container. */
+ status = _ux_host_class_pima_num_objects_get(pima, pima_session,
+ UX_PICTBRIDGE_ALL_CONTAINERS, UX_PICTBRIDGE_OBJECT_SCRIPT);
+ if (status != UX_SUCCESS)
+ {
+ /* Close the pima session. */
+ status = _ux_host_class_pima_session_close(pima, pima_session);
+
+ return(UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE);
+ }
+
+ /* Get the array of objects handles on the container. */
+ status = _ux_host_class_pima_object_handles_get(pima, pima_session,
+ pictbridge -> ux_pictbridge_object_handles_array,
+ 4 * pima_session -> ux_host_class_pima_session_nb_objects,
+ UX_PICTBRIDGE_ALL_CONTAINERS, UX_PICTBRIDGE_OBJECT_SCRIPT, 0);
+ if (status != UX_SUCCESS)
+ {
+ /* Close the pima session. */
+ status = _ux_host_class_pima_session_close(pima, pima_session);
+
+ return(UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE);
+ }
+
+ /* We search for an object that is a picture or a script. */
+ object_index = 0;
+ while (object_index < pima_session -> ux_host_class_pima_session_nb_objects)
+ {
+
+ /* Get the object info structure. */
+ status = _ux_host_class_pima_object_info_get(pima, pima_session,
+ pictbridge -> ux_pictbridge_object_handles_array[object_index], pima_object);
+ if (status != UX_SUCCESS)
+ {
+ /* Close the pima session. */
+ status = _ux_host_class_pima_session_close(pima, pima_session);
+
+ return(UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE );
+ }
+
+
+ /* Check if this is a script. */
+ if (pima_object -> ux_host_class_pima_object_format == UX_HOST_CLASS_PIMA_OFC_SCRIPT)
+ {
+
+ /* Yes this is a script. We need to search for the DDISCVRY.DPS file name.
+ Get the file name length (without null-terminator). */
+ length1 = (UINT)(*pima_object -> ux_host_class_pima_object_filename);
+
+ /* Now, compare it to the DDISCVRY.DPS file name. Check length first (excluding null-terminator). */
+ if (length1 <= UX_PICTBRIDGE_MAX_FILE_NAME_SIZE)
+ {
+
+ /* Invalidate length, on error it's untouched. */
+ length = UX_PICTBRIDGE_MAX_FILE_NAME_SIZE + 1;
+ _ux_utility_string_length_check(_ux_pictbridge_ddiscovery_name, &length, UX_PICTBRIDGE_MAX_FILE_NAME_SIZE);
+ if (length == length1)
+ {
+
+ /* Get the file name in a ascii format (with null-terminator). */
+ _ux_utility_unicode_to_string(pima_object -> ux_host_class_pima_object_filename, string_discovery_name);
+
+ /* So far, the length of name of the files are the same.
+ Compare names now (since length is same just compare without null-terminator). */
+ if (_ux_utility_memory_compare(_ux_pictbridge_ddiscovery_name, string_discovery_name,
+ length) == UX_SUCCESS)
+ {
+
+ /* We have found a script with the DDISCVRY.DPS file name. Prepare a reply with a HDISCVRY. DPS name.
+ We use the same object container. Just change the name of the file. */
+ _ux_utility_string_to_unicode(_ux_pictbridge_hdiscovery_name, pima_object -> ux_host_class_pima_object_filename);
+
+ /* Send the script info. */
+ status = _ux_host_class_pima_object_info_send(pima, pima_session, 0,0,
+ pima_object);
+
+ /* Check the status of this operation. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Close the pima session. */
+ status = _ux_host_class_pima_session_close(pima, pima_session);
+
+ return(UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE);
+ }
+ else
+
+ /* We return to the application with a success status. We leave the session opened. */
+ return(UX_SUCCESS);
+
+ }
+
+ }
+ }
+ }
+
+ /* Next object index. */
+ object_index++;
+
+ }
+
+ /* We come here when we have not found any script or the script does not have the DDISCVRY.DPS file. Close the pima session. */
+ status = _ux_host_class_pima_session_close(pima, pima_session);
+ return(UX_PICTBRIDGE_ERROR_NO_DISCOVERY_SCRIPT);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c
new file mode 100644
index 0000000..56b9245
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c
@@ -0,0 +1,328 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_startjob PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function requests one or more files from the camera to be */
+/* printed. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_thread */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_dpshost_startjob(UX_PICTBRIDGE *pictbridge)
+{
+UINT status;
+UX_PICTBRIDGE_JOBINFO *jobinfo;
+UX_PICTBRIDGE_PRINTINFO *printinfo;
+UX_HOST_CLASS_PIMA *pima;
+UX_HOST_CLASS_PIMA_OBJECT pima_object;
+UX_HOST_CLASS_PIMA_SESSION *pima_session;
+ULONG object_length;
+ULONG requested_length;
+ULONG actual_length;
+ULONG object_offset;
+UCHAR *object_buffer;
+
+ /* We need the pima instance. */
+ pima = (UX_HOST_CLASS_PIMA *) pictbridge -> ux_pictbridge_pima;
+
+ /* Get the session in a properly casted format. */
+ pima_session = (UX_HOST_CLASS_PIMA_SESSION *) pictbridge -> ux_pictbridge_session;
+
+ /* We have 2 structures that tell us about the job(s) to do. The jobinfo which
+ applies to all the jobs and one or more instances of the printinfo structure
+ which applies to each file\object to be printed. */
+ jobinfo = &pictbridge -> ux_pictbridge_jobinfo;
+
+ /* Get the first printinfo structure. */
+ printinfo = jobinfo -> ux_pictbridge_jobinfo_printinfo_start;
+
+ /* Parse all the job info. */
+ while (printinfo != UX_NULL)
+ {
+ /* Set the current print job. */
+ jobinfo -> ux_pictbridge_jobinfo_printinfo_current = printinfo;
+
+ /* Change status from idle to printing. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus = UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_ACTIVE;
+
+ /* Change status from disconnect OK to disconnect NOK. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_disconnectenable = UX_PICTBRIDGE_DISCONNECT_ENABLE_FALSE;
+
+ /* Change NewJob status to cannot print. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok = UX_PICTBRIDGE_NEW_JOB_FALSE;
+
+ /* First issue a DPS_notifyDeviceStatus with state change from idle to printing. */
+ status = _ux_pictbridge_dpshost_input_object_send(pictbridge, UX_PICTBRIDGE_IR_NOTIFY_DEVICE_STATUS);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Set the print info values in the notification xml request . */
+ printinfo -> ux_pictbridge_printinfo_current_page = 1;
+ printinfo -> ux_pictbridge_printinfo_total_page = 1;
+ printinfo -> ux_pictbridge_printinfo_images_printed = 0;
+
+ /* Then issue a DPS_notifyJobStatus. */
+ status = _ux_pictbridge_dpshost_input_object_send(pictbridge, UX_PICTBRIDGE_IR_NOTIFY_JOB_STATUS);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the object info for this fileID to be printed. */
+ status = _ux_host_class_pima_object_info_get(pima, pima_session,
+ printinfo -> ux_pictbridge_printinfo_fileid, &pima_object);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Change status from printing to idle. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus = UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE;
+
+ /* Change NewJob status to print ok. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok = UX_PICTBRIDGE_NEW_JOB_TRUE;
+
+ return(status);
+ }
+
+ /* Get the object length from the object info. */
+ object_length = pima_object.ux_host_class_pima_object_compressed_size;
+
+ /* Open the object. */
+ status = _ux_host_class_pima_object_open(pima, pima_session,
+ printinfo -> ux_pictbridge_printinfo_fileid, &pima_object);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Change status from printing to idle. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus = UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE;
+
+ /* Change NewJob status to print ok. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok = UX_PICTBRIDGE_NEW_JOB_TRUE;
+
+
+ return(status);
+ }
+
+ /* Allocate memory for the object. */
+ object_buffer = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER);
+
+ /* Check for memory error. */
+ if (object_buffer == UX_NULL)
+ {
+
+ /* Change status from printing to idle. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus = UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE;
+
+ /* Change NewJob status to print ok. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok = UX_PICTBRIDGE_NEW_JOB_TRUE;
+
+
+ /* Close the object. */
+ status = _ux_host_class_pima_object_close(pima, pima_session,
+ printinfo -> ux_pictbridge_printinfo_fileid, &pima_object);
+ /* Return an error. */
+ return(UX_MEMORY_INSUFFICIENT);
+
+ }
+
+ /* Reset the current object offset. */
+ object_offset = 0;
+
+ /* Obtain all the object data. */
+ while(object_length != 0)
+ {
+
+ /* Calculate what length to request. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+
+ /* Request maximum length. */
+ requested_length = UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER;
+
+ else
+
+ /* Request remaining length. */
+ requested_length = object_length;
+
+
+ /* Get the object data. */
+ status = _ux_host_class_pima_object_get(pima, pima_session, printinfo -> ux_pictbridge_printinfo_fileid, &pima_object,
+ object_buffer, requested_length, &actual_length);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Abort the current transfer. */
+ _ux_host_class_pima_object_transfer_abort(pima, pima_session, printinfo -> ux_pictbridge_printinfo_fileid, &pima_object);
+
+ /* Change status from printing to idle. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus = UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE;
+
+ /* Change NewJob status to print ok. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok = UX_PICTBRIDGE_NEW_JOB_TRUE;
+
+
+ /* Free memory of the object. */
+ _ux_utility_memory_free(object_buffer);
+
+ /* Return error. */
+ return(status);
+ }
+
+ /* If there is an application callback function, associated with this object, call it. */
+ if (pictbridge -> ux_pictbridge_application_object_data_write != UX_NULL)
+ {
+
+ /* Call the callback function. */
+ status = pictbridge -> ux_pictbridge_application_object_data_write(pictbridge,
+ object_buffer,
+ object_offset,
+ pima_object.ux_host_class_pima_object_compressed_size,
+ actual_length);
+
+ if (status != UX_SUCCESS)
+ {
+
+ /* Abort the current transfer. */
+ _ux_host_class_pima_object_transfer_abort(pima, pima_session, printinfo -> ux_pictbridge_printinfo_fileid, &pima_object);
+
+ /* Change status from printing to idle. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus = UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE;
+
+ /* Change NewJob status to print ok. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok = UX_PICTBRIDGE_NEW_JOB_TRUE;
+
+
+ /* Free memory of the object. */
+ _ux_utility_memory_free(object_buffer);
+
+ /* Return error. */
+ return(status);
+ }
+ }
+
+ /* We have received some data, update the length remaining. */
+ object_length -= actual_length;
+
+ /* Update the offset. */
+ object_offset += actual_length;
+ }
+
+ /* Close the object. */
+ status = _ux_host_class_pima_object_close(pima, pima_session,
+ printinfo -> ux_pictbridge_printinfo_fileid, &pima_object);
+ /* Check error code. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Change status from printing to idle. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus = UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE;
+
+ /* Change NewJob status to print ok. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok = UX_PICTBRIDGE_NEW_JOB_TRUE;
+
+
+ /* Free memory of the object. */
+ _ux_utility_memory_free(object_buffer);
+
+ return(status);
+ }
+
+ /* Free resources. */
+ _ux_utility_memory_free(object_buffer);
+
+ /* Set the print info values in the notification xml request . */
+ printinfo -> ux_pictbridge_printinfo_current_page = 1;
+ printinfo -> ux_pictbridge_printinfo_total_page = 1;
+ printinfo -> ux_pictbridge_printinfo_images_printed++;
+
+ /* First issue a DPS_notifyJobStatus. */
+ status = _ux_pictbridge_dpshost_input_object_send(pictbridge, UX_PICTBRIDGE_IR_NOTIFY_JOB_STATUS);
+
+ /* Change status from printing to idle. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_dpsprintservicestatus = UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE;
+
+ /* Change status from disconnect NOK to disconnect OK. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_disconnectenable = UX_PICTBRIDGE_DISCONNECT_ENABLE_TRUE;
+
+ /* Change NewJob status to can print. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_newjobok = UX_PICTBRIDGE_NEW_JOB_TRUE;
+
+ /* Change JobEndReason status to Job ended normally. */
+ pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_jobendreason = UX_PICTBRIDGE_JOB_END_REASON_NORMAL;
+
+ /* First issue a DPS_notifyDeviceStatus with state change from idle to printing. */
+ status = _ux_pictbridge_dpshost_input_object_send(pictbridge, UX_PICTBRIDGE_IR_NOTIFY_DEVICE_STATUS);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Next printinfo. */
+ printinfo = printinfo -> ux_pictbridge_printinfo_next;
+
+ }
+
+ /* Return status successful. */
+ return(UX_SUCCESS);
+
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c
new file mode 100644
index 0000000..5ed954c
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c
@@ -0,0 +1,183 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+#include "ux_host_class_pima.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_dpshost_thread PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This is the Pictbridge dpshost thread that receives and execute */
+/* notifications from the dpsclient. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* user application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+VOID _ux_pictbridge_dpshost_thread(ULONG parameter)
+{
+
+UX_PICTBRIDGE *pictbridge;
+UX_PICTBRIDGE_EVENT *pictbridge_event;
+ULONG actual_flags;
+UINT status;
+
+ /* Cast the parameter passed in the thread into the pictbridge pointer. */
+ UX_THREAD_EXTENSION_PTR_GET(pictbridge, UX_PICTBRIDGE, parameter)
+
+ /* Loop forever waiting for changes signaled through the semaphore. */
+ while (1)
+ {
+
+ /* Wait for the semaphore to be put by the root hub or a regular hub. */
+ _ux_utility_semaphore_get(&pictbridge -> ux_pictbridge_notification_semaphore, UX_WAIT_FOREVER);
+
+ /* Check if there is an event. Normally there should be at least one since we got awaken. */
+ if (pictbridge -> ux_pictbridge_event_array_tail != pictbridge -> ux_pictbridge_event_array_head)
+ {
+
+ /* Get the current event tail. */
+ pictbridge_event = pictbridge -> ux_pictbridge_event_array_tail;
+
+ /* Compute the next entry in the event array. */
+ if ((pictbridge -> ux_pictbridge_event_array_tail + 1) == pictbridge -> ux_pictbridge_event_array_end)
+
+ /* Start at the beginning of the list. */
+ pictbridge -> ux_pictbridge_event_array_tail = pictbridge -> ux_pictbridge_event_array;
+ else
+
+ /* Point to the next entry in the event array. */
+ pictbridge -> ux_pictbridge_event_array_tail = pictbridge -> ux_pictbridge_event_array_tail + 1;
+
+ /* Analyze the event type. */
+ switch (pictbridge_event -> ux_pictbridge_event_code)
+ {
+
+ /* The DSC client is informing us that an object is ready. */
+ case UX_PICTBRIDGE_EC_OBJECT_ADDED :
+ case UX_PICTBRIDGE_EC_REQUEST_OBJECT_TRANSFER :
+
+ /* Check the state machine. */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine != UX_PICTBRIDGE_STATE_MACHINE_IDLE)
+ {
+
+ /* Set the state machine to Client Request pending. */
+ pictbridge -> ux_pictbridge_host_client_state_machine |= UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING;
+
+ /* Wait for the host pending request to be completed. */
+ status = _ux_utility_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
+
+ /* Reset the state machine to not Host Request pending. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING;
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ break;
+
+
+ }
+
+ /* Change the state machine to client request being executed. */
+ pictbridge -> ux_pictbridge_host_client_state_machine |= UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST;
+
+ /* Obtain the object and execute the XML request script. */
+ _ux_pictbridge_dpshost_object_get(pictbridge, pictbridge_event -> ux_pictbridge_event_parameter_1);
+
+ /* Do we have a pending client event ? */
+ if (pictbridge -> ux_pictbridge_host_client_state_machine & UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST_PENDING)
+ {
+
+ /* Yes, so we need to set the event that advertise the completion of the host request. */
+ status = _ux_utility_event_flags_set(&pictbridge -> ux_pictbridge_event_flags_group,
+ UX_PICTBRIDGE_EVENT_FLAG_STATE_MACHINE_READY,
+ TX_AND);
+ /* Check status. */
+ if (status != UX_SUCCESS)
+ break;
+
+
+ }
+
+ /* Change state machine to idle. */
+ pictbridge -> ux_pictbridge_host_client_state_machine &= (UINT)~UX_PICTBRIDGE_STATE_MACHINE_CLIENT_REQUEST;
+
+ /* Check to see if we had a configureprint service request. */
+ if (pictbridge -> ux_pictbridge_input_request == UX_PICTBRIDGE_IR_GET_CAPABILITY)
+ {
+
+ /* Parse the tag code that was memorized during the input. */
+ if (pictbridge -> ux_pictbridge_input_tags & UX_PICTBRIDGE_IR_GC_CROPPINGS)
+
+ /* We did have a request, notify the camera of our status. */
+ _ux_pictbridge_dpshost_input_object_send(pictbridge, UX_PICTBRIDGE_IR_NOTIFY_DEVICE_STATUS);
+
+ }
+ break;
+
+ case UX_PICTBRIDGE_EC_START_JOB :
+
+ /* We have received an order to print one or more picture. */
+ _ux_pictbridge_dpshost_startjob(pictbridge);
+
+ default :
+ break;
+ }
+ }
+ }
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_element_to_decimal.c b/common/usbx_pictbridge/src/ux_pictbridge_element_to_decimal.c
new file mode 100644
index 0000000..0aa7aa1
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_element_to_decimal.c
@@ -0,0 +1,148 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_element_to_hexa PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function translates an element into a decimal value. */
+/* */
+/* INPUT */
+/* */
+/* element Where to store the element */
+/* decimal_value Value to be returned */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_element_to_decimal(UCHAR *element, ULONG *decimal_value)
+{
+
+ULONG element_length;
+ULONG local_decimal_value;
+UCHAR element_content;
+UCHAR element_decimal;
+ULONG multiplier;
+ULONG multiplier_length;
+UINT string_length = 0;
+UINT status;
+
+
+ /* Get the string length, max 4294967295 (0xFFFFFFFF), 10 digits. */
+ status = _ux_utility_string_length_check(element, &string_length, 10);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the element length. Should not be more than 8 characters. */
+ element_length = string_length;
+
+ /* Check the length. Error if 0. */
+ if (element_length == 0)
+
+ /* We have a syntax violation. */
+ return(UX_ERROR);
+
+ /* Reset the local decimal value. */
+ local_decimal_value = 0;
+
+ /* Calculate the multiplier value. First reset it. */
+ multiplier = 1;
+
+ /* Set the length of the string. */
+ multiplier_length = element_length;
+
+ /* Build the multiplier : 10 square length. */
+ while (multiplier_length-- > 1)
+
+ /* Add another decimal. */
+ multiplier = multiplier * 10;
+
+ /* We parse the element and build the decimal value one byte at a type. */
+ while(element_length)
+ {
+
+ /* Get the element content. */
+ element_content = *element;
+
+ /* Check for the element content. Should be >0 <9. */
+ if (element_content >= '0' && element_content <= '9')
+
+ /* We have a digit. */
+ element_decimal = (UCHAR)(element_content - '0');
+
+ else
+ /* We have a syntax violation. */
+ return(UX_ERROR);
+
+ /* Add the found value to the current cumulated decimal value. */
+ local_decimal_value += (ULONG) element_decimal * multiplier;
+
+ /* Next position. */
+ element++;
+
+ /* Update length. */
+ element_length--;
+
+ /* Reduce the multiplier by one decimal. */
+ multiplier = multiplier / 10;
+
+ }
+
+ /* We have finished building the 32 bit decimal value. */
+ *decimal_value = local_decimal_value;
+
+ /* Operation was successful. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c b/common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c
new file mode 100644
index 0000000..93fd4ff
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c
@@ -0,0 +1,157 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_element_to_hexa PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function translates an element into an hexa value. */
+/* */
+/* INPUT */
+/* */
+/* element Where to store the element */
+/* hexa_value Value to be returned */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_element_to_hexa(UCHAR *element, ULONG *hexa_value)
+{
+
+ULONG element_length;
+ULONG local_hexa_value;
+UCHAR element_content;
+UCHAR element_hexa;
+UINT string_length = 0;
+UINT status;
+
+
+ /* Get the string length, max 0xFFFFFFFF, 8 digits. */
+ status = _ux_utility_string_length_check(element, &string_length, 8);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the element length. Should not be more than 8 characters. */
+ element_length = string_length;
+
+ /* Check the length. Error if 0. */
+ if (element_length == 0)
+
+ /* We have a syntax violation. */
+ return(UX_ERROR);
+
+ /* Reset the local hexa value. */
+ local_hexa_value = 0;
+
+ /* We parse the element and build the hexa value one byte at a type. */
+ while(element_length)
+ {
+
+ /* Shift the previous content by 1 nibble. */
+ local_hexa_value = local_hexa_value << 4;
+
+ /* Get the element content. */
+ element_content = *element;
+
+ /* Check for the element content. Should be >0 <9 or 'A' to 'F'. */
+ if ((element_content >= '0' && element_content <= '9') ||
+ (element_content >= 'a' && element_content <= 'f') ||
+ (element_content >= 'A' && element_content <= 'F'))
+ {
+
+ /* We have a valid element content. Turn it into a hexa decimal value. */
+ if (element_content >= '0' && element_content <= '9')
+
+ /* We have a digit. */
+ element_hexa = (UCHAR)(element_content - '0');
+
+ else
+ {
+
+ /* We have a 'A' to 'F' or 'a' to 'f' value. */
+ if (element_content >= 'a' && element_content <= 'f')
+
+ /* We have a 'a' to 'f' char. */
+ element_hexa = (UCHAR)(element_content - 'a' + 10);
+
+ else
+
+ /* We have a 'A' to 'F' char. */
+ element_hexa = (UCHAR)(element_content - 'A' + 10);
+
+
+ }
+ }
+ else
+ /* We have a syntax violation. */
+ return(UX_ERROR);
+
+ /* Add the found value to the current cumulated hexa value. */
+ local_hexa_value |= element_hexa;
+
+ /* Next position. */
+ element++;
+
+ /* Update length. */
+ element_length--;
+
+ }
+
+ /* We have finished building the 32 bit hexa value. */
+ *hexa_value = local_hexa_value;
+
+ /* Operation was successful. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c
new file mode 100644
index 0000000..009cb9c
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c
@@ -0,0 +1,157 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_hexa_to_decimal_string PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function translates an hexa value into a decimal string. */
+/* */
+/* Note: */
+/* Number of max_digit_string_size must be large enough to fit digits */
+/* converted. */
+/* The space of the decimal_string buffer must be equal to or larger */
+/* than max_digit_string_size to accept converted characters. */
+/* When leading zeros are off, the converted string ends before */
+/* reaching buffer end and zeros are padded. */
+/* */
+/* INPUT */
+/* */
+/* hexa_value Value to be translated */
+/* decimal_string Where to store the element */
+/* leading_zero_flag If leading zeroes are OK */
+/* max_digit_string_size Max number of digits (<=8) */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_hexa_to_decimal_string(ULONG hexa_value, UCHAR *decimal_string,
+ ULONG leading_zero_flag, ULONG max_digit_string_size)
+{
+
+ULONG decimal_string_shift;
+ULONG decimal_value;
+ULONG leading_flag;
+ULONG decimal_max[8] = {9, 99, 999, 9999, 99999, 999999, 9999999, 99999999};
+
+ /* Set the value of the shift decimal.*/
+ switch(max_digit_string_size)
+ {
+ case 1 :
+ decimal_string_shift = 1;
+ break;
+ case 2 :
+ decimal_string_shift = 10;
+ break;
+ case 3 :
+ decimal_string_shift = 100;
+ break;
+ case 4 :
+ decimal_string_shift = 1000;
+ break;
+ case 5 :
+ decimal_string_shift = 10000;
+ break;
+ case 6 :
+ decimal_string_shift = 100000;
+ break;
+ case 7 :
+ decimal_string_shift = 1000000;
+ break;
+ case 8 :
+ decimal_string_shift = 10000000;
+ break;
+ default :
+ return(UX_ERROR);
+ }
+
+ /* If value exceeds, do not proceed. */
+ if (hexa_value > decimal_max[decimal_string_shift - 1])
+ return(UX_ERROR);
+
+ /* Set the leading zero flag. */
+ if (leading_zero_flag == UX_PICTBRIDGE_LEADING_ZERO_ON)
+ leading_flag = UX_FALSE;
+ else
+ leading_flag = UX_TRUE;
+
+ /* Reset the decimal_string buffer. */
+ _ux_utility_memory_set(decimal_string, 0, max_digit_string_size);
+
+ /* We parse the hexa value and build the decimal string one byte at a type. */
+ while(decimal_string_shift)
+ {
+ /* Divide the hexa value by the shift and decode the leading digital. */
+ decimal_value = hexa_value / decimal_string_shift;
+
+ /* If the result is non zero, we can insert that decimal in the string.
+ There is a special case if the value is the last decimal or if the leading flag is off. */
+ if (decimal_value != 0 || decimal_string_shift == 1 || leading_flag == UX_FALSE)
+ {
+ /* Insert the value. */
+ *decimal_string++ = (UCHAR)(decimal_value + '0');
+
+ /* Reset the leading flag. */
+ leading_flag = UX_FALSE;
+ }
+
+ /* Reduce the shift value to the next decimal. */
+ decimal_string_shift = decimal_string_shift / 10;
+
+ }
+
+ /* Operation was successful. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c
new file mode 100644
index 0000000..560347d
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c
@@ -0,0 +1,123 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_element_to_hexa PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function translates an hexa value into an element. */
+/* */
+/* Note: the size of the element buffer must be equal to or larger than*/
+/* 8 to fill all converted characters. */
+/* */
+/* INPUT */
+/* */
+/* hexa_value Value to be translated */
+/* element Where to store the element */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_hexa_to_element(ULONG hexa_value, UCHAR *element)
+{
+
+ULONG element_length;
+ULONG local_hexa_value;
+UCHAR element_hexa;
+ULONG element_shift;
+
+ /* Reset the element buffer. */
+ _ux_utility_memory_set(element, 0, 8);
+
+ /* Reset the value of the length.*/
+ element_length = 0;
+
+ /* Init the shift value. */
+ element_shift = 32 - 4;
+
+ /* We parse the hexa value element and build the hexa value one byte at a type. */
+ while(element_length < 8)
+ {
+
+ /* Shift the 4 bit value we are interested in. We keep the lowest nibble. */
+ local_hexa_value = (hexa_value >> element_shift) & 0x0f;
+
+ /* See if this value is from 0-9 or A to F. */
+ if (local_hexa_value <= 9)
+
+ /* We have a digit. */
+ element_hexa = (UCHAR)(local_hexa_value + '0');
+
+ else
+
+ /* We have 'A' to 'F' value. */
+ element_hexa = (UCHAR)(local_hexa_value - 10 + 'A');
+
+ /* Store the converted hexa value. */
+ *element = element_hexa;
+
+ /* Next position. */
+ element++;
+
+ /* Update length. */
+ element_length++;
+
+ /* Continue shifting by one nibble. */
+ element_shift = element_shift - 4;
+ }
+
+ /* Operation was successful. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_major_minor.c b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_major_minor.c
new file mode 100644
index 0000000..efed0df
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_major_minor.c
@@ -0,0 +1,110 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_utility.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_hexa_to_major_minor PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function translates an hexa value into an major.minor value */
+/* (xx.xx). */
+/* */
+/* Note: the space of the output_buffer must be equal to or larger */
+/* than 5 to fill all converted characters. */
+/* */
+/* INPUT */
+/* */
+/* hexa_value Value to be translated */
+/* output_buffer Where to store the result */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_hexa_to_major_minor(ULONG hexa_value, UCHAR *output_buffer)
+{
+
+UCHAR hexa_major;
+UCHAR hexa_minor;
+UINT status;
+
+
+ /* Reset the output buffer. */
+ _ux_utility_memory_set(output_buffer, 0, 5);
+
+ /* Isolate the major. */
+ hexa_major = (UCHAR)(hexa_value >> 16);
+
+ /* Isolate the minor. */
+ hexa_minor = (UCHAR)(hexa_value & 0xFFFF);
+
+ /* Insert the decimal value of the major. */
+ status = _ux_pictbridge_hexa_to_decimal_string(hexa_major, output_buffer, UX_PICTBRIDGE_LEADING_ZERO_ON, 2);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Update the address of the destination. */
+ output_buffer += 2;
+
+ /* Insert the '.' between major and minor. */
+ *output_buffer++ = '.';
+
+ /* Insert the decimal value of the minor. */
+ status = _ux_pictbridge_hexa_to_decimal_string(hexa_minor, output_buffer, UX_PICTBRIDGE_LEADING_ZERO_ON, 2);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Operation was successful. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_object_parse.c b/common/usbx_pictbridge/src/ux_pictbridge_object_parse.c
new file mode 100644
index 0000000..3316b23
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_object_parse.c
@@ -0,0 +1,318 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_object_parse PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function parses a XML based pictbridge object. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* xml_object_buffer Pointer to object buffer */
+/* xml_object_length Length of the object */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_get */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_object_parse(UX_PICTBRIDGE *pictbridge, UCHAR *xml_object_buffer,
+ ULONG xml_object_length)
+{
+UX_PICTBRIDGE_XML_ITEM *tag_item;
+UX_PICTBRIDGE_XML_ITEM *tag_entry = UX_NULL;
+UCHAR tag_name[UX_PICTBRIDGE_MAX_TAG_SIZE];
+UCHAR variable_name[UX_PICTBRIDGE_MAX_VARIABLE_SIZE];
+UCHAR variable_string[UX_PICTBRIDGE_MAX_STRING_SIZE];
+UCHAR xml_parameter[UX_PICTBRIDGE_MAX_STRING_SIZE];
+UX_PICTBRIDGE_XML_ITEM *tag_history[UX_PICTBRIDGE_MAX_TAG_DEPTH];
+ULONG tag_history_index;
+ULONG tag_flag;
+ULONG closing_tag_count;
+UINT tag_name_length;
+UINT tag_history_length;
+UINT status;
+
+ /* Set the tag position at root. */
+ tag_item = _ux_pictbridge_xml_item_root;
+
+ /* Clear the input tags. */
+ pictbridge -> ux_pictbridge_input_tags = 0;
+
+ /* Clear the input request. */
+ pictbridge -> ux_pictbridge_input_request = 0;
+
+ /* Tag history index is at root. */
+ tag_history_index = 0;
+
+ /* Closing tag count is reset. */
+ closing_tag_count = 0;
+
+ /* This variable remains untouched if the XML object's length is 0. */
+ status = UX_SUCCESS;
+
+ /* We parse the object until all items are parsed or there is a syntax error
+ or a short object. */
+ while(xml_object_length)
+ {
+
+ /* Scan the object buffer for a tag. */
+ status = _ux_pictbridge_tag_name_get(xml_object_buffer, xml_object_length, tag_name,
+ variable_name, variable_string, xml_parameter,
+ &xml_object_buffer, &xml_object_length, &tag_flag);
+
+ /* We may have an error. Check if this is an empty line in which case we are done. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Check for empty line. */
+ if (status == UX_PICTBRIDGE_ERROR_EMPTY_LINE)
+
+ /* Yes, we have an empty line. Do not proceed but we have a successful completion. */
+ status = UX_SUCCESS;
+
+ /* Do not proceed. */
+ break;
+ }
+
+ /* Check if this is a closing tag ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_CLOSING)
+ {
+
+ /* Assume the worst. */
+ status = UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR;
+
+ /* Ensure we do not have a closing tag without a prior normal tag entry. */
+ if (tag_history_index == 0)
+
+ /* Syntax error. */
+ break;
+
+ /* One step back in the tag history. */
+ tag_history_index--;
+
+ /* Calculate the length of the tag item. */
+ status = _ux_utility_string_length_check(tag_name, &tag_name_length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad name, we should never here if _tag_name_get is OK. */
+ break;
+
+ /* Calculate the length of the current tag name in the tag history. */
+ status = _ux_utility_string_length_check(tag_history[tag_history_index] -> ux_pictbridge_xml_item_tag_name, &tag_history_length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad name, we should never here if _tag_name_get is OK. */
+ return(status);
+
+ /* If both length do not match, no need to check for a match. */
+ if (tag_history_length == tag_name_length)
+ {
+
+ /* Both length match, we may have a tag match. Check the names */
+ if (_ux_utility_memory_compare(tag_name, tag_history[tag_history_index] -> ux_pictbridge_xml_item_tag_name,
+ tag_name_length) != UX_SUCCESS)
+
+ /* Syntax error. */
+ break;
+ }
+ else
+
+ /* Syntax error. */
+ break;
+
+ /* Increment the closing tag count. */
+ closing_tag_count++;
+
+ /* If we have more than one closing tag consecutively, look for the parent. */
+ if (closing_tag_count > 1)
+ {
+
+ /* Get the parent for this item and set it as the current tag_item. We may already be at the root. */
+ if (tag_entry -> ux_pictbridge_xml_item_parent != UX_NULL)
+
+ /* We have a parent, set it. */
+ tag_item = tag_entry -> ux_pictbridge_xml_item_parent;
+ }
+
+ /* We set status to success. */
+ status = UX_SUCCESS;
+
+ }
+ else
+ {
+
+ /* The tag name is in the tag_name variable but has not been verified yet. */
+ status = _ux_pictbridge_tag_name_scan(tag_item, tag_name, &tag_entry);
+
+ /* We may have an error. */
+ if (status != UX_SUCCESS)
+
+ /* Do not proceed. */
+ break;
+
+ /* Check if this is a comment tag ? */
+ if ((tag_flag & UX_PICTBRIDGE_TAG_FLAG_COMMENT) == 0)
+ {
+
+ /* Reset the closing tag count. */
+ closing_tag_count = 0;
+
+ /* Save the current tag in the tag history. */
+ tag_history[tag_history_index] = tag_entry;
+
+ /* Increase the current tag index. */
+ tag_history_index++;
+
+ /* Check if there is a main tag specified in the tag entry. */
+ if (tag_entry -> ux_pictbridge_xml_item_tag_code != 0)
+ {
+
+ /* If this is a leaf, the tag is not a main request but a variable to be returned. */
+ if (tag_entry -> ux_pictbridge_xml_item_child == UX_PICTBRIDGE_XML_LEAF)
+
+ /* This is a variable. Add it to the other ones. */
+ pictbridge -> ux_pictbridge_input_tags |= tag_entry -> ux_pictbridge_xml_item_tag_code;
+
+ else
+
+ /* Yes we have a tag code, memorize it. This is a main input request. */
+ pictbridge -> ux_pictbridge_input_request = tag_entry -> ux_pictbridge_xml_item_tag_code;
+ }
+ /* We may have a function associated with this tag. Do a sanity check. */
+ if (tag_entry -> ux_pictbridge_xml_item_function != UX_NULL)
+ {
+ /* There is a function associated, so call it. */
+ status = tag_entry -> ux_pictbridge_xml_item_function(pictbridge, variable_name, variable_string, xml_parameter);
+
+ /* We may have an error. */
+ if (status != UX_SUCCESS)
+
+ /* Do not proceed. */
+ break;
+ }
+
+ /* Check if the tag has a child attached to it.
+ If there is neither a child or a function, it means we do not treat this tag name. */
+ if (tag_entry -> ux_pictbridge_xml_item_child != UX_NULL && tag_entry -> ux_pictbridge_xml_item_child != UX_PICTBRIDGE_XML_LEAF)
+ {
+
+ /* We have a child, set it. */
+ tag_item = tag_entry -> ux_pictbridge_xml_item_child;
+
+ /* Reset the tag codes. */
+ pictbridge -> ux_pictbridge_input_tags = 0;
+ }
+
+ /* Check if this is a self closing tag ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_SELF_CLOSING)
+ {
+
+ /* Assume the worst. */
+ status = UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR;
+
+ /* Ensure we do not have a closing tag without a prior normal tag entry. */
+ if (tag_history_index == 0)
+
+ /* Syntax error. */
+ break;
+
+ /* One step back in the tag history. */
+ tag_history_index--;
+
+ /* Calculate the length of the tag item. */
+ status = _ux_utility_string_length_check(tag_name, &tag_name_length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad name, we should never here if _tag_name_scan is OK! */
+ break;
+
+ /* Calculate the length of the current tag name in the tag history. */
+ status = _ux_utility_string_length_check(tag_history[tag_history_index] -> ux_pictbridge_xml_item_tag_name, &tag_history_length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad name, we should never here if _tag_name_scan is OK! */
+ break;
+
+ /* If both length do not match, no need to check for a match. */
+ if (tag_history_length == tag_name_length)
+ {
+
+ /* Both length match, we may have a tag match. Check the names */
+ if (_ux_utility_memory_compare(tag_name, tag_history[tag_history_index] -> ux_pictbridge_xml_item_tag_name,
+ tag_name_length) != UX_SUCCESS)
+
+ /* Syntax error. */
+ break;
+ }
+ else
+
+ /* Syntax error. */
+ break;
+
+ /* Increment the closing tag count. */
+ closing_tag_count++;
+
+ /* We set status to success. */
+ status = UX_SUCCESS;
+
+ }
+ }
+ }
+ }
+
+ /* Return completion status. */
+ return(status);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_output_object_tag_line_add.c b/common/usbx_pictbridge/src/ux_pictbridge_output_object_tag_line_add.c
new file mode 100644
index 0000000..f3e4bc6
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_output_object_tag_line_add.c
@@ -0,0 +1,488 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_object_tag_line_add PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function adds a tag line into the target xml object */
+/* */
+/* INPUT */
+/* */
+/* pima_object_buffer Pointer to object buffer */
+/* object_length Length of the object */
+/* tag_element Tag to insert */
+/* tag_flag Flags */
+/* tag_variable Variable if any */
+/* tag_variable_value Variable value if any */
+/* tag_element element to insert after tag */
+/* pima_object_buffer_updated Updated Address of the object */
+/* object_length_updated Updated length */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_dpshost_object_get */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_object_tag_line_add(UCHAR *pima_object_buffer,
+ ULONG object_length,
+ UCHAR *tag_element_string,
+ ULONG tag_flag,
+ UCHAR *tag_variable,
+ ULONG tag_variable_value,
+ VOID *tag_element,
+ UCHAR **pima_object_buffer_updated,
+ ULONG *object_length_updated)
+{
+
+UINT element_length = 0;
+ULONG value_index;
+UINT status;
+
+ /* Check if we need to insert a beginning tag. */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_BEGIN)
+ {
+
+ /* Going to add '<'. */
+ object_length += 1;
+
+ /* Calculate the length of the element. */
+ status = _ux_utility_string_length_check(tag_element_string, &element_length, UX_PICTBRIDGE_MAX_ELEMENT_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+
+ /* Going to add element. */
+ object_length += element_length;
+
+ /* Do bounds-checking. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Insert a "<". */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_START_BRACKET;
+
+ /* Create the element string. */
+ _ux_utility_memory_copy(pima_object_buffer, tag_element_string, element_length);
+
+ /* Update the object pointer position. */
+ pima_object_buffer += element_length;
+
+ /* Do we have a variable to insert after the opening tag ? */
+ if (tag_variable != UX_NULL)
+ {
+
+ /* Going to add " ". */
+ object_length += 1;
+
+ /* Insert the variable. First calculate the length of the variable. */
+ status = _ux_utility_string_length_check(tag_variable, &element_length, UX_PICTBRIDGE_MAX_ELEMENT_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+
+ /* Going to add element. */
+ object_length += element_length;
+
+ /* Going to insert "=". */
+ object_length += 1;
+
+ /* Going to insert a quote. */
+ object_length += 1;
+
+ /* Going to insert 8 hex chars. */
+ object_length += 8;
+
+ /* Going to insert a quote. */
+ object_length += 1;
+
+ /* Do bounds-checking. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Insert a " ". */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_SPACE;
+
+ /* Create the variable string. */
+ _ux_utility_memory_copy(pima_object_buffer, tag_variable, element_length);
+
+ /* Update the object pointer position. */
+ pima_object_buffer += element_length;
+
+ /* Insert a "=". */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_EQUAL;
+
+ /* Insert a quote. */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_QUOTE;
+
+ /* Insert a value in between the quote. This value is always of type hexa. */
+ status = _ux_pictbridge_hexa_to_element(tag_variable_value, pima_object_buffer);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+
+ /* Update the object pointer position. */
+ pima_object_buffer += 8;
+
+ /* Insert a quote. */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_QUOTE;
+ }
+
+ /* Check if we need to insert a slash at the end of the tag. */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_FORCE_SLASH_AT_END)
+ {
+
+ /* Going to insert a "/". */
+ object_length += 1;
+
+ /* Do bounds-checking. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Insert a "/". */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_SLASH;
+ }
+
+ /* Going to insert a ">". */
+ object_length += 1;
+
+ /* Do bounds-checking. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Insert a ">". */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_END_BRACKET;
+ }
+
+ /* Is there a tag element to add between the begin tag and end tag ? */
+ /* We do have something to insert, this element can have multiple format and
+ can be a single value or an array of values. */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE)
+ {
+
+ /* We have a single variable. Check its nature. Is it hexa ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_HEXA)
+ {
+
+ /* Going to insert 8 hex chars. Do bounds-checking. */
+ if (object_length + 8 > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a single hexa value to insert. */
+ status = _ux_pictbridge_hexa_to_element((ULONG)(ALIGN_TYPE) tag_element, pima_object_buffer);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+ element_length = 8;
+ }
+
+ /* Is it decimal ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_DECIMAL)
+ {
+
+ /* Going to insert at maximum 8 chars. Do bounds-checking. */
+ if (object_length + 8 > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a single decimal value to insert. */
+ status = _ux_pictbridge_hexa_to_decimal_string((ULONG)(ALIGN_TYPE) tag_element, pima_object_buffer, UX_PICTBRIDGE_LEADING_ZERO_OFF, 8);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+ _ux_utility_string_length_check(pima_object_buffer, &element_length, 8);
+ }
+
+ /* Is it 3 decimal with leading zeroes ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_DECIMAL_3DIGITS)
+ {
+
+ /* Going to insert at maximum 3 chars. Do bounds-checking. */
+ if (object_length + 3 > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a single decimal value to insert but 3 digits only and leading zeroes. */
+ status = _ux_pictbridge_hexa_to_decimal_string((ULONG)(ALIGN_TYPE) tag_element, pima_object_buffer, UX_PICTBRIDGE_LEADING_ZERO_ON, 3);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+ element_length = 3;
+ }
+
+ /* Is it in the form 00.00 ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_MAJOR_MINOR)
+ {
+
+ /* Going to insert at maximum 5 chars. Do bounds-checking. */
+ if (object_length + 5 > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a major minor value to insert. */
+ status = _ux_pictbridge_hexa_to_major_minor((ULONG)(ALIGN_TYPE) tag_element, pima_object_buffer);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+ element_length = 5;
+ }
+
+ /* Is it a ascii string ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING)
+ {
+
+ /* Calculate the length of the element to be inserted. */
+ status = _ux_utility_string_length_check((UCHAR *) tag_element, &element_length, UX_PICTBRIDGE_MAX_ELEMENT_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+
+ /* Going to insert element. Do bounds-checking. */
+ if (object_length + element_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a string to insert. */
+ _ux_utility_memory_copy(pima_object_buffer, (UCHAR *) tag_element, element_length);
+ }
+
+ /* Update the object pointer position. */
+ pima_object_buffer += element_length;
+
+ object_length += element_length;
+ }
+
+ /* Is there an array to insert ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY)
+ {
+
+ /* We have an array to insert. First reset the value index. */
+ value_index = 0;
+
+ /* Parse all qualities supported and insert their values. */
+ while( *((ULONG *)tag_element + value_index) != 0)
+ {
+
+ /* If this value is not the first, we must use a space separator. */
+ if (value_index != 0)
+ {
+
+ /* Going to insert a space. */
+ object_length += 1;
+
+ /* Do bounds-checking. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Insert a space. */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_SPACE;
+ }
+
+ /* We have a array variable. Check its nature. Is it hexa ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_HEXA)
+ {
+
+ /* Going to insert 8 hex chars. Do bounds-checking. */
+ if (object_length + 8 > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a single hexa value to insert. */
+ status = _ux_pictbridge_hexa_to_element( *((ULONG *) tag_element + value_index), pima_object_buffer);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+ element_length = 8;
+ }
+
+ /* Is it decimal ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_DECIMAL)
+ {
+
+ /* Going to insert at maximum 8 chars. Do bounds-checking. */
+ if (object_length + 8 > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a array of decimal value to insert. */
+ status = _ux_pictbridge_hexa_to_decimal_string( *((ULONG *)tag_element + value_index), pima_object_buffer, UX_PICTBRIDGE_LEADING_ZERO_OFF, 8);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+ _ux_utility_string_length_check(pima_object_buffer, &element_length, 8);
+ }
+
+ /* Is it in the form 00.00 ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_MAJOR_MINOR)
+ {
+
+ /* Going to insert at maximum 5 chars. Do bounds-checking. */
+ if (object_length + 5 > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a array of major minor value to insert. */
+ status = _ux_pictbridge_hexa_to_major_minor( *((ULONG *) tag_element + value_index), pima_object_buffer);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+ element_length = 5;
+ }
+
+ /* Is it a ascii string ? */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_VARIABLE_ARRAY_STRING)
+ {
+
+ /* Calculate the length of the element to be inserted. */
+ status = _ux_utility_string_length_check((UCHAR *) (*((ALIGN_TYPE *)tag_element)), &element_length, UX_PICTBRIDGE_MAX_ELEMENT_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+
+ /* Going to insert element. Do bounds-checking. */
+ if (object_length + element_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* We have a string to insert. */
+ _ux_utility_memory_copy(pima_object_buffer, (UCHAR *) (*((ALIGN_TYPE *)tag_element)), element_length);
+ }
+
+ /* Update the object pointer position. */
+ pima_object_buffer += element_length;
+
+ /* And update the cumulated length of the object. */
+ object_length += element_length;
+
+ /* Next index value. */
+ value_index++;
+ }
+ }
+
+ /* Check if we need to insert an end tag. */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_END)
+ {
+
+ /* Going to insert a "<". */
+ object_length += 1;
+
+ /* Going to insert a "/". */
+ object_length += 1;
+
+ /* Calculate the length of the element. */
+ status = _ux_utility_string_length_check(tag_element_string, &element_length, UX_PICTBRIDGE_MAX_ELEMENT_SIZE);
+ if (status != UX_SUCCESS)
+
+ /* Bad element. */
+ return(status);
+
+ /* Going to insert element. */
+ object_length += element_length;
+
+ /* Going to insert a ">". */
+ object_length += 1;
+
+ /* Going to insert a LF. */
+ object_length += 1;
+
+ /* Do bounds-checking. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Insert a "<". */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_START_BRACKET;
+
+ /* Insert a "/". */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_SLASH;
+
+ /* Create the element string. */
+ _ux_utility_memory_copy(pima_object_buffer, tag_element_string, element_length);
+
+ /* Update the object pointer position. */
+ pima_object_buffer += element_length;
+
+ /* Insert a ">". */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_END_BRACKET;
+
+ /* Insert a LF. */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_LF;
+ }
+
+ /* Check if we need to force a LF at end. */
+ if (tag_flag & UX_PICTBRIDGE_TAG_FLAG_FORCE_LF)
+ {
+
+ /* Going to insert a LF. */
+ object_length += 1;
+
+ /* Do bounds-checking. */
+ if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Insert a LF. */
+ *pima_object_buffer++ = UX_PICTBRIDGE_TAG_CHAR_LF;
+ }
+
+ /* Update the caller's object position. */
+ *pima_object_buffer_updated = pima_object_buffer;
+
+ /* Update the caller's object length . */
+ *object_length_updated = object_length;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_tag_name_get.c b/common/usbx_pictbridge/src/ux_pictbridge_tag_name_get.c
new file mode 100644
index 0000000..47d29a7
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_tag_name_get.c
@@ -0,0 +1,479 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_tag_name_get PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function isolates a tag name from the XML script. */
+/* */
+/* Note: the buffer size of tag_name, variable_name, variable_string */
+/* and xml_parameter must be equal to or greater than */
+/* UX_PICTBRIDGE_MAX_TAG_SIZE, UX_PICTBRIDGE_MAX_VARIABLE_SIZE, */
+/* UX_PICTBRIDGE_MAX_STRING_SIZE and UX_PICTBRIDGE_MAX_STRING_SIZE. */
+/* */
+/* INPUT */
+/* */
+/* input_buffer Pointer to object buffer */
+/* input_length Length of the object */
+/* tag_name Where to store the tag */
+/* variable_name Variable name */
+/* variable_string Variable string */
+/* xml_parameter ML parameter */
+/* output_buffer Pointer after the tag */
+/* output_length Length of the object */
+/* tag_flag flag specific to this tag */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_tag_name_get(UCHAR *input_buffer, ULONG input_length,
+ UCHAR *tag_name,
+ UCHAR *variable_name,
+ UCHAR *variable_string,
+ UCHAR *xml_parameter,
+ UCHAR **output_buffer, ULONG *output_length,
+ ULONG *tag_flag)
+{
+ULONG flag;
+ULONG char_count;
+UCHAR *tag_name_end;
+UCHAR *variable_name_end;
+UCHAR *variable_string_end;
+UCHAR *xml_parameter_end;
+
+ /* Reset the local flags. */
+ flag = 0;
+
+ /* Reset the caller's tag_flag. */
+ *tag_flag = 0;
+
+ /* Char count reset. */
+ char_count = 0;
+
+ /* Reset the tag name buffer. */
+ _ux_utility_memory_set(tag_name, 0, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ tag_name_end = tag_name + UX_PICTBRIDGE_MAX_TAG_SIZE - 1;
+
+ /* Reset the variable name buffer. */
+ _ux_utility_memory_set(variable_name, 0, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ variable_name_end = variable_name + UX_PICTBRIDGE_MAX_VARIABLE_SIZE - 1;
+
+ /* Reset the variable string buffer. */
+ _ux_utility_memory_set(variable_string, 0, UX_PICTBRIDGE_MAX_STRING_SIZE);
+ variable_string_end = variable_string + UX_PICTBRIDGE_MAX_STRING_SIZE - 1;
+
+ /* Reset the xml parameter. */
+ _ux_utility_memory_set(xml_parameter, 0, UX_PICTBRIDGE_MAX_STRING_SIZE);
+ xml_parameter_end = xml_parameter + UX_PICTBRIDGE_MAX_STRING_SIZE - 1;
+
+ /* We parse the current xml tag line. We are now positioned at the "<". */
+ while(input_length)
+ {
+ /* Get a character from the tag line. */
+ switch (*input_buffer)
+ {
+
+ case UX_PICTBRIDGE_TAG_CHAR_START_BRACKET :
+
+ /* Check to see if we are within a quote. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_STRING)
+ {
+
+ /* Yes, store the bracket in the string. */
+ if (variable_string > variable_string_end)
+ return(UX_BUFFER_OVERFLOW);
+ *variable_string++ = *input_buffer;
+
+ break;
+ }
+
+ /* Check to see if we are already in the bracket. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_BEGIN)
+
+ /* Yes, we have a syntax violation. */
+ return(UX_PICTBRIDGE_ERROR_PARAMETER_MISSING);
+
+ else
+ /* Set the tag flag to start bracket. State machine is now in Tag. */
+ flag |= (UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_IN_TAG);
+
+
+ break;
+
+
+ case UX_PICTBRIDGE_TAG_CHAR_CR :
+ case UX_PICTBRIDGE_TAG_CHAR_LF :
+
+ /* If we are in the middle of a <>, we have a format violation. If not, we may have an empty line. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_BEGIN)
+
+ /* We have a XML tag violation. */
+ return(UX_PICTBRIDGE_ERROR_PARAMETER_MISSING);
+ else
+ break;
+
+ case UX_PICTBRIDGE_TAG_CHAR_SPACE :
+
+ /* If we are within a tag already, this masks the end. If not, continue looking for
+ an open bracket. */
+ if ((flag & UX_PICTBRIDGE_TAG_FLAG_BEGIN) == 0)
+ break;
+
+ /* Check to see if we are within a quote. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_STRING)
+ {
+ /* Yes, store the character. */
+ if (variable_string > variable_string_end)
+ return(UX_BUFFER_OVERFLOW);
+ *variable_string++ = UX_PICTBRIDGE_TAG_CHAR_SPACE;
+
+ break;
+ }
+
+ /* If we are in the flag state machine. It marks the end of the flag and maybe the
+ beginning of a variable. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_TAG)
+ {
+
+ /* get out of tag state machine. */
+ flag &= (ULONG)~UX_PICTBRIDGE_TAG_FLAG_IN_TAG;
+
+ /* Change state machine to variable. */
+ flag |= (ULONG)UX_PICTBRIDGE_TAG_FLAG_IN_VARIABLE;
+
+ }
+ break;
+
+ case UX_PICTBRIDGE_TAG_CHAR_EQUAL :
+
+ /* If we are not within a bracket, this is a loose character ! */
+ if ((flag & UX_PICTBRIDGE_TAG_FLAG_BEGIN) == 0)
+ break;
+
+ /* Check to see if we are within a string. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_STRING)
+ {
+ /* Yes, store the character. */
+ if (variable_string > variable_string_end)
+ return(UX_BUFFER_OVERFLOW);
+ *variable_string++ = *input_buffer;
+
+ break;
+ }
+
+ /* If we are in the flag state machine we have an error. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_TAG)
+
+ /* Error, we should have been in the variable state machine. */
+ return(UX_PICTBRIDGE_ERROR_PARAMETER_MISSING);
+
+ /* If we are in the variable state machine, change the state to expecting string. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_VARIABLE)
+ {
+
+ /* Get out of the variable state machine. */
+ flag &= (ULONG)~UX_PICTBRIDGE_TAG_FLAG_IN_VARIABLE;
+
+ /* Change state machine to expecting string. */
+ flag |= UX_PICTBRIDGE_TAG_FLAG_EXPECTING_STRING;
+
+ }
+ break;
+
+ case UX_PICTBRIDGE_TAG_CHAR_QUOTE :
+
+ /* Are we in the string state machine ? */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_STRING)
+
+ /* Get out of the in string state machine. We are out of any state now. */
+ flag &= (ULONG)~UX_PICTBRIDGE_TAG_FLAG_IN_STRING;
+
+ else
+ {
+
+ /* Are we expecting a string ? */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_EXPECTING_STRING)
+ {
+
+ /* Get out of the expecting string state machine. */
+ flag &= (ULONG)~UX_PICTBRIDGE_TAG_FLAG_EXPECTING_STRING;
+
+ /* Change state machine to in string. */
+ flag |= UX_PICTBRIDGE_TAG_FLAG_IN_STRING;
+
+ }
+
+ else
+
+ /* Loose character ! */
+ return(UX_PICTBRIDGE_ERROR_PARAMETER_MISSING);
+
+ }
+
+ break;
+
+ case UX_PICTBRIDGE_TAG_CHAR_SLASH :
+
+ /* If we are in no particular state at the moment, we could have a begin slash or end slash. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_STRING)
+ {
+
+ /* We are in the variable string state machine. Store the "/" as a normal character. */
+ if (variable_string > variable_string_end)
+ return(UX_BUFFER_OVERFLOW);
+ *variable_string++ = *input_buffer;
+
+ break;
+ }
+ /* Check other states. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_TAG)
+ {
+
+ /* We are in a tag. 2 scenario here. We are either at the beginning or at the end. */
+ if (char_count != 0)
+
+ /* We are at the end of the tag, this is a self closing tag. */
+ *tag_flag |= UX_PICTBRIDGE_TAG_FLAG_SELF_CLOSING;
+
+ else
+
+ /* This is a normal closing tag. */
+ *tag_flag |= UX_PICTBRIDGE_TAG_FLAG_CLOSING;
+
+ /* We are done here. */
+ break;
+ }
+
+ else
+ {
+
+ /* If we are out of any state machine, it must be a self closing tag. */
+ if (flag & (UX_PICTBRIDGE_TAG_FLAG_IN_VARIABLE | UX_PICTBRIDGE_TAG_FLAG_EXPECTING_STRING))
+
+ /* This is a syntax error, abort. */
+ return(UX_PICTBRIDGE_ERROR_PARAMETER_MISSING);
+
+ else
+ {
+ /* We are at the end of the tag, this is a self closing tag. */
+ *tag_flag |= UX_PICTBRIDGE_TAG_FLAG_SELF_CLOSING;
+
+ /* We are done here. */
+ break;
+ }
+
+ }
+
+
+ case UX_PICTBRIDGE_TAG_CHAR_QUESTION_MARK :
+
+ /* If we are in no particular state at the moment, we could have a begin ? or end ?. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_STRING)
+
+ /* We are within a quoted string, do not proceed. */
+ break;
+
+ else
+
+ /* This is a comment line, no need for a closing tag. */
+ *tag_flag |= UX_PICTBRIDGE_TAG_FLAG_COMMENT;
+
+ break;
+
+ case UX_PICTBRIDGE_TAG_CHAR_END_BRACKET :
+
+ /* If we are in no particular state at the moment, we could have a begin ? or end ?. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_STRING)
+ {
+
+ /* Yes, store the bracket in the string. */
+ if (variable_string > variable_string_end)
+ return(UX_BUFFER_OVERFLOW);
+ *variable_string++ = *input_buffer;
+
+ break;
+ }
+
+ /* Check if we are within a bracket. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_BEGIN)
+ {
+
+ /* Skip the closing bracket. */
+ input_buffer++;
+
+ /* Update length. */
+ input_length--;
+
+ /* We may have a xml parameter between the current tag and its closing counterpart. */
+ while(input_length)
+ {
+
+ /* Get a character between the tag brackets. */
+ switch (*input_buffer)
+ {
+
+ case UX_PICTBRIDGE_TAG_CHAR_CR :
+ case UX_PICTBRIDGE_TAG_CHAR_LF :
+
+ /* Skip potential CR/LF. */
+ break;
+
+
+ case UX_PICTBRIDGE_TAG_CHAR_START_BRACKET :
+
+ /* We have found the beginning of the next tag.
+ Set the output buffer position to the next "<". */
+ *output_buffer = input_buffer;
+
+ /* Set the length remaining. */
+ *output_length = input_length;
+
+ /* We are done here. */
+ return(UX_SUCCESS);
+
+ default :
+
+ /* Whatever we have now, we store into the XML parameter. */
+ if (xml_parameter > xml_parameter_end)
+ return(UX_BUFFER_OVERFLOW);
+ *xml_parameter++ = *input_buffer;
+ break;
+
+ }
+
+ /* Next position. */
+ input_buffer++;
+
+ /* Update length. */
+ input_length--;
+
+ }
+
+ /* Set the output buffer position. */
+ *output_buffer = input_buffer;
+
+ /* Set the length remaining. */
+ *output_length = input_length;
+
+ /* We have reached the end of the xml object. */
+ return(UX_SUCCESS);
+
+ }
+ else
+
+ /* We have a syntax error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ default :
+
+ /* Check if we are within a bracket. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_BEGIN)
+
+ /* Yes, increase the char count. This will tell us
+ if we are at the beginning of a tag or at the end. */
+ char_count++;
+
+ /* We have a regular character. Store it in the current state machine. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_TAG)
+ {
+ /* We are in the tag state machine. */
+ if (tag_name > tag_name_end)
+ return(UX_BUFFER_OVERFLOW);
+ *tag_name++ = *input_buffer;
+ }
+
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_VARIABLE)
+ {
+ /* We are in the variable state machine. */
+ if (variable_name > variable_name_end)
+ return(UX_BUFFER_OVERFLOW);
+ *variable_name++ = *input_buffer;
+ }
+
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_IN_STRING)
+ {
+ /* We are in the variable string state machine. */
+ if (variable_string > variable_string_end)
+ return(UX_BUFFER_OVERFLOW);
+ *variable_string++ = *input_buffer;
+ }
+
+ break;
+
+ }
+
+ /* Next position. */
+ input_buffer++;
+
+ /* Update length. */
+ input_length--;
+
+ }
+
+ /* We get here when we reached an unexpected end of the XML object.
+ if we had a begin bracket, there is an unexpected end. If not, we
+ have an empty line. */
+ if (flag & UX_PICTBRIDGE_TAG_FLAG_BEGIN)
+
+ /* We have an error. */
+ return(UX_PICTBRIDGE_ERROR_PARAMETER_MISSING);
+
+ else
+
+ /* Not really an error, but we need to inform the caller there is no tag to process. */
+ return(UX_PICTBRIDGE_ERROR_EMPTY_LINE);
+
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_tag_name_scan.c b/common/usbx_pictbridge/src/ux_pictbridge_tag_name_scan.c
new file mode 100644
index 0000000..fc1c152
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_tag_name_scan.c
@@ -0,0 +1,118 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_tag_name_scan PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function scans the tag name from a set of allowed tags */
+/* */
+/* INPUT */
+/* */
+/* tag_item list of allowed tags */
+/* tag_name the tag name to scan */
+/* tag_entry Address of the found tag */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_tag_name_scan(UX_PICTBRIDGE_XML_ITEM *tag_item,
+ UCHAR *tag_name,
+ UX_PICTBRIDGE_XML_ITEM **tag_entry)
+{
+UINT tag_name_length = 0;
+UINT tag_item_length = 0;
+UINT status;
+
+
+ /* Calculate the length of the tag item. */
+ status = _ux_utility_string_length_check(tag_name, &tag_name_length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Parse all the tags contained in the tag_item list. */
+ while(tag_item -> ux_pictbridge_xml_item_tag_name[0] != 0)
+ {
+
+ /* There is a valid entry in the tag list. Calculate the length of the tag name from the list. */
+ status = _ux_utility_string_length_check(tag_item -> ux_pictbridge_xml_item_tag_name, &tag_item_length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* If both length do not match, no need to check for a match. */
+ if (tag_item_length == tag_name_length)
+ {
+
+ /* Both length match, we may have a tag match. Check the names */
+ if (_ux_utility_memory_compare(tag_name, tag_item -> ux_pictbridge_xml_item_tag_name,
+ tag_item_length) == UX_SUCCESS)
+ {
+
+ /* We have found the tag. Save the entry in the caller tag_entry field. */
+ *tag_entry = tag_item;
+
+ /* We are done here. */
+ return(UX_SUCCESS);
+
+ }
+ }
+
+ /* The tags length or the tag names did not match. Proceed to the next tag. */
+ tag_item++;
+ }
+
+ /* We get here when we reached the end of the tag list and no match. */
+ return(UX_PICTBRIDGE_ERROR_PARAMETER_UNKNOWN);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_getcapability_capability_layouts.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_getcapability_capability_layouts.c
new file mode 100644
index 0000000..1e25e0b
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_getcapability_capability_layouts.c
@@ -0,0 +1,132 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "layouts" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_getcapability_capability_layouts(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT input_length = 0;
+UINT length = 0;
+ULONG papersize;
+UINT status;
+
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Get the length of the variable. This is an option and there may be none.*/
+ status = _ux_utility_string_length_check(input_variable, &input_length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Check if there is a variable defined. */
+ if (input_length == 0)
+ {
+
+ /* No variable. Reset the layouts paperTypes option. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_layouts_papersize = 0;
+
+ /* Return success. */
+ return(UX_SUCCESS);
+ }
+
+ /* Get the length of the "papersize " variable. */
+ status = _ux_utility_string_length_check(_ux_pictbridge_xml_variable_papersize, &length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* If length do not match, no need to check for a match. */
+ if (length == input_length)
+ {
+
+ /* Both length match, we may have a variable name match. Check the names */
+ if (_ux_utility_memory_compare(_ux_pictbridge_xml_variable_papersize,input_variable, length) == UX_SUCCESS)
+ {
+
+ /* Get the value for the papersize. */
+ status = _ux_pictbridge_element_to_hexa(input_string, &papersize);
+
+ /* Check status. If OK, save the papersize value for layout. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Set the layouts paperTypes option with the string value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_layouts_papersize = papersize;
+
+ /* The variable name is OK. We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ }
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_getcapability_capability_papertypes.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_getcapability_capability_papertypes.c
new file mode 100644
index 0000000..bcceeba
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_getcapability_capability_papertypes.c
@@ -0,0 +1,131 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "layouts" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_getcapability_capability_papertypes(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT input_length = 0;
+UINT length = 0;
+ULONG papersize;
+UINT status;
+
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Get the length of the variable. This is an option and there may be none.*/
+ status = _ux_utility_string_length_check(input_variable, &input_length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Check if there is a variable defined. */
+ if (input_length == 0)
+ {
+
+ /* No variable. Reset the layouts paperTypes option. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_papertypes_papersize = 0;
+
+ /* Return success. */
+ return(UX_SUCCESS);
+ }
+
+ /* Get the length of the "papersize " variable. */
+ status = _ux_utility_string_length_check(_ux_pictbridge_xml_variable_papersize, &length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* If length do not match, no need to check for a match. */
+ if (length == input_length)
+ {
+
+ /* Both length match, we may have a variable name match. Check the names */
+ if (_ux_utility_memory_compare(_ux_pictbridge_xml_variable_papersize,input_variable, length) == UX_SUCCESS)
+ {
+
+ /* Get the value for the papersize. */
+ status = _ux_pictbridge_element_to_hexa(input_string, &papersize);
+
+ /* Check status. If OK, save the papersize value for layout. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Set the layouts paperTypes option with the string value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_papertypes_papersize = papersize;
+
+ /* The variable name is OK. We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ }
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged.c
new file mode 100644
index 0000000..d09665b
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged.c
@@ -0,0 +1,109 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the capabilitychanged tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_capabilitychanged(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the capabilitychanged variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Check the returned value. Must be one of 2 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_CAPABILITY_CHANGED_FALSE ||
+ hexa_element == UX_PICTBRIDGE_CAPABILITY_CHANGED_TRUE)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_capabilitychanged = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_disconnectenable.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_disconnectenable.c
new file mode 100644
index 0000000..05f8717
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_disconnectenable.c
@@ -0,0 +1,111 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_notifydevicestatus_ */
+/* disconnectenable */
+/* POTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the disconnectenable tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_disconnectenable(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the disconnectenable variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Check the returned value. Must be one of 2 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_DISCONNECT_ENABLE_FALSE ||
+ hexa_element == UX_PICTBRIDGE_DISCONNECT_ENABLE_TRUE)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_disconnectenable = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_dpsprintservicestatus.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_dpsprintservicestatus.c
new file mode 100644
index 0000000..0a8f1b3
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_dpsprintservicestatus.c
@@ -0,0 +1,110 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the dpsprintservicestatus tag */
+/* object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_dpsprintservicestatus(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the dpsprintservicestatus variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Check the returned value. Must be one of 3 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_ACTIVE ||
+ hexa_element == UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE ||
+ hexa_element == UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_PAUSED)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_dpsprintservicestatus = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorreason.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorreason.c
new file mode 100644
index 0000000..d2a9486
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorreason.c
@@ -0,0 +1,112 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the errorreason tag */
+/* object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_errorreason(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+
+ /* Get the error reason variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+ /* Check the returned value. Must be one of 5 possibilities. */
+ if ((hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_NO_REASON ||
+ (hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_PAPER_RELATED ||
+ (hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_INK_RELATED ||
+ (hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_HARDWARE_RELATED ||
+ (hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_FILE_RELATED)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_errorreason = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorstatus.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorstatus.c
new file mode 100644
index 0000000..144ac4f
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_errorstatus.c
@@ -0,0 +1,111 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the errorstatus tag */
+/* object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_errorstatus(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Get the error status variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Check the returned value. Must be one of 3 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_ERROR_STATUS_NO_ERROR ||
+ hexa_element == UX_PICTBRIDGE_ERROR_STATUS_WARNING ||
+ hexa_element == UX_PICTBRIDGE_ERROR_STATUS_FATAL)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_errorstatus = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason.c
new file mode 100644
index 0000000..246cd5b
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason.c
@@ -0,0 +1,111 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the jobendreason tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_jobendreason(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Get the dpsprintservicestatus variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Check the returned value. Must be one of 5 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_JOB_END_REASON_NOT_ENDED ||
+ hexa_element == UX_PICTBRIDGE_JOB_END_REASON_NORMAL ||
+ hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_9000000 ||
+ hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_9001000 ||
+ hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_OTHER)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_jobendreason = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_newjobok.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_newjobok.c
new file mode 100644
index 0000000..b856d65
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_notifydevicestatus_newjobok.c
@@ -0,0 +1,109 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the newjobok tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_notifydevicestatus_newjobok(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Get the newjobok variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Check the returned value. Must be one of 2 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_NEW_JOB_FALSE ||
+ hexa_element == UX_PICTBRIDGE_NEW_JOB_TRUE)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_newjobok = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob.c
new file mode 100644
index 0000000..4ddce0e
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob.c
@@ -0,0 +1,118 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_startjob PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function receives an order for a new job. It issues */
+/* notification to the pictbridge thread. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UX_PICTBRIDGE_EVENT *pictbridge_next_event;
+UX_PICTBRIDGE_EVENT *pictbridge_event;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Compute the next entry in the event array. */
+ if ((pictbridge -> ux_pictbridge_event_array_head + 1) == pictbridge -> ux_pictbridge_event_array_end)
+
+ /* Start at the beginning of the list. */
+ pictbridge_next_event = pictbridge -> ux_pictbridge_event_array;
+ else
+
+ /* Point to the next entry in the event array. */
+ pictbridge_next_event = pictbridge -> ux_pictbridge_event_array_head + 1;
+
+ /* Check to see if we can store this event. */
+ if (pictbridge_next_event == pictbridge -> ux_pictbridge_event_array_tail)
+
+ /* No place to store this event, throw it away. */
+ return(UX_ERROR);
+
+ /* Current storage is in the current head. */
+ pictbridge_event = pictbridge -> ux_pictbridge_event_array_head;
+
+ /* Store the start job event in the pictbridge event queue. */
+ pictbridge_event -> ux_pictbridge_event_code = UX_PICTBRIDGE_EC_START_JOB;
+ pictbridge_event -> ux_pictbridge_event_parameter_1 = 0;
+ pictbridge_event -> ux_pictbridge_event_parameter_2 = 0;
+ pictbridge_event -> ux_pictbridge_event_parameter_3 = 0;
+
+ /* Advance the pictbridge event queue head. */
+ pictbridge -> ux_pictbridge_event_array_head = pictbridge_next_event;
+
+ /* Wake up the Pictbridge notification handler thread. */
+ _ux_utility_semaphore_put(&pictbridge -> ux_pictbridge_notification_semaphore);
+
+ /* This function never fails. */
+ return(UX_SUCCESS);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_cropping.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_cropping.c
new file mode 100644
index 0000000..f8646ae
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_cropping.c
@@ -0,0 +1,101 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "cropping" tag in the jobconfig */
+/* object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_cropping(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the cropping value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_cropping = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_dateprint.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_dateprint.c
new file mode 100644
index 0000000..df11cbe
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_dateprint.c
@@ -0,0 +1,100 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "dateprint" tag in the jobconfig object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_dateprint(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the dateprint value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_dateprint = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filenameprint.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filenameprint.c
new file mode 100644
index 0000000..1c8fb7f
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filenameprint.c
@@ -0,0 +1,101 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "filenameprint" tag in the jobconfig */
+/* object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_filenameprint(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the filenameprint value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_filenameprint = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filetype.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filetype.c
new file mode 100644
index 0000000..4064d22
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_filetype.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "filertype" tag in the jobconfig object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_filetype(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the filetype value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_filetype = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_fixedsize.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_fixedsize.c
new file mode 100644
index 0000000..f515889
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_fixedsize.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "fixedsize" tag in the jobconfig object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_fixedsize(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the fixedsize value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_fixedsize = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_imageoptimize.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_imageoptimize.c
new file mode 100644
index 0000000..340f3a4
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_imageoptimize.c
@@ -0,0 +1,100 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "imageoptimize" tag in the jobconfig */
+/* object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_imageoptimize(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the imageoptimize value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_imageoptimize = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_layout.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_layout.c
new file mode 100644
index 0000000..8c1118e
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_layout.c
@@ -0,0 +1,100 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "layout" tag in the jobconfig */
+/* object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_layout(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the layout value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_layout = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papersize.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papersize.c
new file mode 100644
index 0000000..a328671
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papersize.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "papersize" tag in the jobconfig object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_papersize(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the papersize value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_papersize = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papertype.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papertype.c
new file mode 100644
index 0000000..ac3e173
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_papertype.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "papertype" tag in the jobconfig object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_papertype(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the papertype value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_papertype = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_quality.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_quality.c
new file mode 100644
index 0000000..4e0bc6a
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_jobconfig_quality.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "quality" tag in the jobconfig object */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_jobconfig_quality(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the quality value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_quality = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo.c
new file mode 100644
index 0000000..7990c23
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo.c
@@ -0,0 +1,125 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_startjob_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function receives a printinfo data block tag. There can be */
+/* many so we should create a new printinfo block into the startjob */
+/* structure for each of them as they come. */
+/* */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UX_PICTBRIDGE_PRINTINFO *printinfo;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Allocate some memory for the print info structure. */
+ printinfo = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, sizeof(UX_PICTBRIDGE_PRINTINFO));
+
+ /* Check memory allocation. */
+ if (printinfo == UX_NULL)
+ {
+ /* Set the error flag in the jobinfo structure. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_status = UX_ERROR;
+
+ /* Return an error. */
+ return(UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Store the current printinfo structure. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current = printinfo;
+
+ /* We need to hook this instance, either it is the first or we have one or more previous instances. */
+ if (pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_start == UX_NULL)
+ {
+
+ /* This is the first instance of a printinfo block. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_start = printinfo;
+
+ /* Make it the current as well. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current = printinfo;
+
+ }
+ else
+ {
+ /* Store the new instance in the next instance pointer of the current instance. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_next = printinfo;
+
+ /* And the new one becomes the current. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current = printinfo;
+
+ }
+
+ /* This function did not fail. */
+ return(UX_SUCCESS);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_copies.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_copies.c
new file mode 100644
index 0000000..e71c200
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_copies.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "copies" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_copies(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG decimal_value;
+
+UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_decimal(xml_parameter, &decimal_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the copies value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_copies = decimal_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_copyid.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_copyid.c
new file mode 100644
index 0000000..0fb1a46
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_copyid.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "copyid" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_copyid(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG decimal_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_decimal(xml_parameter, &decimal_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the copyid value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_copyid = decimal_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_croppingarea.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_croppingarea.c
new file mode 100644
index 0000000..6221049
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_croppingarea.c
@@ -0,0 +1,234 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "croppingarea" tag */
+/* It is followed by 4 coordinates in hexa form. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_croppingarea(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT length = 0;
+ULONG index;
+UINT status;
+UCHAR element_string[UX_PICTBRIDGE_MAX_ELEMENT_SIZE];
+UCHAR *element_ptr;
+ULONG element_length;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* The xml parameter is pointing to the beginning of the 4 coordinates. They are separated
+ by spaces. Each has 4 bytes in hexadecimal. We need to extract each ones and store them
+ in the printinfo area. */
+ status = _ux_utility_string_length_check(xml_parameter, &length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Ensure the length is non zero, otherwise that means the tag has no parameter. */
+ if (length == 0)
+
+ /* That's a syntax error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ /* Reset the cropping area index. */
+ index = 0;
+
+ /* Reset the element area. */
+ _ux_utility_memory_set(element_string, 0, UX_PICTBRIDGE_MAX_ELEMENT_SIZE);
+
+ /* And its length. */
+ element_length = 0;
+
+ /* Set the pointer to the beginning of the element string. */
+ element_ptr = element_string;
+
+ /* Now parse the line and isolate each component of the cropping area. */
+ /* Get the length of the "papersize " variable. */
+ while(length != 0)
+ {
+
+ /* Get a character from the xml parameter. Check for delimiter. */
+ if (*xml_parameter == UX_PICTBRIDGE_TAG_CHAR_SPACE)
+ {
+
+ /* Do we have a element ? */
+ if (element_length != 0)
+ {
+
+ /* Yes we do, get the hexa value for that element. */
+ status = _ux_pictbridge_element_to_hexa(element_string, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* Where to store this element. */
+ switch (index)
+ {
+
+ case 0 :
+
+ /* This is the X coordinate of the cropping area. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_croppingarea_xcoordinate = hexa_value;
+
+ break;
+
+ case 1 :
+
+ /* This is the Y coordinate of the cropping area. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_croppingarea_ycoordinate = hexa_value;
+
+ break;
+ case 2 :
+
+ /* This is the width of the cropping area. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_croppingarea_width = hexa_value;
+
+ break;
+ case 3 :
+ /* This is the height of the cropping area. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_croppingarea_height = hexa_value;
+
+ break;
+ }
+
+ /* Next index now. */
+ index++;
+
+ /* Reset the element area. */
+ _ux_utility_memory_set(element_string, 0, UX_PICTBRIDGE_MAX_ELEMENT_SIZE);
+
+ /* And its length. */
+ element_length = 0;
+
+ /* Set the pointer to the beginning of the element string. */
+ element_ptr = element_string;
+
+ }
+ }
+ else
+ {
+
+ /* We have a regular character. Store it in the element string buffer. No need to check
+ the syntax here as the string to hexa conversion will do that. */
+ *element_ptr++ = *xml_parameter;
+
+ /* Increase the length of the element. */
+ element_length++;
+
+ }
+
+
+ /* Next position. */
+ xml_parameter++;
+
+ /* Update length. */
+ length--;
+
+ }
+
+ /* We get here when we reached the end of the xml parameter. We may still have the last element of the cropping area to parse.
+ The index value will tell us what to do. */
+ switch (index)
+ {
+
+ case 3 :
+
+ /* Still need to parse the last element. Get the hexa value for that element. */
+ status = _ux_pictbridge_element_to_hexa(element_string, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* This is the height of the cropping area. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_croppingarea_height = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+ case 4:
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+ default :
+
+ /* Syntax error. Missing element of the cropping area. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+ }
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_date.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_date.c
new file mode 100644
index 0000000..c06790c
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_date.c
@@ -0,0 +1,102 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "date" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_date(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+UINT length = 0;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the length of the parameter. */
+ status = _ux_utility_string_length_check(xml_parameter, &length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Ensure the length is non zero, otherwise that means the tag has no parameter. */
+ if (length == 0)
+
+ /* That's a syntax error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ /* We need to copy the date. */
+ _ux_utility_memory_copy(pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_date,
+ xml_parameter, length);
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_fileid.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_fileid.c
new file mode 100644
index 0000000..5b3cdf9
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_fileid.c
@@ -0,0 +1,100 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "fileid" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_fileid(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the fileid value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_fileid = hexa_value;
+
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_filename.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_filename.c
new file mode 100644
index 0000000..e59ea5a
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_filename.c
@@ -0,0 +1,102 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "filename" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_filename(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+UINT length = 0;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the length of the parameter. */
+ status = _ux_utility_string_length_check(xml_parameter, &length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Ensure the length is non zero, otherwise that means the tag has no parameter. */
+ if (length == 0)
+
+ /* That's a syntax error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ /* We need to copy the filename. */
+ _ux_utility_memory_copy(pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_filename,
+ xml_parameter, length);
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_filepath.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_filepath.c
new file mode 100644
index 0000000..64bdb82
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_filepath.c
@@ -0,0 +1,102 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "filepath" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_filepath(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+UINT length = 0;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the length of the parameter. */
+ status = _ux_utility_string_length_check(xml_parameter, &length, UX_PICTBRIDGE_MAX_TAG_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Ensure the length is non zero, otherwise that means the tag has no parameter. */
+ if (length == 0)
+
+ /* That's a syntax error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ /* We need to copy the filepath. */
+ _ux_utility_memory_copy(pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_filepath,
+ xml_parameter, length);
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_prtid.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_prtid.c
new file mode 100644
index 0000000..9a2d3be
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_input_startjob_printinfo_prtid.c
@@ -0,0 +1,101 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_input_ PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "prtpid" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_input_startjob_printinfo_prtpid(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the prtpid value. */
+ pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_printinfo_current -> ux_pictbridge_printinfo_prtpid = hexa_value;
+
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_null.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_null.c
new file mode 100644
index 0000000..da87e59
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_null.c
@@ -0,0 +1,82 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_null PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is a repository when a tag is not treated. */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_null(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable, UCHAR *input_string,
+ UCHAR *xml_parameter)
+{
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(pictbridge);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* This function never fails. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_croppings.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_croppings.c
new file mode 100644
index 0000000..adb2a8d
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_croppings.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* croppings */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the croppings tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_croppings(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of croppings supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_croppings);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_dateprints.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_dateprints.c
new file mode 100644
index 0000000..b93b937
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_dateprints.c
@@ -0,0 +1,100 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* dateprints */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the papersize tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_dateprints(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+
+ /* Get the array of date prints supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_dateprints);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_filenameprints.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_filenameprints.c
new file mode 100644
index 0000000..f967652
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_filenameprints.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* filenameprints */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the filenameprints tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_filenameprints(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of file name prints supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_filenameprints);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_filetypes.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_filetypes.c
new file mode 100644
index 0000000..1a56d8f
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_filetypes.c
@@ -0,0 +1,98 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* filetypes */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the filetypes tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_filetypes(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of file types supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_filetypes);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_fixedsizes.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_fixedsizes.c
new file mode 100644
index 0000000..e0fa087
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_fixedsizes.c
@@ -0,0 +1,98 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* fixedsizes */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the fixedsizes tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_fixedsizes(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of fixed sizes supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_fixedsizes);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_imageoptimizes.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_imageoptimizes.c
new file mode 100644
index 0000000..c1bba66
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_imageoptimizes.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* imageoptimizes */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the imageoptimizes tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_imageoptimizes(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of qualities supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_imageoptimizes);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_layouts.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_layouts.c
new file mode 100644
index 0000000..0431d15
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_layouts.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* layouts */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the layouts tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_layouts(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of layouts supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_layouts);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_papersizes.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_papersizes.c
new file mode 100644
index 0000000..339eec6
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_papersizes.c
@@ -0,0 +1,98 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* papersizes */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the papersize tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_papersizes(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of paper sizes supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_papersizes);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_papertypes.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_papertypes.c
new file mode 100644
index 0000000..8d839c2
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_papertypes.c
@@ -0,0 +1,98 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* papertypes */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the papersize tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_papertypes(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of paper types supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_papertypes);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_qualities.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_qualities.c
new file mode 100644
index 0000000..492ca63
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getcapability_capability_qualities.c
@@ -0,0 +1,98 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getcapability_capability_ */
+/* qualities */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the qualities tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getcapability_capability_qualities(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the array of qualities supported by this client. */
+ status = _ux_pictbridge_array_element_to_array_hexa(xml_parameter, (ULONG *) &pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_qualities);
+
+ /* Check status. */
+ if (status != UX_SUCCESS)
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+ else
+
+ /* We are done. */
+ return(UX_SUCCESS);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_capabilitychanged.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_capabilitychanged.c
new file mode 100644
index 0000000..1e44efc
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_capabilitychanged.c
@@ -0,0 +1,109 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getdevicestatus_ */
+/* capabilitychanged */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the capabilitychanged tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_capabilitychanged(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the capabilitychanged variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+ /* Check the returned value. Must be one of 2 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_CAPABILITY_CHANGED_FALSE ||
+ hexa_element == UX_PICTBRIDGE_CAPABILITY_CHANGED_TRUE)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_capabilitychanged = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_disconnectenable.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_disconnectenable.c
new file mode 100644
index 0000000..e957822
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_disconnectenable.c
@@ -0,0 +1,109 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getdevicestatus_ */
+/* disconnectenable */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the disconnectenable tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_disconnectenable(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the disconnectenable variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+ /* Check the returned value. Must be one of 2 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_DISCONNECT_ENABLE_FALSE ||
+ hexa_element == UX_PICTBRIDGE_DISCONNECT_ENABLE_TRUE)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_disconnectenable = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_dpsprintservicestatus.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_dpsprintservicestatus.c
new file mode 100644
index 0000000..9f06f1c
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_dpsprintservicestatus.c
@@ -0,0 +1,110 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getdevicestatus_ */
+/* dpsprintservicestatus */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the dpsprintservicestatus tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_dpsprintservicestatus(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the dpsprintservicestatus variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+ /* Check the returned value. Must be one of 3 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_ACTIVE ||
+ hexa_element == UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_IDLE ||
+ hexa_element == UX_PICTBRIDGE_DPS_PRINTSERVICE_STATUS_PAUSED)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_dpsprintservicestatus = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_errorreason.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_errorreason.c
new file mode 100644
index 0000000..2623a84
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_errorreason.c
@@ -0,0 +1,112 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getdevicestatus_ */
+/* errorreason */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the errorreason tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_errorreason(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the error reason variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+ /* Check the returned value. Must be one of 5 possibilities. */
+ if ((hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_NO_REASON ||
+ (hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_PAPER_RELATED ||
+ (hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_INK_RELATED ||
+ (hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_HARDWARE_RELATED ||
+ (hexa_element & UX_PICTBRIDGE_PARAMETER_MAJOR_CODE_MASK) == UX_PICTBRIDGE_ERROR_REASON_FILE_RELATED)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_errorreason = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_errorstatus.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_errorstatus.c
new file mode 100644
index 0000000..17ed993
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_errorstatus.c
@@ -0,0 +1,110 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getdevicestatus_ */
+/* errorstatus */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the errorstatus tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_errorstatus(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the error status variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+ /* Check the returned value. Must be one of 3 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_ERROR_STATUS_NO_ERROR ||
+ hexa_element == UX_PICTBRIDGE_ERROR_STATUS_WARNING ||
+ hexa_element == UX_PICTBRIDGE_ERROR_STATUS_FATAL)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_errorstatus = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_jobendreason.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_jobendreason.c
new file mode 100644
index 0000000..5700cb5
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_jobendreason.c
@@ -0,0 +1,112 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getdevicestatus_ */
+/* jobendreason */
+/* PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the jobendreason tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_jobendreason(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the dpsprintservicestatus variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+ /* Check the returned value. Must be one of 5 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_JOB_END_REASON_NOT_ENDED ||
+ hexa_element == UX_PICTBRIDGE_JOB_END_REASON_NORMAL ||
+ hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_9000000 ||
+ hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_9001000 ||
+ hexa_element == UX_PICTBRIDGE_JOB_END_REASON_ABORTED_OTHER)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_jobendreason = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_newjobok.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_newjobok.c
new file mode 100644
index 0000000..f0c6530
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_getdevicestatus_newjobok.c
@@ -0,0 +1,110 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_getdevicestatus_newjobok */
+/* */
+/* PORTABLE C */
+/* 6.0 */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the newjobok tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter Pointer to xml parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_getdevicestatus_newjobok(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_element;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the newjobok variable. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_element);
+
+ /* Check status. */
+ if (status == UX_SUCCESS)
+ {
+ /* Check the returned value. Must be one of 2 possibilities. */
+ if (hexa_element == UX_PICTBRIDGE_NEW_JOB_FALSE ||
+ hexa_element == UX_PICTBRIDGE_NEW_JOB_TRUE)
+ {
+
+ /* Save this value. */
+ pictbridge -> ux_pictbridge_dpsclient.ux_pictbridge_devinfo_newjobok = hexa_element;
+
+ /* We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ /* We get here when we reached an unexpected end of the XML object or a format error. */
+ return(UX_PICTBRIDGE_ERROR_SCRIPT_SYNTAX_ERROR);
+
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_result.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_result.c
new file mode 100644
index 0000000..dddf821
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_output_result.c
@@ -0,0 +1,99 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_output_result PORTABLE C */
+/* 6.0 */
+/* */
+/* */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "result" tag in the output descriptor */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* xml_parameter XML parameter */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_output_result(UX_PICTBRIDGE *pictbridge,
+ UCHAR *input_variable, UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+ULONG hexa_value;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+
+ /* Get the hexa value from the xml parameter. */
+ status = _ux_pictbridge_element_to_hexa(xml_parameter, &hexa_value);
+
+ /* Check for error. */
+ if (status != UX_SUCCESS)
+
+ /* We have a element syntax error. */
+ return(status);
+
+ /* We need to store the result value. */
+ pictbridge -> ux_pictbridge_output_result = hexa_value;
+
+ /* Operation is successful. */
+ return(UX_SUCCESS);
+
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_dps.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_dps.c
new file mode 100644
index 0000000..6ac8224
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_dps.c
@@ -0,0 +1,125 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_root_dps PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "dps" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_root_dps(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable,
+ UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+UINT input_length = 0;
+UINT length = 0;
+
+ UX_PARAMETER_NOT_USED(xml_parameter);
+ UX_PARAMETER_NOT_USED(pictbridge);
+
+ /* Get the length of the variable. */
+ status = _ux_utility_string_length_check(input_variable, &input_length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the length of the "xmlns " variable. */
+ status = _ux_utility_string_length_check(_ux_pictbridge_xml_variable_xmlns, &length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* If length do not match, no need to check for a match. */
+ if (length == input_length)
+ {
+
+ /* Both length match, we may have a variable name match. Check the names */
+ if (_ux_utility_memory_compare(_ux_pictbridge_xml_variable_xmlns,input_variable, length) == UX_SUCCESS)
+ {
+
+ /* Get the length of the string. */
+ status = _ux_utility_string_length_check(input_string, &input_length, UX_PICTBRIDGE_MAX_STRING_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the length of the "xmlns" string. */
+ status = _ux_utility_string_length_check(_ux_pictbridge_xml_string_xmlns, &length, UX_PICTBRIDGE_MAX_STRING_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* If length do not match, no need to check for a match. */
+ if (length == input_length)
+ {
+
+ /* Both length match, we may have a string name match. Check the names */
+ if (_ux_utility_memory_compare(_ux_pictbridge_xml_string_xmlns,input_string, length) == UX_SUCCESS)
+
+ /* The variable name is OK. We are done. */
+ return(UX_SUCCESS);
+ }
+ }
+
+ }
+ /* We get here when we reached an unexpected end of the XML object. */
+ return(UX_ERROR);
+}
+
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_input.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_input.c
new file mode 100644
index 0000000..66cd82b
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_input.c
@@ -0,0 +1,85 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_root_input PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the input tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_root_input(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable,
+ UCHAR *input_string, UCHAR *xml_parameter)
+{
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Set the direction of the XML object to Input. */
+ pictbridge -> ux_pictbridge_xml_report_direction = UX_PICTBRIDGE_OBJECT_DIRECTION_INPUT;
+
+ /* This function always succeeds. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_output.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_output.c
new file mode 100644
index 0000000..a807567
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_output.c
@@ -0,0 +1,85 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_root_output PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the output flag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_root_output(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable,
+ UCHAR *input_string, UCHAR *xml_parameter)
+{
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(input_variable);
+ UX_PARAMETER_NOT_USED(pictbridge);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+
+ /* Set the direction of the XML object to Output. */
+ pictbridge -> ux_pictbridge_xml_report_direction = UX_PICTBRIDGE_OBJECT_DIRECTION_OUTPUT;
+
+ /* This function always succeeds. */
+ return(UX_SUCCESS);
+}
+
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_xml.c b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_xml.c
new file mode 100644
index 0000000..8eac3cf
--- /dev/null
+++ b/common/usbx_pictbridge/src/ux_pictbridge_xml_function_root_xml.c
@@ -0,0 +1,108 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Pictbridge Application */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/* Include necessary system files. */
+
+#define UX_SOURCE_CODE
+
+#include "ux_api.h"
+#include "ux_pictbridge.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_pictbridge_xml_function_root_xml PORTABLE C */
+/* 6.0 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function decodes the "xml" tag */
+/* */
+/* INPUT */
+/* */
+/* pictbridge Pictbridge instance */
+/* input_variable Pointer to variable */
+/* input_string Pointer to string */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* _ux_pictbridge_object_parse */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* */
+/**************************************************************************/
+UINT _ux_pictbridge_xml_function_root_xml(UX_PICTBRIDGE *pictbridge, UCHAR *input_variable,
+ UCHAR *input_string, UCHAR *xml_parameter)
+{
+UINT status;
+UINT input_length = 0;
+UINT length = 0;
+
+ UX_PARAMETER_NOT_USED(input_string);
+ UX_PARAMETER_NOT_USED(xml_parameter);
+ UX_PARAMETER_NOT_USED(pictbridge);
+
+ /* Get the length of the variable. */
+ status = _ux_utility_string_length_check(input_variable, &input_length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Get the length of the "version " variable. */
+ status = _ux_utility_string_length_check(_ux_pictbridge_xml_variable_version, &length, UX_PICTBRIDGE_MAX_VARIABLE_SIZE);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* If length do not match, no need to check for a match. */
+ if (length == input_length)
+ {
+
+ /* Both length match, we may have a variable name match. Check the names */
+ if (_ux_utility_memory_compare(_ux_pictbridge_xml_variable_version,input_variable, length) == UX_SUCCESS)
+ {
+
+ /* The variable name is OK, we do not check the xml version. */
+ return(UX_SUCCESS);
+
+ }
+
+ }
+ /* We get here when we reached an unexpected end of the XML object. */
+ return(UX_ERROR);
+}
+