Skip to main content

ohos_basic_services_kit_sys/print/
print_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6
7#[cfg(feature = "api-12")]
8#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
9impl Print_ErrorCode {
10    /// The operation is successful.
11    pub const PRINT_ERROR_NONE: Print_ErrorCode = Print_ErrorCode(0);
12    /// Permission verification failed.
13    pub const PRINT_ERROR_NO_PERMISSION: Print_ErrorCode = Print_ErrorCode(201);
14    /// Invalid parameter.
15    pub const PRINT_ERROR_INVALID_PARAMETER: Print_ErrorCode = Print_ErrorCode(401);
16    /// General internal error.
17    pub const PRINT_ERROR_GENERIC_FAILURE: Print_ErrorCode = Print_ErrorCode(24300001);
18    /// RPC communication error.
19    pub const PRINT_ERROR_RPC_FAILURE: Print_ErrorCode = Print_ErrorCode(24300002);
20    /// Server error.
21    pub const PRINT_ERROR_SERVER_FAILURE: Print_ErrorCode = Print_ErrorCode(24300003);
22    /// Invalid extension.
23    pub const PRINT_ERROR_INVALID_EXTENSION: Print_ErrorCode = Print_ErrorCode(24300004);
24    /// Invalid printer.
25    pub const PRINT_ERROR_INVALID_PRINTER: Print_ErrorCode = Print_ErrorCode(24300005);
26    /// Invalid print job.
27    pub const PRINT_ERROR_INVALID_PRINT_JOB: Print_ErrorCode = Print_ErrorCode(24300006);
28    /// Failed to read or write files.
29    pub const PRINT_ERROR_FILE_IO: Print_ErrorCode = Print_ErrorCode(24300007);
30    /// Unknown error.
31    pub const PRINT_ERROR_UNKNOWN: Print_ErrorCode = Print_ErrorCode(24300255);
32}
33#[repr(transparent)]
34/// Defines error codes.
35///
36///
37/// Available since API-level: 12
38///
39/// Version: 1.0
40#[cfg(feature = "api-12")]
41#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
42#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
43pub struct Print_ErrorCode(pub ::core::ffi::c_uint);
44#[cfg(feature = "api-12")]
45#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
46impl Print_PrinterState {
47    /// Printer idle.
48    pub const PRINTER_IDLE: Print_PrinterState = Print_PrinterState(0);
49    /// Printer busy.
50    pub const PRINTER_BUSY: Print_PrinterState = Print_PrinterState(1);
51    /// Printer not available.
52    pub const PRINTER_UNAVAILABLE: Print_PrinterState = Print_PrinterState(2);
53}
54#[repr(transparent)]
55/// Indicates printer states.
56///
57///
58/// Available since API-level: 12
59#[cfg(feature = "api-12")]
60#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
61#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
62pub struct Print_PrinterState(pub ::core::ffi::c_uint);
63#[cfg(feature = "api-12")]
64#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
65impl Print_DiscoveryEvent {
66    /// Printer discovered.
67    pub const PRINTER_DISCOVERED: Print_DiscoveryEvent = Print_DiscoveryEvent(0);
68    /// Printer lost.
69    pub const PRINTER_LOST: Print_DiscoveryEvent = Print_DiscoveryEvent(1);
70    /// Printer connecting.
71    pub const PRINTER_CONNECTING: Print_DiscoveryEvent = Print_DiscoveryEvent(2);
72    /// Printer connected.
73    pub const PRINTER_CONNECTED: Print_DiscoveryEvent = Print_DiscoveryEvent(3);
74}
75#[repr(transparent)]
76/// Indicate printer discovery events.
77///
78///
79/// Available since API-level: 12
80#[cfg(feature = "api-12")]
81#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
82#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
83pub struct Print_DiscoveryEvent(pub ::core::ffi::c_uint);
84#[cfg(feature = "api-12")]
85#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
86impl Print_PrinterEvent {
87    /// Printer added.
88    pub const PRINTER_ADDED: Print_PrinterEvent = Print_PrinterEvent(0);
89    /// Printer deleted.
90    pub const PRINTER_DELETED: Print_PrinterEvent = Print_PrinterEvent(1);
91    /// Printer state changed.
92    pub const PRINTER_STATE_CHANGED: Print_PrinterEvent = Print_PrinterEvent(2);
93    /// Printer info changed.
94    pub const PRINTER_INFO_CHANGED: Print_PrinterEvent = Print_PrinterEvent(3);
95}
96#[repr(transparent)]
97/// Indicate printer change events.
98///
99///
100/// Available since API-level: 12
101#[cfg(feature = "api-12")]
102#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
103#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
104pub struct Print_PrinterEvent(pub ::core::ffi::c_uint);
105/// Indicates string list.
106///
107///
108/// Available since API-level: 12
109#[cfg(feature = "api-12")]
110#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
111#[repr(C)]
112#[derive(Debug, Copy, Clone)]
113pub struct Print_StringList {
114    /// Number of string.
115    pub count: u32,
116    /// String pointer array.
117    pub list: *mut *mut ::core::ffi::c_char,
118}
119/// Indicates printer property.
120///
121///
122/// Available since API-level: 12
123#[cfg(feature = "api-12")]
124#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
125#[repr(C)]
126#[derive(Debug, Copy, Clone)]
127pub struct Print_Property {
128    /// Property keyword.
129    pub key: *mut ::core::ffi::c_char,
130    /// Property value.
131    pub value: *mut ::core::ffi::c_char,
132}
133/// List of printer properties.
134///
135///
136/// Available since API-level: 12
137#[cfg(feature = "api-12")]
138#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
139#[repr(C)]
140#[derive(Debug, Copy, Clone)]
141pub struct Print_PropertyList {
142    /// Number of properties.
143    pub count: u32,
144    /// Property pointer array.
145    pub list: *mut Print_Property,
146}
147/// Indicates print resolution in dpi unit.
148///
149///
150/// Available since API-level: 12
151#[cfg(feature = "api-12")]
152#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
153#[repr(C)]
154#[derive(Debug, Copy, Clone)]
155pub struct Print_Resolution {
156    pub horizontalDpi: u32,
157    pub verticalDpi: u32,
158}
159/// Indicates printing margin
160///
161///
162/// Available since API-level: 12
163#[cfg(feature = "api-12")]
164#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
165#[repr(C)]
166#[derive(Debug, Copy, Clone)]
167pub struct Print_Margin {
168    /// Left margin.
169    pub leftMargin: u32,
170    /// Top margin.
171    pub topMargin: u32,
172    /// Right margin.
173    pub rightMargin: u32,
174    /// Bottom margin.
175    pub bottomMargin: u32,
176}
177/// Indicates paper size info.
178///
179///
180/// Available since API-level: 12
181#[cfg(feature = "api-12")]
182#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
183#[repr(C)]
184#[derive(Debug, Copy, Clone)]
185pub struct Print_PageSize {
186    /// Paper id.
187    pub id: *mut ::core::ffi::c_char,
188    /// Paper name.
189    pub name: *mut ::core::ffi::c_char,
190    /// Paper width.
191    pub width: u32,
192    /// Paper height.
193    pub height: u32,
194}
195#[cfg(feature = "api-12")]
196#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
197impl Print_DuplexMode {
198    /// One sided duplex mode.
199    pub const DUPLEX_MODE_ONE_SIDED: Print_DuplexMode = Print_DuplexMode(0);
200    /// Long edge two sided duplex mode.
201    pub const DUPLEX_MODE_TWO_SIDED_LONG_EDGE: Print_DuplexMode = Print_DuplexMode(1);
202    /// Short edge two sided duplex mode.
203    pub const DUPLEX_MODE_TWO_SIDED_SHORT_EDGE: Print_DuplexMode = Print_DuplexMode(2);
204}
205#[repr(transparent)]
206/// Indicates DuplexMode
207///
208///
209/// Available since API-level: 12
210#[cfg(feature = "api-12")]
211#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
212#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
213pub struct Print_DuplexMode(pub ::core::ffi::c_uint);
214#[cfg(feature = "api-12")]
215#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
216impl Print_ColorMode {
217    /// Monochrome mode.
218    pub const COLOR_MODE_MONOCHROME: Print_ColorMode = Print_ColorMode(0);
219    /// Color mode.
220    pub const COLOR_MODE_COLOR: Print_ColorMode = Print_ColorMode(1);
221    /// Auto mode.
222    pub const COLOR_MODE_AUTO: Print_ColorMode = Print_ColorMode(2);
223}
224#[repr(transparent)]
225/// Indicates ColorMode
226///
227///
228/// Available since API-level: 12
229#[cfg(feature = "api-12")]
230#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
231#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
232pub struct Print_ColorMode(pub ::core::ffi::c_uint);
233#[cfg(feature = "api-12")]
234#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
235impl Print_OrientationMode {
236    /// Portrait mode.
237    pub const ORIENTATION_MODE_PORTRAIT: Print_OrientationMode = Print_OrientationMode(0);
238    /// Landscape mode.
239    pub const ORIENTATION_MODE_LANDSCAPE: Print_OrientationMode = Print_OrientationMode(1);
240    /// Reverse landscape mode.
241    pub const ORIENTATION_MODE_REVERSE_LANDSCAPE: Print_OrientationMode = Print_OrientationMode(2);
242    /// Reverse portrait mode.
243    pub const ORIENTATION_MODE_REVERSE_PORTRAIT: Print_OrientationMode = Print_OrientationMode(3);
244    /// Not specified.
245    pub const ORIENTATION_MODE_NONE: Print_OrientationMode = Print_OrientationMode(4);
246}
247#[repr(transparent)]
248/// Indicates OrientationMode
249///
250///
251/// Available since API-level: 12
252#[cfg(feature = "api-12")]
253#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
254#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
255pub struct Print_OrientationMode(pub ::core::ffi::c_uint);
256#[cfg(feature = "api-12")]
257#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
258impl Print_Quality {
259    /// Draft quality mode
260    pub const PRINT_QUALITY_DRAFT: Print_Quality = Print_Quality(3);
261    /// Normal quality mode
262    pub const PRINT_QUALITY_NORMAL: Print_Quality = Print_Quality(4);
263    /// High quality mode
264    pub const PRINT_QUALITY_HIGH: Print_Quality = Print_Quality(5);
265}
266#[repr(transparent)]
267/// Indicates printing qulity
268///
269///
270/// Available since API-level: 12
271#[cfg(feature = "api-12")]
272#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
273#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
274pub struct Print_Quality(pub ::core::ffi::c_uint);
275#[cfg(feature = "api-12")]
276#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
277impl Print_DocumentFormat {
278    /// MIME: application/octet-stream.
279    pub const DOCUMENT_FORMAT_AUTO: Print_DocumentFormat = Print_DocumentFormat(0);
280    /// MIME: image/jpeg.
281    pub const DOCUMENT_FORMAT_JPEG: Print_DocumentFormat = Print_DocumentFormat(1);
282    /// MIME: application/pdf.
283    pub const DOCUMENT_FORMAT_PDF: Print_DocumentFormat = Print_DocumentFormat(2);
284    /// MIME: application/postscript.
285    pub const DOCUMENT_FORMAT_POSTSCRIPT: Print_DocumentFormat = Print_DocumentFormat(3);
286    /// MIME: text/plain.
287    pub const DOCUMENT_FORMAT_TEXT: Print_DocumentFormat = Print_DocumentFormat(4);
288}
289#[repr(transparent)]
290/// Indicates the MIME media type of the document.
291///
292///
293/// Available since API-level: 12
294#[cfg(feature = "api-12")]
295#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
296#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
297pub struct Print_DocumentFormat(pub ::core::ffi::c_uint);
298#[cfg(feature = "api-13")]
299#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
300impl Print_JobDocAdapterState {
301    /// Print job preview ability destroy.
302    pub const PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY: Print_JobDocAdapterState =
303        Print_JobDocAdapterState(0);
304    /// Print job task succeed.
305    pub const PRINT_DOC_ADAPTER_PRINT_TASK_SUCCEED: Print_JobDocAdapterState =
306        Print_JobDocAdapterState(1);
307    /// Print job task failed.
308    pub const PRINT_DOC_ADAPTER_PRINT_TASK_FAIL: Print_JobDocAdapterState =
309        Print_JobDocAdapterState(2);
310    /// Print job task cancel.
311    pub const PRINT_DOC_ADAPTER_PRINT_TASK_CANCEL: Print_JobDocAdapterState =
312        Print_JobDocAdapterState(3);
313    /// Print job task block.
314    pub const PRINT_DOC_ADAPTER_PRINT_TASK_BLOCK: Print_JobDocAdapterState =
315        Print_JobDocAdapterState(4);
316    /// Print job task preview ability destroy for cancel.
317    pub const PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY_FOR_CANCELED: Print_JobDocAdapterState =
318        Print_JobDocAdapterState(5);
319    /// Print job task preview ability destroy for started.
320    pub const PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY_FOR_STARTED: Print_JobDocAdapterState =
321        Print_JobDocAdapterState(6);
322}
323#[repr(transparent)]
324/// Indicates the print job doc adapter state.
325///
326///
327/// Available since API-level: 13
328#[cfg(feature = "api-13")]
329#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
330#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
331pub struct Print_JobDocAdapterState(pub ::core::ffi::c_uint);
332/// Indicates printer capabilities.
333///
334///
335/// Available since API-level: 12
336#[cfg(feature = "api-12")]
337#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
338#[repr(C)]
339#[derive(Debug, Copy, Clone)]
340pub struct Print_PrinterCapability {
341    /// Array of supported color mode.
342    pub supportedColorModes: *mut Print_ColorMode,
343    /// Number of supported color mode.
344    pub supportedColorModesCount: u32,
345    /// Array of supported duplex printing modes.
346    pub supportedDuplexModes: *mut Print_DuplexMode,
347    /// Number of supported duplex printing mode.
348    pub supportedDuplexModesCount: u32,
349    /// Array of supported print paper sizes.
350    pub supportedPageSizes: *mut Print_PageSize,
351    /// Number of supported print paper sizes.
352    pub supportedPageSizesCount: u32,
353    /// Supported print media types in json string array format.
354    pub supportedMediaTypes: *mut ::core::ffi::c_char,
355    /// Array of supported print qulities.
356    pub supportedQualities: *mut Print_Quality,
357    /// Number of supported print qulities.
358    pub supportedQualitiesCount: u32,
359    /// Supported paper sources in json string array format.
360    pub supportedPaperSources: *mut ::core::ffi::c_char,
361    /// Supported copies.
362    pub supportedCopies: u32,
363    /// Array of supported printer resolutions.
364    pub supportedResolutions: *mut Print_Resolution,
365    /// Number of supported printer resolutions.
366    pub supportedResolutionsCount: u32,
367    /// Array of supported orientation.
368    pub supportedOrientations: *mut Print_OrientationMode,
369    /// Number of supported orientation.
370    pub supportedOrientationsCount: u32,
371    /// Advanced capability in json format.
372    pub advancedCapability: *mut ::core::ffi::c_char,
373}
374/// Indicates current properties
375///
376///
377/// Available since API-level: 12
378#[cfg(feature = "api-12")]
379#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
380#[repr(C)]
381#[derive(Debug, Copy, Clone)]
382pub struct Print_DefaultValue {
383    /// Default color mode.
384    pub defaultColorMode: Print_ColorMode,
385    /// Default duplex mode.
386    pub defaultDuplexMode: Print_DuplexMode,
387    /// Default media type.
388    pub defaultMediaType: *mut ::core::ffi::c_char,
389    /// Default page size id.
390    pub defaultPageSizeId: *mut ::core::ffi::c_char,
391    /// Default margin.
392    pub defaultMargin: Print_Margin,
393    /// Default paper source.
394    pub defaultPaperSource: *mut ::core::ffi::c_char,
395    /// Default print quality
396    pub defaultPrintQuality: Print_Quality,
397    /// Default copies.
398    pub defaultCopies: u32,
399    /// Default printer resolution.
400    pub defaultResolution: Print_Resolution,
401    /// Default orientation.
402    pub defaultOrientation: Print_OrientationMode,
403    /// Other default values in json format.
404    pub otherDefaultValues: *mut ::core::ffi::c_char,
405}
406/// Indicates printer information.
407///
408///
409/// Available since API-level: 12
410#[cfg(feature = "api-12")]
411#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
412#[repr(C)]
413#[derive(Debug, Copy, Clone)]
414pub struct Print_PrinterInfo {
415    /// Printer state.
416    pub printerState: Print_PrinterState,
417    /// Printer capabilities.
418    pub capability: Print_PrinterCapability,
419    /// Printer current properties.
420    pub defaultValue: Print_DefaultValue,
421    /// Default printer.
422    pub isDefaultPrinter: bool,
423    /// Printer id.
424    pub printerId: *mut ::core::ffi::c_char,
425    /// Printer name.
426    pub printerName: *mut ::core::ffi::c_char,
427    /// Printer description.
428    pub description: *mut ::core::ffi::c_char,
429    /// Printer location.
430    pub location: *mut ::core::ffi::c_char,
431    /// Printer make and model information.
432    pub makeAndModel: *mut ::core::ffi::c_char,
433    /// Printer Uri.
434    pub printerUri: *mut ::core::ffi::c_char,
435    /// Detail information in json format.
436    pub detailInfo: *mut ::core::ffi::c_char,
437}
438/// Indicates PrintJob Structure.
439///
440///
441/// Available since API-level: 12
442#[cfg(feature = "api-12")]
443#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
444#[repr(C)]
445#[derive(Debug, Copy, Clone)]
446pub struct Print_PrintJob {
447    /// Job name.
448    pub jobName: *mut ::core::ffi::c_char,
449    /// Array of file descriptors to print.
450    pub fdList: *mut u32,
451    /// Number of file descriptors to print.
452    pub fdListCount: u32,
453    /// Printer id.
454    pub printerId: *mut ::core::ffi::c_char,
455    /// Number of copies printed.
456    pub copyNumber: u32,
457    /// Paper source.
458    pub paperSource: *mut ::core::ffi::c_char,
459    /// Media type.
460    pub mediaType: *mut ::core::ffi::c_char,
461    /// Paper size id.
462    pub pageSizeId: *mut ::core::ffi::c_char,
463    /// Color mode.
464    pub colorMode: Print_ColorMode,
465    /// Duplex source.
466    pub duplexMode: Print_DuplexMode,
467    /// Print resolution in dpi.
468    pub resolution: Print_Resolution,
469    /// Print margin.
470    pub printMargin: Print_Margin,
471    /// Borderless.
472    pub borderless: bool,
473    /// Orientation mode.
474    pub orientationMode: Print_OrientationMode,
475    /// Print quality.
476    pub printQuality: Print_Quality,
477    /// Document format.
478    pub documentFormat: Print_DocumentFormat,
479    /// Advanced options in json format.
480    pub advancedOptions: *mut ::core::ffi::c_char,
481}
482/// Indicates print range structure.
483///
484///
485/// Available since API-level: 13
486#[cfg(feature = "api-13")]
487#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
488#[repr(C)]
489#[derive(Debug, Copy, Clone)]
490pub struct Print_Range {
491    /// Print start page.
492    pub startPage: u32,
493    /// Print end page.
494    pub endPage: u32,
495    /// Print page array length.
496    pub pagesArrayLen: u32,
497    /// Print page array.
498    pub pagesArray: *mut u32,
499}
500/// Indicates print attributes structure.
501///
502///
503/// Available since API-level: 13
504#[cfg(feature = "api-13")]
505#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
506#[repr(C)]
507#[derive(Debug, Copy, Clone)]
508pub struct Print_PrintAttributes {
509    /// Print ranges.
510    pub pageRange: Print_Range,
511    /// Print page size.
512    pub pageSize: Print_PageSize,
513    /// Print margin.
514    pub pageMargin: Print_Margin,
515    /// Copy numbers.
516    pub copyNumber: u32,
517    /// Duplex mode.
518    pub duplexMode: u32,
519    /// color mode.
520    pub colorMode: u32,
521    /// Print sequential.
522    pub isSequential: bool,
523    /// Print orient.
524    pub isLandscape: bool,
525    /// Print option flag.
526    pub hasOption: bool,
527    /// Print options.
528    pub options: [::core::ffi::c_char; 256usize],
529}
530/// Write files result callback.
531///
532/// # Arguments
533///
534/// * `jobId` - The print job id of one print task.
535///
536/// * `code` - The result of write files.
537///
538/// Available since API-level: 13
539#[cfg(feature = "api-13")]
540#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
541pub type Print_WriteResultCallback =
542    ::core::option::Option<unsafe extern "C" fn(jobId: *const ::core::ffi::c_char, code: u32)>;
543/// Print start layout callback.
544///
545/// # Arguments
546///
547/// * `jobId` - The print job id of one print task.
548///
549/// * `fd` - The file descriptor to be written.
550///
551/// * `oldAttrs` - The attribute of last.
552///
553/// * `newAttrs` - The attribute of current.
554///
555/// * `writeCallback` - The Write files result callback.
556///
557/// Available since API-level: 13
558#[cfg(feature = "api-13")]
559#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
560pub type Print_OnStartLayoutWrite = ::core::option::Option<
561    unsafe extern "C" fn(
562        jobId: *const ::core::ffi::c_char,
563        fd: u32,
564        oldAttrs: *const Print_PrintAttributes,
565        newAttrs: *const Print_PrintAttributes,
566        writeCallback: Print_WriteResultCallback,
567    ),
568>;
569/// Print job state callback.
570///
571/// # Arguments
572///
573/// * `jobId` - The print job id of one print task.
574///
575/// * `state` - The state of current print job.
576///
577/// Available since API-level: 13
578#[cfg(feature = "api-13")]
579#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
580pub type Print_OnJobStateChanged =
581    ::core::option::Option<unsafe extern "C" fn(jobId: *const ::core::ffi::c_char, state: u32)>;
582/// Indicates print doc state callback structure.
583///
584///
585/// Available since API-level: 13
586#[cfg(feature = "api-13")]
587#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
588#[repr(C)]
589#[derive(Debug, Copy, Clone)]
590pub struct Print_PrintDocCallback {
591    /// Print start layout callback.
592    pub startLayoutWriteCb: Print_OnStartLayoutWrite,
593    /// Print job state callback.
594    pub jobStateChangedCb: Print_OnJobStateChanged,
595}
596/// Printer discovery callback.
597///
598/// # Arguments
599///
600/// * `event` - The printer discovery event during printer discovery.
601///
602/// * `printerInfo` - The printer infomation at the time of the discovery event.
603///
604/// Available since API-level: 12
605#[cfg(feature = "api-12")]
606#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
607pub type Print_PrinterDiscoveryCallback = ::core::option::Option<
608    unsafe extern "C" fn(event: Print_DiscoveryEvent, printerInfo: *const Print_PrinterInfo),
609>;
610/// Printer change callback.
611///
612/// # Arguments
613///
614/// * `event` - The printer change event while the printer service is running.
615///
616/// * `printerInfo` - The printer infomation at the time of the change event.
617///
618/// Available since API-level: 12
619#[cfg(feature = "api-12")]
620#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
621pub type Print_PrinterChangeCallback = ::core::option::Option<
622    unsafe extern "C" fn(event: Print_PrinterEvent, printerInfo: *const Print_PrinterInfo),
623>;
624extern "C" {
625    /// This API checks and pulls up the print service, initializes the print client,
626    /// and establishes a connection to the print service.
627    ///
628    /// `ohos.permission.PRINT`
629    ///
630    /// # Returns
631    ///
632    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
633    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
634    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service.
635    /// [`PRINT_ERROR_SERVER_FAILURE`] The cups service cannot be started.
636    ///
637    /// Required System Capabilities: SystemCapability.Print.PrintFramework
638    ///
639    /// Available since API-level: 12
640    #[cfg(feature = "api-12")]
641    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
642    pub fn OH_Print_Init() -> Print_ErrorCode;
643    /// This API closes the connection from the print service, dissolves the previous callback,
644    /// and releases the print client resources.
645    ///
646    ///
647    /// # Returns
648    ///
649    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
650    /// Currently no other error codes will be returned.
651    ///
652    /// Required System Capabilities: SystemCapability.Print.PrintFramework
653    ///
654    /// Available since API-level: 12
655    #[cfg(feature = "api-12")]
656    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
657    pub fn OH_Print_Release() -> Print_ErrorCode;
658    /// This API starts discovering printers.
659    ///
660    /// `ohos.permission.PRINT`
661    /// # Arguments
662    ///
663    /// * `callback` - The [`Print_PrinterDiscoveryCallback`] of printer discovery event.
664    ///
665    /// # Returns
666    ///
667    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
668    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
669    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service ability.
670    /// [`PRINT_ERROR_SERVER_FAILURE`] Failed to query print extension list from BMS.
671    /// [`PRINT_ERROR_INVALID_EXTENSION`] No available print extensions found.
672    ///
673    /// Required System Capabilities: SystemCapability.Print.PrintFramework
674    ///
675    /// Available since API-level: 12
676    #[cfg(feature = "api-12")]
677    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
678    pub fn OH_Print_StartPrinterDiscovery(
679        callback: Print_PrinterDiscoveryCallback,
680    ) -> Print_ErrorCode;
681    /// This API stops discovering printers.
682    ///
683    /// `ohos.permission.PRINT`
684    ///
685    /// # Returns
686    ///
687    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
688    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
689    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service.
690    ///
691    /// Required System Capabilities: SystemCapability.Print.PrintFramework
692    ///
693    /// Available since API-level: 12
694    #[cfg(feature = "api-12")]
695    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
696    pub fn OH_Print_StopPrinterDiscovery() -> Print_ErrorCode;
697    /// This API connects to the printer using the printer id.
698    ///
699    /// `ohos.permission.PRINT`
700    /// # Arguments
701    ///
702    /// * `printerId` - The id of the printer to be connected.
703    ///
704    /// # Returns
705    ///
706    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
707    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
708    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service.
709    /// [`PRINT_ERROR_INVALID_PRINTER`] The printer should be in the list of discovered printers.
710    /// [`PRINT_ERROR_SERVER_FAILURE`] Unable to find an extension responsible for the printer.
711    ///
712    /// Required System Capabilities: SystemCapability.Print.PrintFramework
713    ///
714    /// Available since API-level: 12
715    #[cfg(feature = "api-12")]
716    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
717    pub fn OH_Print_ConnectPrinter(printerId: *const ::core::ffi::c_char) -> Print_ErrorCode;
718    /// This API starts initiating a print job.
719    ///
720    /// `ohos.permission.PRINT`
721    /// # Arguments
722    ///
723    /// * `printJob` - A pointer to a [`Print_PrintJob`] instance that specifies the information for the print job.
724    ///
725    /// # Returns
726    ///
727    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
728    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
729    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service.
730    /// [`PRINT_ERROR_INVALID_PRINTER`] The printer should be in the list of connected printers.
731    /// [`PRINT_ERROR_SERVER_FAILURE`] Unable to create print job in the print service.
732    /// [`PRINT_ERROR_INVALID_PRINT_JOB`] Unable to find the job int the job queue.
733    ///
734    /// Required System Capabilities: SystemCapability.Print.PrintFramework
735    ///
736    /// Available since API-level: 12
737    #[cfg(feature = "api-12")]
738    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
739    pub fn OH_Print_StartPrintJob(printJob: *const Print_PrintJob) -> Print_ErrorCode;
740    /// This API registers the callback for printer changes.
741    ///
742    /// `ohos.permission.PRINT`
743    /// # Arguments
744    ///
745    /// * `callback` - The [`Print_PrinterChangeCallback`] to be registered.
746    ///
747    /// # Returns
748    ///
749    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
750    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
751    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service ability.
752    ///
753    /// Required System Capabilities: SystemCapability.Print.PrintFramework
754    ///
755    /// Available since API-level: 12
756    #[cfg(feature = "api-12")]
757    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
758    pub fn OH_Print_RegisterPrinterChangeListener(
759        callback: Print_PrinterChangeCallback,
760    ) -> Print_ErrorCode;
761    /// This API unregisters the callback for printer changes.
762    ///
763    /// `ohos.permission.PRINT`
764    ///
765    /// Required System Capabilities: SystemCapability.Print.PrintFramework
766    ///
767    /// Available since API-level: 12
768    #[cfg(feature = "api-12")]
769    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
770    pub fn OH_Print_UnregisterPrinterChangeListener();
771    /// This API queries for a list of added printers.
772    ///
773    /// `ohos.permission.PRINT`
774    /// # Arguments
775    ///
776    /// * `printerIdList` - A pointer to a [`Print_StringList`] instance to store the queried printer id list.
777    ///
778    /// # Returns
779    ///
780    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
781    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
782    /// [`PRINT_ERROR_INVALID_PARAMETER`] printerIdList is NULL.
783    /// [`PRINT_ERROR_INVALID_PRINTER`] Unable to query any connected printers.
784    /// [`PRINT_ERROR_GENERIC_FAILURE`] Unable to copy the printer id list.
785    ///
786    /// Required System Capabilities: SystemCapability.Print.PrintFramework
787    ///
788    /// Available since API-level: 12
789    #[cfg(feature = "api-12")]
790    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
791    pub fn OH_Print_QueryPrinterList(printerIdList: *mut Print_StringList) -> Print_ErrorCode;
792    /// This API frees up the printer list memory for the query.
793    ///
794    /// # Arguments
795    ///
796    /// * `printerIdList` - The queried printer id list to be released.
797    ///
798    /// Required System Capabilities: SystemCapability.Print.PrintFramework
799    ///
800    /// Available since API-level: 12
801    #[cfg(feature = "api-12")]
802    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
803    pub fn OH_Print_ReleasePrinterList(printerIdList: *mut Print_StringList);
804    /// This API queries printer information based on the printer id.
805    ///
806    /// `ohos.permission.PRINT`
807    /// # Arguments
808    ///
809    /// * `printerId` - The id of the printer to be queried.
810    ///
811    /// * `printerInfo` - A pointer to a [`Print_PrinterInfo`] pointer to store the printer infomation.
812    ///
813    /// # Returns
814    ///
815    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
816    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
817    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service.
818    /// [`PRINT_ERROR_INVALID_PARAMETER`] printerId is NULL or printerInfo is NULL.
819    /// [`PRINT_ERROR_INVALID_PRINTER`] Unable to find the printer in the connected printer list.
820    ///
821    /// Required System Capabilities: SystemCapability.Print.PrintFramework
822    ///
823    /// Available since API-level: 12
824    #[cfg(feature = "api-12")]
825    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
826    pub fn OH_Print_QueryPrinterInfo(
827        printerId: *const ::core::ffi::c_char,
828        printerInfo: *mut *mut Print_PrinterInfo,
829    ) -> Print_ErrorCode;
830    /// This API frees up the printer infomation memory for the query.
831    ///
832    /// # Arguments
833    ///
834    /// * `printerInfo` - The pointer of the queried printer infomation to be released.
835    ///
836    /// Required System Capabilities: SystemCapability.Print.PrintFramework
837    ///
838    /// Available since API-level: 12
839    #[cfg(feature = "api-12")]
840    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
841    pub fn OH_Print_ReleasePrinterInfo(printerInfo: *mut Print_PrinterInfo);
842    /// This API launches the system's printer management window.
843    ///
844    ///
845    /// # Returns
846    ///
847    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
848    /// [`PRINT_ERROR_GENERIC_FAILURE`] Unable to launch the printer manager window.
849    ///
850    /// Required System Capabilities: SystemCapability.Print.PrintFramework
851    ///
852    /// Available since API-level: 12
853    #[cfg(feature = "api-12")]
854    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
855    pub fn OH_Print_LaunchPrinterManager() -> Print_ErrorCode;
856    /// This API queries the corresponding printer property values based on the list of property keywords.
857    ///
858    /// `ohos.permission.PRINT`
859    /// # Arguments
860    ///
861    /// * `printerId` - The id of the printer to be queried.
862    ///
863    /// * `propertyKeyList` - The list of property keywords to be queried
864    ///
865    /// * `propertyList` - The list of printer property values queried.
866    ///
867    /// # Returns
868    ///
869    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
870    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
871    /// [`PRINT_ERROR_INVALID_PARAMETER`] One of the params is NULL or the keyword list is empty.
872    /// [`PRINT_ERROR_INVALID_PRINTER`] The printer properties for the specified printer could not be found.
873    /// [`PRINT_ERROR_GENERIC_FAILURE`] Unable to copy the printer properties.
874    ///
875    /// Required System Capabilities: SystemCapability.Print.PrintFramework
876    ///
877    /// Available since API-level: 12
878    #[cfg(feature = "api-12")]
879    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
880    pub fn OH_Print_QueryPrinterProperties(
881        printerId: *const ::core::ffi::c_char,
882        propertyKeyList: *const Print_StringList,
883        propertyList: *mut Print_PropertyList,
884    ) -> Print_ErrorCode;
885    /// This API frees up the property list memory for the query.
886    ///
887    /// # Arguments
888    ///
889    /// * `propertyList` - The pointer of the queried printer property values to be released.
890    ///
891    /// Required System Capabilities: SystemCapability.Print.PrintFramework
892    ///
893    /// Available since API-level: 12
894    #[cfg(feature = "api-12")]
895    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
896    pub fn OH_Print_ReleasePrinterProperties(propertyList: *mut Print_PropertyList);
897    /// This API sets printer properties based on a list of property key-value pairs.
898    ///
899    /// `ohos.permission.PRINT`
900    /// # Arguments
901    ///
902    /// * `printerId` - The id of the printer to be set.
903    ///
904    /// * `propertyList` - The list of printer property values to be set.
905    ///
906    /// # Returns
907    ///
908    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
909    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
910    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service.
911    ///
912    /// Required System Capabilities: SystemCapability.Print.PrintFramework
913    ///
914    /// Available since API-level: 12
915    #[cfg(feature = "api-12")]
916    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
917    pub fn OH_Print_UpdatePrinterProperties(
918        printerId: *const ::core::ffi::c_char,
919        propertyList: *const Print_PropertyList,
920    ) -> Print_ErrorCode;
921    /// This API restores printer properties to default settings based on the list of property keywords.
922    ///
923    /// `ohos.permission.PRINT`
924    /// # Arguments
925    ///
926    /// * `printerId` - The id of the printer to be restored.
927    ///
928    /// * `propertyKeyList` - The list of property keywords to be restored.
929    ///
930    /// # Returns
931    ///
932    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
933    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
934    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service.
935    ///
936    /// Required System Capabilities: SystemCapability.Print.PrintFramework
937    ///
938    /// Available since API-level: 12
939    #[cfg(feature = "api-12")]
940    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
941    pub fn OH_Print_RestorePrinterProperties(
942        printerId: *const ::core::ffi::c_char,
943        propertyKeyList: *const Print_StringList,
944    ) -> Print_ErrorCode;
945    /// This API provide capacity to start print dialog.
946    ///
947    /// `ohos.permission.PRINT`
948    /// # Arguments
949    ///
950    /// * `printJobName` - The name of this print job.
951    ///
952    /// * `printDocCallback` - The print doc state callback.
953    ///
954    /// * `context` - The context of caller app.
955    ///
956    /// # Returns
957    ///
958    /// * Returns [`Print_ErrorCode#PRINT_ERROR_NONE`] if the execution is successful.
959    /// [`PRINT_ERROR_NO_PERMISSION`] The permission `ohos.permission.PRINT` is needed.
960    /// [`PRINT_ERROR_RPC_FAILURE`] Unable to connect to the print service.
961    ///
962    /// Required System Capabilities: SystemCapability.Print.PrintFramework
963    ///
964    /// Available since API-level: 13
965    #[cfg(feature = "api-13")]
966    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
967    pub fn OH_Print_StartPrintByNative(
968        printJobName: *const ::core::ffi::c_char,
969        printDocCallback: Print_PrintDocCallback,
970        context: *mut ::core::ffi::c_void,
971    ) -> Print_ErrorCode;
972}