1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  * Copyright (C) 2016 Mopria Alliance, Inc.
4  * Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #ifndef __IFC_STATUS_MONITOR_H__
19 #define __IFC_STATUS_MONITOR_H__
20 
21 #include "wprint_status_types.h"
22 
23 /*
24  * Interface for monitoring printer status as a job is processed
25  */
26 typedef struct ifc_status_monitor_st {
27     /*
28      * Initializes a printer status monitor with connections params
29      */
30     void (*init)(const struct ifc_status_monitor_st *this_p,
31             const wprint_connect_info_t *);
32 
33     /*
34      * Gets status from a printer
35      */
36     void (*get_status)(const struct ifc_status_monitor_st *this_p,
37             printer_state_dyn_t *printer_state_dyn);
38 
39     /*
40      * Cancels the job
41      */
42     status_t (*cancel)(const struct ifc_status_monitor_st *this_p, const char *requesting_user);
43 
44     /*
45      * Starts monitoring printer status; accepts a callback for handling status updates
46      */
47     void (*start)(const struct ifc_status_monitor_st *this_p,
48             void (*status_callback)(const printer_state_dyn_t *new_status,
49                     const printer_state_dyn_t *old_status, void *param),
50             void *param);
51 
52     /*
53      * Stops monitoring printer status
54      */
55     void (*stop)(const struct ifc_status_monitor_st *this_p);
56 
57     /*
58      * Destroy printer status monitor
59      */
60     void (*destroy)(const struct ifc_status_monitor_st *this_p);
61 } ifc_status_monitor_t;
62 
63 #endif // __IFC_STATUS_MONITOR_H__