printerApi.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <boost/function.hpp>
9 #include <boost/system/error_code.hpp>
10 #include <boost/shared_ptr.hpp>
11 #include <math.h>
12 
14 
15 #include "iPrinterList.h"
16 #include "printConfig.h"
17 
23 namespace dpyPrinter {
24 
29 typedef boost::function<void(const bool &available)> service_availability_handler;
30 
35 typedef boost::function<void(boost::system::error_code error_code)> result_handler_function;
36 
42 typedef boost::function<void(boost::system::error_code, std::list<std::string> printers)> print_list_handler;
43 
49 typedef boost::function<void(boost::system::error_code, std::list<PrintConfig> printerconfigs)> printerconfig_handler_function;
50 
56 typedef boost::function<void(boost::system::error_code, PrinterInfo printerinfo)> printer_info_handler;
57 
63 typedef boost::function<void(boost::system::error_code, dpyPrinter::JobInformation jobinfo)> job_info_handler;
64 
70 typedef boost::function<void(boost::system::error_code, std::list<std::pair<int, dpyPrinter::JobInformation>> jobinfolist)> all_job_info_handler;
71 
78 typedef boost::function<void(boost::system::error_code, std::string printerid, ListEvent event)> printer_list_event_handler_function;
79 
86 typedef boost::function<void(boost::system::error_code, int jobid, JobStatus status)> job_status_event_handler_function;
87 
94 typedef boost::function<void(boost::system::error_code, std::string printerId, PaperLevel level)> paper_level_event_handler_function;
95 
102 typedef boost::function<void(boost::system::error_code, std::string printerid, PrinterEvent event, bool active)> printer_event_handler_function;
103 
110 typedef boost::function<void(boost::system::error_code, std::string printerid, PrinterStatus status)> printer_status_event_handler_function;
111 
117 typedef boost::function<void(boost::system::error_code, int jobid)> print_image_handler;
118 
124 typedef boost::function<void(boost::system::error_code, int jobid)> print_html_handler;
125 
131 typedef boost::function<void(boost::system::error_code, std::vector<dpyPrinter::NVImage> imageslist)> printerimagelist_handler_function;
132 
140 typedef boost::function<void(boost::system::error_code, std::string printerid, ListEvent event, dpyPrinter::NVImage image)> printer_imagelist_event_handler_function;
141 
142 
143 }
150 {
151 private:
152  boost::shared_ptr<PrinterClient> mClient;
153 public:
158  explicit PrinterManager(std::string ip = "127.0.0.1");
159 
163  ~PrinterManager();
164 
169  bool isAlive();
170 
171  void monitorServiceAvailability_S(dpyPrinter::service_availability_handler handler);
172  void monitorServiceAvailability_U();
173 
178  void asyncGetPrinters(dpyPrinter::print_list_handler handler);
179 
185  void asyncGetPrinterInfo(dpyPrinter::printer_info_handler handler, const std::string& printerid);
186 
194  void asyncPrintImage(dpyPrinter::print_image_handler handler, const std::string& printerid, std::string image_path, std::list<PrintConfig> configs);
195 
203  void asyncPrintHtml(dpyPrinter::print_html_handler handler, const std::string& printerid, std::string html_path, std::list<PrintConfig> configs);
204 
210  void asyncGetJobInfo(dpyPrinter::job_info_handler handler, int jobid);
211 
217  void asyncGetAllJobInfo(dpyPrinter::all_job_info_handler handler,const std::string& printerid);
218 
224  void asyncDeleteJob(dpyPrinter::result_handler_function handler, int jobid);
225 
231  void asyncForcePrinterUpgrade(dpyPrinter::result_handler_function handler, const std::string& printerid);
232 
239  void asyncSetDefaultConfiguration(dpyPrinter::result_handler_function handler, const std::string& printerid, PrintConfig printConfig);
240 
246  void asyncGetDefaultConfiguration(dpyPrinter::printerconfig_handler_function handler, const std::string& printerid);
247 
253  void asyncPrintTestTicket(dpyPrinter::result_handler_function handler, const std::string& printerid);
254 
262  void asyncStoreNVImage(dpyPrinter::result_handler_function handler, const std::string& printerid, const std::string &image_path, int slotid);
263 
270  void asyncDeleteNVImage(dpyPrinter::result_handler_function handler, const std::string& printerid, int slotid);
271 
277  void asyncGetNVImageList(dpyPrinter::printerimagelist_handler_function handler, const std::string& printerid);
278 
286  void asyncPrintNVImage(dpyPrinter::print_image_handler handler, const std::string& printerid, int slotid, std::list<PrintConfig> configs);
287 
292  void printerListEvent_S (dpyPrinter::printer_list_event_handler_function handler);
293 
298  void printerJobStatusEvent_S (dpyPrinter::job_status_event_handler_function handler);
299 
304  void printerEvent_S (dpyPrinter::printer_event_handler_function handler);
305 
310  void printerStatusEvent_S(dpyPrinter::printer_status_event_handler_function handler);
311 
316  void paperLevelEvent_S(dpyPrinter::paper_level_event_handler_function handler);
317 
322  void NVImageListEvent_S(dpyPrinter::printer_imagelist_event_handler_function handler);
323 };
boost::function< void(boost::system::error_code, std::string printerid, PrinterStatus status)> printer_status_event_handler_function
Prototype of the handler function for subscribing to printer status events.
Definition: printerApi.h:110
boost::function< void(boost::system::error_code, int jobid)> print_html_handler
Prototype of the handler function for printing from html files.
Definition: printerApi.h:124
boost::function< void(boost::system::error_code, std::vector< dpyPrinter::NVImage > imageslist)> printerimagelist_handler_function
Prototype of the handler function for getting list of images saved in non-volatile memory...
Definition: printerApi.h:131
Represents a configuration for printing.
Definition: printConfig.h:62
boost::function< void(boost::system::error_code, std::list< std::pair< int, dpyPrinter::JobInformation >> jobinfolist)> all_job_info_handler
Prototype of the handler function for getting available printers.
Definition: printerApi.h:70
boost::function< void(boost::system::error_code, int jobid)> print_image_handler
Prototype of the handler function for printing images.
Definition: printerApi.h:117
boost::function< void(boost::system::error_code, std::list< std::string > printers)> print_list_handler
Prototype of the handler function for getting available printers.
Definition: printerApi.h:42
boost::function< void(boost::system::error_code, std::string printerid, PrinterEvent event, bool active)> printer_event_handler_function
Prototype of the handler function for subscribing to printer events.
Definition: printerApi.h:102
boost::function< void(boost::system::error_code, PrinterInfo printerinfo)> printer_info_handler
Prototype of the handler function for getting available printers.
Definition: printerApi.h:56
Deepsy Printer namespace that includes the different enums, structs or method signatures that should ...
Definition: printerApi.h:13
boost::function< void(boost::system::error_code, std::string printerId, PaperLevel level)> paper_level_event_handler_function
Prototype of the handler function for subscribing to paper level events.
Definition: printerApi.h:94
boost::function< void(boost::system::error_code, std::list< PrintConfig > printerconfigs)> printerconfig_handler_function
Prototype of the handler function for getting printer configuration.
Definition: printerApi.h:49
boost::function< void(boost::system::error_code error_code)> result_handler_function
Prototype of the handler function for obtaining a result.
Definition: printerApi.h:35
boost::function< void(boost::system::error_code, std::string printerid, ListEvent event)> printer_list_event_handler_function
Prototype of the handler function for subscribing to list events.
Definition: printerApi.h:78
boost::function< void(boost::system::error_code, dpyPrinter::JobInformation jobinfo)> job_info_handler
Prototype of the handler function for getting available printers.
Definition: printerApi.h:63
Class with the logic of the client.
Definition: printerClient.h:16
Allows to interact with Printer Service.
Definition: printerApi.h:149
boost::function< void(boost::system::error_code, std::string printerid, ListEvent event, dpyPrinter::NVImage image)> printer_imagelist_event_handler_function
Prototype of the handler function for subscribing to non-volatile memory images events.
Definition: printerApi.h:140
boost::function< void(boost::system::error_code, int jobid, JobStatus status)> job_status_event_handler_function
Prototype of the handler function for subscribing to job status events.
Definition: printerApi.h:86
boost::function< void(const bool &available)> service_availability_handler
Prototype of the handler function used to monitor service availability.
Definition: printerApi.h:29