1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** USBX Component */
17 /** */
18 /** Pictbridge Application */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23
24 /* Include necessary system files. */
25
26 #define UX_SOURCE_CODE
27
28 #include "ux_api.h"
29 #include "ux_pictbridge.h"
30 #include "ux_device_class_pima.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _ux_pictbridge_dpsclient_api_start_job PORTABLE C */
38 /* 6.1.12 */
39 /* */
40 /* AUTHOR */
41 /* */
42 /* Chaoqiong Xiao, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function creates the tag lines of the start job function */
47 /* */
48 /* INPUT */
49 /* */
50 /* pictbridge Pictbridge instance */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* Completion Status */
55 /* */
56 /* CALLS */
57 /* */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* application */
62 /* */
63 /* RELEASE HISTORY */
64 /* */
65 /* DATE NAME DESCRIPTION */
66 /* */
67 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
68 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
69 /* used UX prefix to refer to */
70 /* TX symbols instead of using */
71 /* them directly, */
72 /* resulting in version 6.1 */
73 /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
74 /* used macros for RTOS calls, */
75 /* resulting in version 6.1.12 */
76 /* */
77 /**************************************************************************/
_ux_pictbridge_dpsclient_api_start_job(UX_PICTBRIDGE * pictbridge)78 UINT _ux_pictbridge_dpsclient_api_start_job(UX_PICTBRIDGE *pictbridge)
79 {
80 UINT status;
81 ULONG actual_flags;
82
83 /* Prepare the object for capability. */
84 status = _ux_pictbridge_dpsclient_input_object_prepare(pictbridge, UX_PICTBRIDGE_OR_START_JOB, 0, 0);
85
86 /* Check status. */
87 if (status != UX_SUCCESS)
88 return(status);
89
90 /* We should wait for the host to send a script with the response. */
91 status = _ux_system_event_flags_get(&pictbridge -> ux_pictbridge_event_flags_group, UX_PICTBRIDGE_EVENT_FLAG_START_JOB,
92 UX_AND_CLEAR, &actual_flags, UX_PICTBRIDGE_EVENT_TIMEOUT);
93
94 /* Check status. */
95 if (status != UX_SUCCESS)
96 return(UX_EVENT_ERROR);
97
98 /* Ensure the flag was set. */
99 if (actual_flags & UX_PICTBRIDGE_EVENT_FLAG_START_JOB)
100
101 /* Return completion status. */
102 return(UX_SUCCESS);
103
104 else
105
106 /* Return completion status. */
107 return(UX_ERROR);
108 }
109
110