From 2681af141bb32f8a7a2790c240baa3a8b22439d2 Mon Sep 17 00:00:00 2001 From: liuwenfeng Date: Mon, 26 Feb 2024 15:58:25 +0800 Subject: [PATCH 1/6] export capi interface from print subsystem Signed-off-by: liuwenfeng --- print/print_fwk/BUILD.gn | 34 ++ print/print_fwk/include/native_print_base.h | 376 ++++++++++++++++++++ print/print_fwk/include/native_print_capi.h | 161 +++++++++ print/print_fwk/ohprint.ndk.json | 70 ++++ 4 files changed, 641 insertions(+) create mode 100644 print/print_fwk/BUILD.gn create mode 100644 print/print_fwk/include/native_print_base.h create mode 100644 print/print_fwk/include/native_print_capi.h create mode 100644 print/print_fwk/ohprint.ndk.json diff --git a/print/print_fwk/BUILD.gn b/print/print_fwk/BUILD.gn new file mode 100644 index 000000000..fdd1ad03e --- /dev/null +++ b/print/print_fwk/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (C) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") + +ohos_ndk_headers("ohprint_header") { + dest_dir = "$ndk_headers_out_dir/ohprint" + sources = [ + "include/native_print_base.h", + "include/native_print_capi.h", + ] +} + +ohos_ndk_library("libohprint_ndk") { + output_name = "ohprint" + output_extension = "so" + ndk_description_file = "./ohprint.ndk.json" + system_capability = "SystemCapability.Print.PrintFramework" + system_capability_headers = [ + "ohprint/native_print_base.h", + "ohprint/native_print_capi.h", + ] +} diff --git a/print/print_fwk/include/native_print_base.h b/print/print_fwk/include/native_print_base.h new file mode 100644 index 000000000..aaeaaeee0 --- /dev/null +++ b/print/print_fwk/include/native_print_base.h @@ -0,0 +1,376 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Print + * @{ + * + * @brief Provide the definition of the C interface for the native print module. + * + * @syscap SystemCapability.Print.PrintFramework + * + * @since 12 + * @version 1.0 + */ + +/** + * @file native_print_base.h + * + * @brief Declare the native print data types. + * + * @library libohprint.so + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + * @version 1.0 + */ + +#ifndef NATIVE_PRINT_BASE_H +#define NATIVE_PRINT_BASE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines error codes. + * @since 12 + * @version 1.0 + */ +typedef enum { + /** The operation is successful. */ + PRINT_ERROR_NONE = 0, + /** Permission verification failed. */ + PRINT_ERROR_NO_PERMISSION = 201, + /** Invalid parameter. */ + PRINT_ERROR_INVALID_PARAMETER = 401, + /** General internal error. */ + PRINT_ERROR_GENERIC_FAILURE = 24300001, + /** RPC communication error. */ + PRINT_ERROR_RPC_FAILURE = 24300002, + /** Server error. */ + PRINT_ERROR_SERVER_FAILURE = 24300003, + /** Invalid extension. */ + PRINT_ERROR_INVALID_EXTENSION = 24300004, + /** Invalid printer. */ + PRINT_ERROR_INVALID_PRINTER = 24300005, + /** Invalid print job. */ + PRINT_ERROR_INVALID_PRINT_JOB = 24300006, + /** Failed to read or write files. */ + PRINT_ERROR_FILE_IO = 24300007, + /** Unknown error. */ + PRINT_ERROR_UNKNOWN = 24300255, +} Print_ErrorCode; + +/** + * @brief Indicates printer states. + * @since 12 + */ +typedef enum { + /** Printer idle. */ + PRINTER_IDLE, + /** Printer busy. */ + PRINTER_BUSY, + /** Printer not available. */ + PRINTER_UNAVAILABLE, +} Print_PrinterState; + +/** + * @brief Indicate printer discovery events. + * @since 12 + */ +typedef enum { + /** Printer discovered. */ + PRINTER_DISCOVERED = 0, + /** Printer lost. */ + PRINTER_LOST = 1, + /** Printer connecting. */ + PRINTER_CONNECTING = 2, + /** Printer connected. */ + PRINTER_CONNECTED = 3, +} Print_DiscoveryEvent; + +/** + * @brief Indicate printer change events. + * @since 12 + */ +typedef enum { + /** Printer added. */ + PRINTER_ADDED = 0, + /** Printer deleted. */ + PRINTER_DELETED = 1, + /** Printer state changed. */ + PRINTER_STATE_CHANGED = 2, + /** Printer info changed. */ + PRINTER_INFO_CHANGED = 3, +} Print_PrinterEvent; + +/** + * @brief Indicates paper size info. + * @since 12 + */ +typedef struct { + /** Paper id. */ + char *id; + /** Paper name. */ + char *name; + /** Paper width. */ + uint32_t width; + /** Paper height. */ + uint32_t height; + /** Paper left margin. */ + uint32_t leftMargin; + /** Paper top margin. */ + uint32_t topMargin; + /** Paper right margin. */ + uint32_t rightMargin; + /** Paper bottom margin. */ + uint32_t bottomMargin; +} Print_PageSize; + +/** + * @brief Indicates string list. + * @since 12 + */ +typedef struct { + /** Number of strings. */ + uint32_t count; + /** String pointer array */ + char **list; +} Print_StringList; + +/** + * @brief Indicates printer capabilities. + * @since 12 + */ +typedef struct { + bool supportedColorMode; + uint32_t *supportedDuplexModes; + uint32_t supportedDuplexModesCount; + Print_PageSize *supportedPageSizes; + uint32_t supportedPageSizesCount; + uint32_t *supportedMediaTypes; + uint32_t supportedMediaTypesCount; + uint32_t *supportedQualities; + uint32_t supportedQualitiesCount; + char *supportedDocumentHandling; + char *supportedMediaSource; + uint32_t supportedCopies; + char *supportedResolution; + uint32_t *supportedOrientation; + uint32_t supportedOrientationCount; + char *advanceCapability; +} Print_PrinterCapability; + +/** + * @brief Indicates current properties + * @since 12 + */ +typedef struct { + uint32_t defaultColorMode; + uint32_t defaultSides; + char *defaultMediaType; + char *defaultMediaSource; + uint32_t defaultPrintQuality; + uint32_t defaultCopies; + char *defaultPrinterResolution; + uint32_t defaultOrientation; + char *otherDefaultValues; +} Print_DefaultValue; + +/** + * @brief Indicates printer infomation. + * @since 12 + */ +typedef struct { + /** Printer state. */ + Print_PrinterState printerState; + /** Printer capabilities. */ + Print_PrinterCapability capability; + /** Printer current properties. */ + Print_DefaultValue defaultValue; + /** Default printer. */ + bool isDefaultPrinter; + /** Printer id. */ + char *printerId; + /** Printer name. */ + char *printerName; + /** Printer description. */ + char *description; + /** Printer location. */ + char *location; + /** Printer make and model infomation. */ + char *makeAndModel; + /** Printer Uri. */ + char *printerUri; + /** Detail infomation in json format. */ + char *detailInfo; +} Print_PrinterInfo; + +/** + * @brief Indicates printer property. + * @since 12 + */ +typedef struct { + /** Property keyword */ + char *key; + /** Property value. */ + char *value; +} Print_Property; + +/** + * @brief List of printer properties. + * @since 12 + */ +typedef struct { + /** Number of properties. */ + uint32_t count; + /** Property pointer array. */ + Print_Property *list; +} Print_PropertyList; + +/** + * @brief Indicates PaperSource Mode. + * @since 12 + */ +typedef enum { + PAPER_SOURCE_MODE_AUTO = 6, + PAPER_SOURCE_MODE_CASSETTE = 11, + PAPER_SOURCE_MODE_ENVELOPE = 4, + PAPER_SOURCE_MODE_ENVELOPE_MANUAL = 5, + PAPER_SOURCE_MODE_FORM_SOURCE = 12, + PAPER_SOURCE_MODE_LARGE_CAPACITY = 10, + PAPER_SOURCE_MODE_LARGE_FORMAT = 9, + PAPER_SOURCE_MODE_LOWER = 1, + PAPER_SOURCE_MODE_LAST_PAPER_SOURCE = 13, + PAPER_SOURCE_MODE_MIDDLE = 2, + PAPER_SOURCE_MODE_MANUAL = 3, + PAPER_SOURCE_MODE_ONLY_ONE = 0, + PAPER_SOURCE_MODE_TRACTOR = 7, + PAPER_SOURCE_MODE_SMALL_FORMAT = 8, + PAPER_SOURCE_MODE_CUSTOM_SOURCE = 14, +} PrintJob_PaperSource; + +/** + * @brief Indicates DuplexMode + * @since 12 + */ +typedef enum { + DUPLEX_MODE_ONE_SIDED = 0, + DUPLEX_MODE_TWO_SIDED_LONG_EDGE = 1, + DUPLEX_MODE_TWO_SIDED_SHORT_EDGE = 2, +} PrintJob_DuplexMode; + +/** + * @brief Indicates ColorMode + * @since 12 + */ +typedef enum { + COLOR_MODE_MONOCHROME = 0, + COLOR_MODE_COLOR = 1, + COLOR_MODE_AUTO = 2, +} PrintJob_ColorMode; + +/** + * @brief Indicates OrientationMode + * @since 12 + */ +typedef enum { + ORIENTATION_MODE_PORTRAIT = 0, + ORIENTATION_MODE_LANDSCAPE = 1, +} PrintJob_OrientationMode; + +/** + * @brief Indicates PageSize + * @since 12 + */ +typedef struct { + char *id; + char *name; + uint32_t width; + uint32_t height; +} PrintJob_PageSize; + +/** + * @brief Indicates PageRange + * @since 12 + */ +typedef struct { + uint32_t startPage; + uint32_t endPage; + uint32_t *pages; + uint32_t pagesCount; +} PrintJob_PageRange; + +/** + * @brief Indicates PrintMargin + * @since 12 + */ +typedef struct { + uint32_t topMargin; + uint32_t bottomMargin; + uint32_t leftMargin; + uint32_t rightMargin; +} PrintJob_PrintMargin; + +/** + * @brief Indicates PrintJob OptionObject. + * @since 12 + */ +typedef struct { + char *jobName; + char *mediaType; + uint32_t documentCategory; + char *printQuality; + char *printerName; + char *printerUri; + char *documentFormat; + char *advanceOptions; +} PrintJob_OptionObject; + +/** + * @brief Indicates PrintJob Structure. + * @since 12 + */ +typedef struct { + uint32_t *fdList; + uint32_t fdListCount; + char *printerId; + uint32_t dpi; + uint32_t copyNumber; + PrintJob_PaperSource paperSource; + PrintJob_PageSize pageSize; + PrintJob_ColorMode colorMode; + PrintJob_DuplexMode duplexMode; + PrintJob_PageRange pageRange; + PrintJob_PrintMargin printMargin; + PrintJob_OrientationMode orientationMode; + PrintJob_OptionObject printOption; +} Print_PrintJob; + +/** + * @brief Printer change callback. + * @since 12 + */ +typedef void (*Print_PrinterChangeCallback)(uint32_t event, const Print_PrinterInfo *printerInfo); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_PRINT_BASE_H +/** @} */ diff --git a/print/print_fwk/include/native_print_capi.h b/print/print_fwk/include/native_print_capi.h new file mode 100644 index 000000000..f5c230e45 --- /dev/null +++ b/print/print_fwk/include/native_print_capi.h @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Print + * @{ + * + * @brief Provide the definition of the C interface for the native print module. + * + * @syscap SystemCapability.Print.PrintFramework + * + * @since 12 + * @version 1.0 + */ + +/** + * @file native_print_capi.h + * + * @brief Declare the native print functions. + * + * @library libohprint.so + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + * @version 1.0 + */ + +#ifndef NATIVE_PRINT_CAPI_H +#define NATIVE_PRINT_CAPI_H + +#include "native_print_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize. + * @since 12 + */ +int32_t OH_Print_Init(); +// 反初始化 +/** + * @brief Release resources before exiting. + * @since 12 + */ +int32_t OH_Print_Release(); + +// 开始发现打印机 +/** + * @brief Start discovering printers. + * @since 12 + */ +int32_t OH_Print_StartPrinterDiscovery(Print_PrinterChangeCallback callback); + +// 停止发现打印机 +/** + * @brief Stop discovering printers. + * @since 12 + */ +int32_t OH_Print_StopPrinterDiscovery(); + +/** + * @brief Connect to a printer. + * @since 12 + */ +int32_t OH_Print_ConnectPrinter(const char *printerId); + +// 开始打印任务 +/** + * @brief Start print job. + * @since 12 + */ +int32_t OH_Print_StartPrintJob(const Print_PrintJob *printJob); + +// 注册打印机状态事件 +/** + * @brief Register printer change events. + * @since 12 + */ +int32_t OH_Print_RegisterPrinterChangeListener(Print_PrinterChangeCallback callback); + +/** + * @brief Unregister printer change event. + * @since 12 + */ +void OH_Print_UnregisterPrinterChangeListener(); + +// 获取打印机列表 +/** + * @brief Query the printer list. + * @since 12 + */ +int32_t OH_Print_QueryPrinterList(Print_StringList *printerIdList); + +/** + * @brief Free printer list memory. + * @since 12 + */ +void OH_Print_ReleasePrinterList(Print_StringList *printerIdList); + +/** + * @brief Query printer infomation. + * @since 12 + */ +int32_t OH_Print_QueryPrinterInfo(const char *printerId, Print_PrinterInfo **printerInfo); + +/** + * @brief Free printer infomation memory. + * @since 12 + */ +void OH_Print_ReleasePrinterInfo(Print_PrinterInfo *printerInfo); + +/** + * @brief Open the printer manager page. + * @since 12 + */ +int32_t OH_Print_LaunchPrinterManager(); + +/** + * @brief Query printer properties. + * @since 12 + */ +int32_t OH_Print_QueryPrinterProperties(const char *printerId, const Print_StringList propertyKeyList, + Print_PropertyList *propertyList); + +/** + * @brief Free printer properties memory. + * @since 12 + */ +void OH_Print_ReleasePrinterProperties(Print_PropertyList *propertyList); + +/** + * @brief Set printer properties. + * @since 12 + */ +int32_t OH_Print_UpdatePrinterProperties(const char *printerId, const Print_PropertyList *propertyList); + +/** + * @brief Restore printer properties to default settings. + * @since 12 + */ +int32_t OH_Print_RestorePrinterProperties(const char *printerId, const Print_StringList *propertyKeyList); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_PRINT_CAPI_H +/** @} */ diff --git a/print/print_fwk/ohprint.ndk.json b/print/print_fwk/ohprint.ndk.json new file mode 100644 index 000000000..cf7f7032e --- /dev/null +++ b/print/print_fwk/ohprint.ndk.json @@ -0,0 +1,70 @@ +[ + { + "first_introduced": "12", + "name": "OH_Print_Init" + }, + { + "first_introduced": "12", + "name": "OH_Print_Release" + }, + { + "first_introduced": "12", + "name": "OH_Print_StartPrinterDiscovery" + }, + { + "first_introduced": "12", + "name": "OH_Print_StopPrinterDiscovery" + }, + { + "first_introduced": "12", + "name": "OH_Print_ConnectPrinter" + }, + { + "first_introduced": "12", + "name": "OH_Print_StartPrintJob" + }, + { + "first_introduced": "12", + "name": "OH_Print_RegisterPrinterChangeListener" + }, + { + "first_introduced": "12", + "name": "OH_Print_UnregisterPrinterChangeListener" + }, + { + "first_introduced": "12", + "name": "OH_Print_QueryPrinterList" + }, + { + "first_introduced": "12", + "name": "OH_Print_ReleasePrinterList" + }, + { + "first_introduced": "12", + "name": "OH_Print_QueryPrinterInfo" + }, + { + "first_introduced": "12", + "name": "OH_Print_ReleasePrinterInfo" + }, + { + "first_introduced": "12", + "name": "OH_Print_LaunchPrinterManager" + }, + { + "first_introduced": "12", + "name": "OH_Print_QueryPrinterProperties" + }, + { + "first_introduced": "12", + "name": "OH_Print_ReleasePrinterProperties" + }, + { + "first_introduced": "12", + "name": "OH_Print_UpdatePrinterProperties" + }, + { + "first_introduced": "12", + "name": "OH_Print_RestorePrinterProperties" + } +] -- Gitee From f664e3b27e8b2e762bf6c2cefde0c5e9e1810a12 Mon Sep 17 00:00:00 2001 From: liuwenfeng Date: Mon, 4 Mar 2024 15:46:42 +0800 Subject: [PATCH 2/6] export capi interface from print subsystem Signed-off-by: liuwenfeng --- print/print_fwk/include/native_print_base.h | 81 +++++++++++++++++++++ print/print_fwk/include/native_print_capi.h | 7 +- 2 files changed, 82 insertions(+), 6 deletions(-) diff --git a/print/print_fwk/include/native_print_base.h b/print/print_fwk/include/native_print_base.h index aaeaaeee0..8bf293b71 100644 --- a/print/print_fwk/include/native_print_base.h +++ b/print/print_fwk/include/native_print_base.h @@ -158,21 +158,37 @@ typedef struct { * @since 12 */ typedef struct { + /** Support for color printing. */ bool supportedColorMode; + /** Array of supported duplex printing modes. */ uint32_t *supportedDuplexModes; + /** Number of supported duplex printing mode. */ uint32_t supportedDuplexModesCount; + /** Array of supported print paper sizes. */ Print_PageSize *supportedPageSizes; + /** Number of supported print paper sizes. */ uint32_t supportedPageSizesCount; + /** Array of supported print media types. */ uint32_t *supportedMediaTypes; + /** Number of supported print media types. */ uint32_t supportedMediaTypesCount; + /** Array of supported print qulities. */ uint32_t *supportedQualities; + /** Number of supported print qulities. */ uint32_t supportedQualitiesCount; + /** Supported document handling in json format. */ char *supportedDocumentHandling; + /** Supported media source in json format. */ char *supportedMediaSource; + /** Supported copies. */ uint32_t supportedCopies; + /** Default printer resolution. */ char *supportedResolution; + /** Array of supported orientation. */ uint32_t *supportedOrientation; + /** Number of supported orientation. */ uint32_t supportedOrientationCount; + /** advanced capability in json format. */ char *advanceCapability; } Print_PrinterCapability; @@ -181,14 +197,23 @@ typedef struct { * @since 12 */ typedef struct { + /** Default color mode. */ uint32_t defaultColorMode; + /** Default sides. */ uint32_t defaultSides; + /** Default media type. */ char *defaultMediaType; + /** Default media source. */ char *defaultMediaSource; + /** Default print quality */ uint32_t defaultPrintQuality; + /** Default copies. */ uint32_t defaultCopies; + /** Default printer resolution. */ char *defaultPrinterResolution; + /** Default orientation. */ uint32_t defaultOrientation; + /** Other default values in json format. */ char *otherDefaultValues; } Print_DefaultValue; @@ -248,20 +273,35 @@ typedef struct { * @since 12 */ typedef enum { + /** Auto paper source mode. */ PAPER_SOURCE_MODE_AUTO = 6, + /** Cassette paper source mode. */ PAPER_SOURCE_MODE_CASSETTE = 11, + /** Envelope paper source mode. */ PAPER_SOURCE_MODE_ENVELOPE = 4, + /** Manual envelope paper source mode. */ PAPER_SOURCE_MODE_ENVELOPE_MANUAL = 5, + /** Form source mode. */ PAPER_SOURCE_MODE_FORM_SOURCE = 12, + /** Large capacity paper source mode. */ PAPER_SOURCE_MODE_LARGE_CAPACITY = 10, + /** Large format paper source mode. */ PAPER_SOURCE_MODE_LARGE_FORMAT = 9, + /** Lower paper source mode. */ PAPER_SOURCE_MODE_LOWER = 1, + /** Last paper source mode. */ PAPER_SOURCE_MODE_LAST_PAPER_SOURCE = 13, + /** Middle paper source mode. */ PAPER_SOURCE_MODE_MIDDLE = 2, + /** Manual paper source mode. */ PAPER_SOURCE_MODE_MANUAL = 3, + /** Only one paper source mode. */ PAPER_SOURCE_MODE_ONLY_ONE = 0, + /** Tractor paper source mode. */ PAPER_SOURCE_MODE_TRACTOR = 7, + /** Smarll format paper source mode. */ PAPER_SOURCE_MODE_SMALL_FORMAT = 8, + /** Custom paper source mode. */ PAPER_SOURCE_MODE_CUSTOM_SOURCE = 14, } PrintJob_PaperSource; @@ -270,8 +310,11 @@ typedef enum { * @since 12 */ typedef enum { + /** One sided duplex mode. */ DUPLEX_MODE_ONE_SIDED = 0, + /** Long edge two sided duplex mode. */ DUPLEX_MODE_TWO_SIDED_LONG_EDGE = 1, + /** Short edge two sided duplex mode. */ DUPLEX_MODE_TWO_SIDED_SHORT_EDGE = 2, } PrintJob_DuplexMode; @@ -280,8 +323,11 @@ typedef enum { * @since 12 */ typedef enum { + /** Monochrome mode. */ COLOR_MODE_MONOCHROME = 0, + /** Color mode. */ COLOR_MODE_COLOR = 1, + /** Auto mode. */ COLOR_MODE_AUTO = 2, } PrintJob_ColorMode; @@ -290,7 +336,9 @@ typedef enum { * @since 12 */ typedef enum { + /** Portrait mode. */ ORIENTATION_MODE_PORTRAIT = 0, + /** Landscape mode. */ ORIENTATION_MODE_LANDSCAPE = 1, } PrintJob_OrientationMode; @@ -299,9 +347,13 @@ typedef enum { * @since 12 */ typedef struct { + /** Paper id. */ char *id; + /** Paper name. */ char *name; + /** Paper width. */ uint32_t width; + /** Paper height. */ uint32_t height; } PrintJob_PageSize; @@ -310,9 +362,13 @@ typedef struct { * @since 12 */ typedef struct { + /** Start page. */ uint32_t startPage; + /** End page. */ uint32_t endPage; + /** Array of pages. */ uint32_t *pages; + /** Number of pages. */ uint32_t pagesCount; } PrintJob_PageRange; @@ -321,9 +377,13 @@ typedef struct { * @since 12 */ typedef struct { + /** top margin. */ uint32_t topMargin; + /** bottom margin. */ uint32_t bottomMargin; + /** left margin. */ uint32_t leftMargin; + /** right margin. */ uint32_t rightMargin; } PrintJob_PrintMargin; @@ -332,13 +392,21 @@ typedef struct { * @since 12 */ typedef struct { + /** Job name. */ char *jobName; + /** Media type. */ char *mediaType; + /** Document category. */ uint32_t documentCategory; + /** Print quality. */ char *printQuality; + /** Printer name. */ char *printerName; + /** Printer Uri. */ char *printerUri; + /** Document format. */ char *documentFormat; + /** Advanced options in json format. */ char *advanceOptions; } PrintJob_OptionObject; @@ -347,18 +415,31 @@ typedef struct { * @since 12 */ typedef struct { + /** Array of file descriptors to print. */ uint32_t *fdList; + /** Number of file descriptors to print. */ uint32_t fdListCount; + /** Printer id. */ char *printerId; + /** Print resolution in dpi. */ uint32_t dpi; + /** Number of copies printed. */ uint32_t copyNumber; + /** Paper source. */ PrintJob_PaperSource paperSource; + /** Paper size. */ PrintJob_PageSize pageSize; + /** Color mode. */ PrintJob_ColorMode colorMode; + /** Duplex source. */ PrintJob_DuplexMode duplexMode; + /** Page range. */ PrintJob_PageRange pageRange; + /** Print margin. */ PrintJob_PrintMargin printMargin; + /** Orientation mode. */ PrintJob_OrientationMode orientationMode; + /** Print option. */ PrintJob_OptionObject printOption; } Print_PrintJob; diff --git a/print/print_fwk/include/native_print_capi.h b/print/print_fwk/include/native_print_capi.h index f5c230e45..dc4fcf391 100644 --- a/print/print_fwk/include/native_print_capi.h +++ b/print/print_fwk/include/native_print_capi.h @@ -50,21 +50,19 @@ extern "C" { * @since 12 */ int32_t OH_Print_Init(); -// 反初始化 + /** * @brief Release resources before exiting. * @since 12 */ int32_t OH_Print_Release(); -// 开始发现打印机 /** * @brief Start discovering printers. * @since 12 */ int32_t OH_Print_StartPrinterDiscovery(Print_PrinterChangeCallback callback); -// 停止发现打印机 /** * @brief Stop discovering printers. * @since 12 @@ -77,14 +75,12 @@ int32_t OH_Print_StopPrinterDiscovery(); */ int32_t OH_Print_ConnectPrinter(const char *printerId); -// 开始打印任务 /** * @brief Start print job. * @since 12 */ int32_t OH_Print_StartPrintJob(const Print_PrintJob *printJob); -// 注册打印机状态事件 /** * @brief Register printer change events. * @since 12 @@ -97,7 +93,6 @@ int32_t OH_Print_RegisterPrinterChangeListener(Print_PrinterChangeCallback callb */ void OH_Print_UnregisterPrinterChangeListener(); -// 获取打印机列表 /** * @brief Query the printer list. * @since 12 -- Gitee From 6e6ae38051df737d142d24a09951d5d22ecd0fbd Mon Sep 17 00:00:00 2001 From: liuwenfeng Date: Tue, 5 Mar 2024 17:35:58 +0800 Subject: [PATCH 3/6] export capi interface from print subsystem Signed-off-by: liuwenfeng --- print/print_fwk/BUILD.gn | 8 +- print/print_fwk/include/native_print_capi.h | 156 ------------ .../{native_print_base.h => print_base.h} | 6 +- print/print_fwk/include/print_capi.h | 230 ++++++++++++++++++ 4 files changed, 237 insertions(+), 163 deletions(-) delete mode 100644 print/print_fwk/include/native_print_capi.h rename print/print_fwk/include/{native_print_base.h => print_base.h} (94%) create mode 100644 print/print_fwk/include/print_capi.h diff --git a/print/print_fwk/BUILD.gn b/print/print_fwk/BUILD.gn index fdd1ad03e..a16a6fe60 100644 --- a/print/print_fwk/BUILD.gn +++ b/print/print_fwk/BUILD.gn @@ -17,8 +17,8 @@ import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("ohprint_header") { dest_dir = "$ndk_headers_out_dir/ohprint" sources = [ - "include/native_print_base.h", - "include/native_print_capi.h", + "include/print_base.h", + "include/print_capi.h", ] } @@ -28,7 +28,7 @@ ohos_ndk_library("libohprint_ndk") { ndk_description_file = "./ohprint.ndk.json" system_capability = "SystemCapability.Print.PrintFramework" system_capability_headers = [ - "ohprint/native_print_base.h", - "ohprint/native_print_capi.h", + "ohprint/print_base.h", + "ohprint/print_capi.h", ] } diff --git a/print/print_fwk/include/native_print_capi.h b/print/print_fwk/include/native_print_capi.h deleted file mode 100644 index dc4fcf391..000000000 --- a/print/print_fwk/include/native_print_capi.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup OH_Print - * @{ - * - * @brief Provide the definition of the C interface for the native print module. - * - * @syscap SystemCapability.Print.PrintFramework - * - * @since 12 - * @version 1.0 - */ - -/** - * @file native_print_capi.h - * - * @brief Declare the native print functions. - * - * @library libohprint.so - * @syscap SystemCapability.Print.PrintFramework - * @since 12 - * @version 1.0 - */ - -#ifndef NATIVE_PRINT_CAPI_H -#define NATIVE_PRINT_CAPI_H - -#include "native_print_base.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Initialize. - * @since 12 - */ -int32_t OH_Print_Init(); - -/** - * @brief Release resources before exiting. - * @since 12 - */ -int32_t OH_Print_Release(); - -/** - * @brief Start discovering printers. - * @since 12 - */ -int32_t OH_Print_StartPrinterDiscovery(Print_PrinterChangeCallback callback); - -/** - * @brief Stop discovering printers. - * @since 12 - */ -int32_t OH_Print_StopPrinterDiscovery(); - -/** - * @brief Connect to a printer. - * @since 12 - */ -int32_t OH_Print_ConnectPrinter(const char *printerId); - -/** - * @brief Start print job. - * @since 12 - */ -int32_t OH_Print_StartPrintJob(const Print_PrintJob *printJob); - -/** - * @brief Register printer change events. - * @since 12 - */ -int32_t OH_Print_RegisterPrinterChangeListener(Print_PrinterChangeCallback callback); - -/** - * @brief Unregister printer change event. - * @since 12 - */ -void OH_Print_UnregisterPrinterChangeListener(); - -/** - * @brief Query the printer list. - * @since 12 - */ -int32_t OH_Print_QueryPrinterList(Print_StringList *printerIdList); - -/** - * @brief Free printer list memory. - * @since 12 - */ -void OH_Print_ReleasePrinterList(Print_StringList *printerIdList); - -/** - * @brief Query printer infomation. - * @since 12 - */ -int32_t OH_Print_QueryPrinterInfo(const char *printerId, Print_PrinterInfo **printerInfo); - -/** - * @brief Free printer infomation memory. - * @since 12 - */ -void OH_Print_ReleasePrinterInfo(Print_PrinterInfo *printerInfo); - -/** - * @brief Open the printer manager page. - * @since 12 - */ -int32_t OH_Print_LaunchPrinterManager(); - -/** - * @brief Query printer properties. - * @since 12 - */ -int32_t OH_Print_QueryPrinterProperties(const char *printerId, const Print_StringList propertyKeyList, - Print_PropertyList *propertyList); - -/** - * @brief Free printer properties memory. - * @since 12 - */ -void OH_Print_ReleasePrinterProperties(Print_PropertyList *propertyList); - -/** - * @brief Set printer properties. - * @since 12 - */ -int32_t OH_Print_UpdatePrinterProperties(const char *printerId, const Print_PropertyList *propertyList); - -/** - * @brief Restore printer properties to default settings. - * @since 12 - */ -int32_t OH_Print_RestorePrinterProperties(const char *printerId, const Print_StringList *propertyKeyList); - -#ifdef __cplusplus -} -#endif - -#endif // NATIVE_PRINT_CAPI_H -/** @} */ diff --git a/print/print_fwk/include/native_print_base.h b/print/print_fwk/include/print_base.h similarity index 94% rename from print/print_fwk/include/native_print_base.h rename to print/print_fwk/include/print_base.h index 8bf293b71..88d1b3c32 100644 --- a/print/print_fwk/include/native_print_base.h +++ b/print/print_fwk/include/print_base.h @@ -17,7 +17,7 @@ * @addtogroup OH_Print * @{ * - * @brief Provide the definition of the C interface for the native print module. + * @brief Provide the definition of the C interface for the print module. * * @syscap SystemCapability.Print.PrintFramework * @@ -26,9 +26,9 @@ */ /** - * @file native_print_base.h + * @file print_base.h * - * @brief Declare the native print data types. + * @brief Declare the print data types. * * @library libohprint.so * @syscap SystemCapability.Print.PrintFramework diff --git a/print/print_fwk/include/print_capi.h b/print/print_fwk/include/print_capi.h new file mode 100644 index 000000000..35ccea5b1 --- /dev/null +++ b/print/print_fwk/include/print_capi.h @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Print + * @{ + * + * @brief Provide the definition of the C interface for the print module. + * + * @syscap SystemCapability.Print.PrintFramework + * + * @since 12 + * @version 1.0 + */ + +/** + * @file print_capi.h + * + * @brief Declare the print functions. + * + * @library libohprint.so + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + * @version 1.0 + */ + +#ifndef NATIVE_PRINT_CAPI_H +#define NATIVE_PRINT_CAPI_H + +#include "print_base.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief This API checks and pulls up the print service, initializes the print client, + * and establishes a connection to the print service. + * @permission {@code ohos.permission.PRINT} + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_Init(); + +/** + * @brief This API closes the connection from the print service, dissolves the previous callback, + * and releases the print client resources. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_Release(); + +/** + * @brief This API starts discovering printers. + * @permission {@code ohos.permission.PRINT} + * @param callback The {@link Print_PrinterChangeCallback} of printer discovery event. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_StartPrinterDiscovery(Print_PrinterChangeCallback callback); + +/** + * @brief This API stops discovering printers. + * @permission {@code ohos.permission.PRINT} + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_StopPrinterDiscovery(); + +/** + * @brief This API connects to the printer using the printer id. + * @permission {@code ohos.permission.PRINT} + * @param printerId The id of the printer to be connected. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_ConnectPrinter(const char *printerId); + +/** + * @brief This API starts initiating a print job. + * @permission {@code ohos.permission.PRINT} + * @param printJob A pointer to a {@link Print_PrintJob} instance that specifies the information for the print job. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_StartPrintJob(const Print_PrintJob *printJob); + +/** + * @brief This API registers the callback for printer changes. + * @permission {@code ohos.permission.PRINT} + * @param callback The {@link Print_PrinterChangeCallback} to be registered. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_RegisterPrinterChangeListener(Print_PrinterChangeCallback callback); + +/** + * @brief This API unregisters the callback for printer changes. + * @permission {@code ohos.permission.PRINT} + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +void OH_Print_UnregisterPrinterChangeListener(); + +/** + * @brief This API queries for a list of added printers. + * @permission {@code ohos.permission.PRINT} + * @param printerIdList A pointer to a {@link Print_StringList} instance to store the queried printer Id list. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_QueryPrinterList(Print_StringList *printerIdList); + +/** + * @brief This API frees up the printer list memory for the query. + * @param printerIdList The queried printer Id list to be released. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +void OH_Print_ReleasePrinterList(Print_StringList *printerIdList); + +/** + * @brief This API queries printer information based on the printer ID. + * @permission {@code ohos.permission.PRINT} + * @param printerId The id of the printer to be queried. + * @param printerInfo A pointer to a {@link Print_PrinterInfo} pointer to store the printer infomation. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_QueryPrinterInfo(const char *printerId, Print_PrinterInfo **printerInfo); + +/** + * @brief This API frees up the printer infomation memory for the query. + * @param printerInfo The pointer of the queried printer infomation to be released. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +void OH_Print_ReleasePrinterInfo(Print_PrinterInfo *printerInfo); + +/** + * @brief This API launches the system's printer management window. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_LaunchPrinterManager(); + +/** + * @brief This API queries the corresponding printer property values based on the list of property keywords. + * @permission {@code ohos.permission.PRINT} + * @param printerId The id of the printer to be queried. + * @param propertyKeyList The list of property keywords to be queried + * @param propertyList The list of printer property values queried. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_QueryPrinterProperties(const char *printerId, const Print_StringList *propertyKeyList, + Print_PropertyList *propertyList); + +/** + * @brief This API frees up the property list memory for the query. + * @param propertyList The pointer of the queried printer property values to be released. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +void OH_Print_ReleasePrinterProperties(Print_PropertyList *propertyList); + +/** + * @brief This API sets printer properties based on a list of property key-value pairs. + * @permission {@code ohos.permission.PRINT} + * @param printerId The id of the printer to be set. + * @param propertyList The list of printer property values to be set. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_UpdatePrinterProperties(const char *printerId, const Print_PropertyList *propertyList); + +/** + * @brief This API restores printer properties to default settings based on the list of property keywords. + * @permission {@code ohos.permission.PRINT} + * @param printerId The id of the printer to be restored. + * @param propertyKeyList The list of property keywords to be restored. + * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, + * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. + * @syscap SystemCapability.Print.PrintFramework + * @since 12 + */ +int32_t OH_Print_RestorePrinterProperties(const char *printerId, const Print_StringList *propertyKeyList); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_PRINT_CAPI_H +/** @} */ -- Gitee From 3a71db63b5159553dcb5ec0f8d0c696c985e3374 Mon Sep 17 00:00:00 2001 From: liuwenfeng Date: Tue, 5 Mar 2024 17:59:43 +0800 Subject: [PATCH 4/6] export capi interface from print subsystem Signed-off-by: liuwenfeng --- print/print_fwk/include/print_capi.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/print/print_fwk/include/print_capi.h b/print/print_fwk/include/print_capi.h index 35ccea5b1..786050d56 100644 --- a/print/print_fwk/include/print_capi.h +++ b/print/print_fwk/include/print_capi.h @@ -17,7 +17,7 @@ * @addtogroup OH_Print * @{ * - * @brief Provide the definition of the C interface for the print module. + * @brief Provides the definition of the C interface for the print module. * * @syscap SystemCapability.Print.PrintFramework * @@ -28,7 +28,8 @@ /** * @file print_capi.h * - * @brief Declare the print functions. + * @brief Declares the APIs to discover and connect printers, get printer lists and printer information, + * and use a printer to print files, etc. * * @library libohprint.so * @syscap SystemCapability.Print.PrintFramework -- Gitee From 08e8fc6892d8f0025506f26087b6a607cef90d0a Mon Sep 17 00:00:00 2001 From: liuwenfeng Date: Tue, 5 Mar 2024 21:02:21 +0800 Subject: [PATCH 5/6] export capi interface from print subsystem Signed-off-by: liuwenfeng --- print/print_fwk/include/print_base.h | 21 +++++++++++++++++++++ print/print_fwk/include/print_capi.h | 23 ++++++++++++++++++++--- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/print/print_fwk/include/print_base.h b/print/print_fwk/include/print_base.h index 88d1b3c32..6b4cbed1a 100644 --- a/print/print_fwk/include/print_base.h +++ b/print/print_fwk/include/print_base.h @@ -48,6 +48,7 @@ extern "C" { /** * @brief Defines error codes. + * * @since 12 * @version 1.0 */ @@ -78,6 +79,7 @@ typedef enum { /** * @brief Indicates printer states. + * * @since 12 */ typedef enum { @@ -91,6 +93,7 @@ typedef enum { /** * @brief Indicate printer discovery events. + * * @since 12 */ typedef enum { @@ -106,6 +109,7 @@ typedef enum { /** * @brief Indicate printer change events. + * * @since 12 */ typedef enum { @@ -121,6 +125,7 @@ typedef enum { /** * @brief Indicates paper size info. + * * @since 12 */ typedef struct { @@ -144,6 +149,7 @@ typedef struct { /** * @brief Indicates string list. + * * @since 12 */ typedef struct { @@ -155,6 +161,7 @@ typedef struct { /** * @brief Indicates printer capabilities. + * * @since 12 */ typedef struct { @@ -194,6 +201,7 @@ typedef struct { /** * @brief Indicates current properties + * * @since 12 */ typedef struct { @@ -219,6 +227,7 @@ typedef struct { /** * @brief Indicates printer infomation. + * * @since 12 */ typedef struct { @@ -248,6 +257,7 @@ typedef struct { /** * @brief Indicates printer property. + * * @since 12 */ typedef struct { @@ -259,6 +269,7 @@ typedef struct { /** * @brief List of printer properties. + * * @since 12 */ typedef struct { @@ -270,6 +281,7 @@ typedef struct { /** * @brief Indicates PaperSource Mode. + * * @since 12 */ typedef enum { @@ -307,6 +319,7 @@ typedef enum { /** * @brief Indicates DuplexMode + * * @since 12 */ typedef enum { @@ -320,6 +333,7 @@ typedef enum { /** * @brief Indicates ColorMode + * * @since 12 */ typedef enum { @@ -333,6 +347,7 @@ typedef enum { /** * @brief Indicates OrientationMode + * * @since 12 */ typedef enum { @@ -344,6 +359,7 @@ typedef enum { /** * @brief Indicates PageSize + * * @since 12 */ typedef struct { @@ -359,6 +375,7 @@ typedef struct { /** * @brief Indicates PageRange + * * @since 12 */ typedef struct { @@ -374,6 +391,7 @@ typedef struct { /** * @brief Indicates PrintMargin + * * @since 12 */ typedef struct { @@ -389,6 +407,7 @@ typedef struct { /** * @brief Indicates PrintJob OptionObject. + * * @since 12 */ typedef struct { @@ -412,6 +431,7 @@ typedef struct { /** * @brief Indicates PrintJob Structure. + * * @since 12 */ typedef struct { @@ -445,6 +465,7 @@ typedef struct { /** * @brief Printer change callback. + * * @since 12 */ typedef void (*Print_PrinterChangeCallback)(uint32_t event, const Print_PrinterInfo *printerInfo); diff --git a/print/print_fwk/include/print_capi.h b/print/print_fwk/include/print_capi.h index 786050d56..34b22a1e8 100644 --- a/print/print_fwk/include/print_capi.h +++ b/print/print_fwk/include/print_capi.h @@ -49,6 +49,7 @@ extern "C" { /** * @brief This API checks and pulls up the print service, initializes the print client, * and establishes a connection to the print service. + * * @permission {@code ohos.permission.PRINT} * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. @@ -60,6 +61,7 @@ int32_t OH_Print_Init(); /** * @brief This API closes the connection from the print service, dissolves the previous callback, * and releases the print client resources. + * * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. * @syscap SystemCapability.Print.PrintFramework @@ -69,6 +71,7 @@ int32_t OH_Print_Release(); /** * @brief This API starts discovering printers. + * * @permission {@code ohos.permission.PRINT} * @param callback The {@link Print_PrinterChangeCallback} of printer discovery event. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -80,6 +83,7 @@ int32_t OH_Print_StartPrinterDiscovery(Print_PrinterChangeCallback callback); /** * @brief This API stops discovering printers. + * * @permission {@code ohos.permission.PRINT} * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. @@ -90,6 +94,7 @@ int32_t OH_Print_StopPrinterDiscovery(); /** * @brief This API connects to the printer using the printer id. + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be connected. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -101,6 +106,7 @@ int32_t OH_Print_ConnectPrinter(const char *printerId); /** * @brief This API starts initiating a print job. + * * @permission {@code ohos.permission.PRINT} * @param printJob A pointer to a {@link Print_PrintJob} instance that specifies the information for the print job. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -112,6 +118,7 @@ int32_t OH_Print_StartPrintJob(const Print_PrintJob *printJob); /** * @brief This API registers the callback for printer changes. + * * @permission {@code ohos.permission.PRINT} * @param callback The {@link Print_PrinterChangeCallback} to be registered. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -123,6 +130,7 @@ int32_t OH_Print_RegisterPrinterChangeListener(Print_PrinterChangeCallback callb /** * @brief This API unregisters the callback for printer changes. + * * @permission {@code ohos.permission.PRINT} * @syscap SystemCapability.Print.PrintFramework * @since 12 @@ -131,8 +139,9 @@ void OH_Print_UnregisterPrinterChangeListener(); /** * @brief This API queries for a list of added printers. + * * @permission {@code ohos.permission.PRINT} - * @param printerIdList A pointer to a {@link Print_StringList} instance to store the queried printer Id list. + * @param printerIdList A pointer to a {@link Print_StringList} instance to store the queried printer id list. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. * @syscap SystemCapability.Print.PrintFramework @@ -142,14 +151,16 @@ int32_t OH_Print_QueryPrinterList(Print_StringList *printerIdList); /** * @brief This API frees up the printer list memory for the query. - * @param printerIdList The queried printer Id list to be released. + * + * @param printerIdList The queried printer id list to be released. * @syscap SystemCapability.Print.PrintFramework * @since 12 */ void OH_Print_ReleasePrinterList(Print_StringList *printerIdList); /** - * @brief This API queries printer information based on the printer ID. + * @brief This API queries printer information based on the printer id. + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be queried. * @param printerInfo A pointer to a {@link Print_PrinterInfo} pointer to store the printer infomation. @@ -162,6 +173,7 @@ int32_t OH_Print_QueryPrinterInfo(const char *printerId, Print_PrinterInfo **pri /** * @brief This API frees up the printer infomation memory for the query. + * * @param printerInfo The pointer of the queried printer infomation to be released. * @syscap SystemCapability.Print.PrintFramework * @since 12 @@ -170,6 +182,7 @@ void OH_Print_ReleasePrinterInfo(Print_PrinterInfo *printerInfo); /** * @brief This API launches the system's printer management window. + * * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. * @syscap SystemCapability.Print.PrintFramework @@ -179,6 +192,7 @@ int32_t OH_Print_LaunchPrinterManager(); /** * @brief This API queries the corresponding printer property values based on the list of property keywords. + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be queried. * @param propertyKeyList The list of property keywords to be queried @@ -193,6 +207,7 @@ int32_t OH_Print_QueryPrinterProperties(const char *printerId, const Print_Strin /** * @brief This API frees up the property list memory for the query. + * * @param propertyList The pointer of the queried printer property values to be released. * @syscap SystemCapability.Print.PrintFramework * @since 12 @@ -201,6 +216,7 @@ void OH_Print_ReleasePrinterProperties(Print_PropertyList *propertyList); /** * @brief This API sets printer properties based on a list of property key-value pairs. + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be set. * @param propertyList The list of printer property values to be set. @@ -213,6 +229,7 @@ int32_t OH_Print_UpdatePrinterProperties(const char *printerId, const Print_Prop /** * @brief This API restores printer properties to default settings based on the list of property keywords. + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be restored. * @param propertyKeyList The list of property keywords to be restored. -- Gitee From a97a46c0d55813082185a24eea89c93517a9a835 Mon Sep 17 00:00:00 2001 From: liuwenfeng Date: Wed, 27 Mar 2024 20:52:16 +0800 Subject: [PATCH 6/6] export capi interface from print subsystem Signed-off-by: liuwenfeng --- print/print_fwk/include/print_base.h | 420 ++++++++++++--------------- print/print_fwk/include/print_capi.h | 34 +-- 2 files changed, 206 insertions(+), 248 deletions(-) diff --git a/print/print_fwk/include/print_base.h b/print/print_fwk/include/print_base.h index 6b4cbed1a..22d845572 100644 --- a/print/print_fwk/include/print_base.h +++ b/print/print_fwk/include/print_base.h @@ -48,7 +48,7 @@ extern "C" { /** * @brief Defines error codes. - * + * * @since 12 * @version 1.0 */ @@ -79,7 +79,7 @@ typedef enum { /** * @brief Indicates printer states. - * + * * @since 12 */ typedef enum { @@ -93,7 +93,7 @@ typedef enum { /** * @brief Indicate printer discovery events. - * + * * @since 12 */ typedef enum { @@ -109,7 +109,7 @@ typedef enum { /** * @brief Indicate printer change events. - * + * * @since 12 */ typedef enum { @@ -123,33 +123,9 @@ typedef enum { PRINTER_INFO_CHANGED = 3, } Print_PrinterEvent; -/** - * @brief Indicates paper size info. - * - * @since 12 - */ -typedef struct { - /** Paper id. */ - char *id; - /** Paper name. */ - char *name; - /** Paper width. */ - uint32_t width; - /** Paper height. */ - uint32_t height; - /** Paper left margin. */ - uint32_t leftMargin; - /** Paper top margin. */ - uint32_t topMargin; - /** Paper right margin. */ - uint32_t rightMargin; - /** Paper bottom margin. */ - uint32_t bottomMargin; -} Print_PageSize; - /** * @brief Indicates string list. - * + * * @since 12 */ typedef struct { @@ -159,105 +135,9 @@ typedef struct { char **list; } Print_StringList; -/** - * @brief Indicates printer capabilities. - * - * @since 12 - */ -typedef struct { - /** Support for color printing. */ - bool supportedColorMode; - /** Array of supported duplex printing modes. */ - uint32_t *supportedDuplexModes; - /** Number of supported duplex printing mode. */ - uint32_t supportedDuplexModesCount; - /** Array of supported print paper sizes. */ - Print_PageSize *supportedPageSizes; - /** Number of supported print paper sizes. */ - uint32_t supportedPageSizesCount; - /** Array of supported print media types. */ - uint32_t *supportedMediaTypes; - /** Number of supported print media types. */ - uint32_t supportedMediaTypesCount; - /** Array of supported print qulities. */ - uint32_t *supportedQualities; - /** Number of supported print qulities. */ - uint32_t supportedQualitiesCount; - /** Supported document handling in json format. */ - char *supportedDocumentHandling; - /** Supported media source in json format. */ - char *supportedMediaSource; - /** Supported copies. */ - uint32_t supportedCopies; - /** Default printer resolution. */ - char *supportedResolution; - /** Array of supported orientation. */ - uint32_t *supportedOrientation; - /** Number of supported orientation. */ - uint32_t supportedOrientationCount; - /** advanced capability in json format. */ - char *advanceCapability; -} Print_PrinterCapability; - -/** - * @brief Indicates current properties - * - * @since 12 - */ -typedef struct { - /** Default color mode. */ - uint32_t defaultColorMode; - /** Default sides. */ - uint32_t defaultSides; - /** Default media type. */ - char *defaultMediaType; - /** Default media source. */ - char *defaultMediaSource; - /** Default print quality */ - uint32_t defaultPrintQuality; - /** Default copies. */ - uint32_t defaultCopies; - /** Default printer resolution. */ - char *defaultPrinterResolution; - /** Default orientation. */ - uint32_t defaultOrientation; - /** Other default values in json format. */ - char *otherDefaultValues; -} Print_DefaultValue; - -/** - * @brief Indicates printer infomation. - * - * @since 12 - */ -typedef struct { - /** Printer state. */ - Print_PrinterState printerState; - /** Printer capabilities. */ - Print_PrinterCapability capability; - /** Printer current properties. */ - Print_DefaultValue defaultValue; - /** Default printer. */ - bool isDefaultPrinter; - /** Printer id. */ - char *printerId; - /** Printer name. */ - char *printerName; - /** Printer description. */ - char *description; - /** Printer location. */ - char *location; - /** Printer make and model infomation. */ - char *makeAndModel; - /** Printer Uri. */ - char *printerUri; - /** Detail infomation in json format. */ - char *detailInfo; -} Print_PrinterInfo; - /** * @brief Indicates printer property. - * + * * @since 12 */ typedef struct { @@ -269,7 +149,7 @@ typedef struct { /** * @brief List of printer properties. - * + * * @since 12 */ typedef struct { @@ -280,46 +160,50 @@ typedef struct { } Print_PropertyList; /** - * @brief Indicates PaperSource Mode. - * + * @brief Indicates print resolution in dpi unit. + * * @since 12 */ -typedef enum { - /** Auto paper source mode. */ - PAPER_SOURCE_MODE_AUTO = 6, - /** Cassette paper source mode. */ - PAPER_SOURCE_MODE_CASSETTE = 11, - /** Envelope paper source mode. */ - PAPER_SOURCE_MODE_ENVELOPE = 4, - /** Manual envelope paper source mode. */ - PAPER_SOURCE_MODE_ENVELOPE_MANUAL = 5, - /** Form source mode. */ - PAPER_SOURCE_MODE_FORM_SOURCE = 12, - /** Large capacity paper source mode. */ - PAPER_SOURCE_MODE_LARGE_CAPACITY = 10, - /** Large format paper source mode. */ - PAPER_SOURCE_MODE_LARGE_FORMAT = 9, - /** Lower paper source mode. */ - PAPER_SOURCE_MODE_LOWER = 1, - /** Last paper source mode. */ - PAPER_SOURCE_MODE_LAST_PAPER_SOURCE = 13, - /** Middle paper source mode. */ - PAPER_SOURCE_MODE_MIDDLE = 2, - /** Manual paper source mode. */ - PAPER_SOURCE_MODE_MANUAL = 3, - /** Only one paper source mode. */ - PAPER_SOURCE_MODE_ONLY_ONE = 0, - /** Tractor paper source mode. */ - PAPER_SOURCE_MODE_TRACTOR = 7, - /** Smarll format paper source mode. */ - PAPER_SOURCE_MODE_SMALL_FORMAT = 8, - /** Custom paper source mode. */ - PAPER_SOURCE_MODE_CUSTOM_SOURCE = 14, -} PrintJob_PaperSource; +typedef struct { + uint32_t horizontalDpi; + uint32_t verticalDpi; +} Print_Resolution; + +/** + * @brief Indicates printing margin + * + * @since 12 + */ +typedef struct { + /** Left margin. */ + uint32_t leftMargin; + /** Top margin. */ + uint32_t topMargin; + /** Right margin. */ + uint32_t rightMargin; + /** Bottom margin. */ + uint32_t bottomMargin; +} Print_Margin; + +/** + * @brief Indicates paper size info. + * + * @since 12 + */ +typedef struct { + /** Paper id. */ + char *id; + /** Paper name. */ + char *name; + /** Paper width. */ + uint32_t width; + /** Paper height. */ + uint32_t height; +} Print_PageSize; /** * @brief Indicates DuplexMode - * + * * @since 12 */ typedef enum { @@ -329,11 +213,11 @@ typedef enum { DUPLEX_MODE_TWO_SIDED_LONG_EDGE = 1, /** Short edge two sided duplex mode. */ DUPLEX_MODE_TWO_SIDED_SHORT_EDGE = 2, -} PrintJob_DuplexMode; +} Print_DuplexMode; /** * @brief Indicates ColorMode - * + * * @since 12 */ typedef enum { @@ -343,11 +227,11 @@ typedef enum { COLOR_MODE_COLOR = 1, /** Auto mode. */ COLOR_MODE_AUTO = 2, -} PrintJob_ColorMode; +} Print_ColorMode; /** * @brief Indicates OrientationMode - * + * * @since 12 */ typedef enum { @@ -355,117 +239,191 @@ typedef enum { ORIENTATION_MODE_PORTRAIT = 0, /** Landscape mode. */ ORIENTATION_MODE_LANDSCAPE = 1, -} PrintJob_OrientationMode; + /** Reverse landscape mode. */ + ORIENTATION_MODE_REVERSE_LANDSCAPE = 2, + /** Reverse portrait mode. */ + ORIENTATION_MODE_REVERSE_PORTRAIT = 3, + /** Not specified. */ + ORIENTATION_MODE_NONE = 4, +} Print_OrientationMode; /** - * @brief Indicates PageSize - * + * @brief Indicates printing qulity + * * @since 12 */ -typedef struct { - /** Paper id. */ - char *id; - /** Paper name. */ - char *name; - /** Paper width. */ - uint32_t width; - /** Paper height. */ - uint32_t height; -} PrintJob_PageSize; +typedef enum { + /** Draft quality mode */ + PRINT_QUALITY_DRAFT = 3, + /** Normal quality mode */ + PRINT_QUALITY_NORMAL = 4, + /** High quality mode */ + PRINT_QUALITY_HIGH = 5 +} Print_Quality; + +/** + * @brief Indicates the MIME media type of the document. + * + * @since 12 + */ +typedef enum { + /** MIME: application/octet-stream. */ + DOCUMENT_FORMAT_AUTO, + /** MIME: image/jpeg. */ + DOCUMENT_FORMAT_JPEG, + /** MIME: application/pdf. */ + DOCUMENT_FORMAT_PDF, + /** MIME: application/postscript. */ + DOCUMENT_FORMAT_POSTSCRIPT, + /** MIME: text/plain. */ + DOCUMENT_FORMAT_TEXT, +} Print_DocumentFormat; /** - * @brief Indicates PageRange - * + * @brief Indicates printer capabilities. + * * @since 12 */ typedef struct { - /** Start page. */ - uint32_t startPage; - /** End page. */ - uint32_t endPage; - /** Array of pages. */ - uint32_t *pages; - /** Number of pages. */ - uint32_t pagesCount; -} PrintJob_PageRange; + /** Array of supported color mode. */ + Print_ColorMode *supportedColorModes; + /** Number of supported color mode. */ + uint32_t supportedColorModesCount; + /** Array of supported duplex printing modes. */ + Print_DuplexMode *supportedDuplexModes; + /** Number of supported duplex printing mode. */ + uint32_t supportedDuplexModesCount; + /** Array of supported print paper sizes. */ + Print_PageSize *supportedPageSizes; + /** Number of supported print paper sizes. */ + uint32_t supportedPageSizesCount; + /** Supported print media types in json string array format. */ + char *supportedMediaTypes; + /** Array of supported print qulities. */ + Print_Quality *supportedQualities; + /** Number of supported print qulities. */ + uint32_t supportedQualitiesCount; + /** Supported paper sources in json string array format. */ + char *supportedPaperSources; + /** Supported copies. */ + uint32_t supportedCopies; + /** Array of supported printer resolutions. */ + Print_Resolution *supportedResolutions; + /** Number of supported printer resolutions. */ + uint32_t supportedResolutionsCount; + /** Array of supported orientation. */ + Print_OrientationMode *supportedOrientations; + /** Number of supported orientation. */ + uint32_t supportedOrientationsCount; + /** Advanced capability in json format. */ + char *advancedCapability; +} Print_PrinterCapability; /** - * @brief Indicates PrintMargin - * + * @brief Indicates current properties + * * @since 12 */ typedef struct { - /** top margin. */ - uint32_t topMargin; - /** bottom margin. */ - uint32_t bottomMargin; - /** left margin. */ - uint32_t leftMargin; - /** right margin. */ - uint32_t rightMargin; -} PrintJob_PrintMargin; + /** Default color mode. */ + Print_ColorMode defaultColorMode; + /** Default duplex mode. */ + Print_DuplexMode defaultDuplexMode; + /** Default media type. */ + char *defaultMediaType; + /** Default page size id. */ + char *defaultPageSizeId; + /** Default margin. */ + Print_Margin defaultMargin; + /** Default paper source. */ + char *defaultPaperSource; + /** Default print quality */ + Print_Quality defaultPrintQuality; + /** Default copies. */ + uint32_t defaultCopies; + /** Default printer resolution. */ + Print_Resolution defaultResolution; + /** Default orientation. */ + Print_OrientationMode defaultOrientation; + /** Other default values in json format. */ + char *otherDefaultValues; +} Print_DefaultValue; /** - * @brief Indicates PrintJob OptionObject. - * + * @brief Indicates printer infomation. + * * @since 12 */ typedef struct { - /** Job name. */ - char *jobName; - /** Media type. */ - char *mediaType; - /** Document category. */ - uint32_t documentCategory; - /** Print quality. */ - char *printQuality; + /** Printer state. */ + Print_PrinterState printerState; + /** Printer capabilities. */ + Print_PrinterCapability capability; + /** Printer current properties. */ + Print_DefaultValue defaultValue; + /** Default printer. */ + bool isDefaultPrinter; + /** Printer id. */ + char *printerId; /** Printer name. */ char *printerName; + /** Printer description. */ + char *description; + /** Printer location. */ + char *location; + /** Printer make and model infomation. */ + char *makeAndModel; /** Printer Uri. */ char *printerUri; - /** Document format. */ - char *documentFormat; - /** Advanced options in json format. */ - char *advanceOptions; -} PrintJob_OptionObject; + /** Detail infomation in json format. */ + char *detailInfo; +} Print_PrinterInfo; /** * @brief Indicates PrintJob Structure. - * + * * @since 12 */ typedef struct { + /** Job name. */ + char *jobName; /** Array of file descriptors to print. */ uint32_t *fdList; /** Number of file descriptors to print. */ uint32_t fdListCount; /** Printer id. */ char *printerId; - /** Print resolution in dpi. */ - uint32_t dpi; /** Number of copies printed. */ uint32_t copyNumber; /** Paper source. */ - PrintJob_PaperSource paperSource; - /** Paper size. */ - PrintJob_PageSize pageSize; + char *paperSource; + /** Media type. */ + char *mediaType; + /** Paper size id. */ + char *pageSizeId; /** Color mode. */ - PrintJob_ColorMode colorMode; + Print_ColorMode colorMode; /** Duplex source. */ - PrintJob_DuplexMode duplexMode; - /** Page range. */ - PrintJob_PageRange pageRange; + Print_DuplexMode duplexMode; + /** Print resolution in dpi. */ + Print_Resolution resolution; /** Print margin. */ - PrintJob_PrintMargin printMargin; + Print_Margin printMargin; + /** Borderless. */ + bool borderless; /** Orientation mode. */ - PrintJob_OrientationMode orientationMode; - /** Print option. */ - PrintJob_OptionObject printOption; + Print_OrientationMode orientationMode; + /** Print quality. */ + Print_Quality printQuality; + /** Document format. */ + Print_DocumentFormat documentFormat; + /** Advanced options in json format. */ + char *advancedOptions; } Print_PrintJob; /** * @brief Printer change callback. - * + * * @since 12 */ typedef void (*Print_PrinterChangeCallback)(uint32_t event, const Print_PrinterInfo *printerInfo); diff --git a/print/print_fwk/include/print_capi.h b/print/print_fwk/include/print_capi.h index 34b22a1e8..b385060fd 100644 --- a/print/print_fwk/include/print_capi.h +++ b/print/print_fwk/include/print_capi.h @@ -49,7 +49,7 @@ extern "C" { /** * @brief This API checks and pulls up the print service, initializes the print client, * and establishes a connection to the print service. - * + * * @permission {@code ohos.permission.PRINT} * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. @@ -61,7 +61,7 @@ int32_t OH_Print_Init(); /** * @brief This API closes the connection from the print service, dissolves the previous callback, * and releases the print client resources. - * + * * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. * @syscap SystemCapability.Print.PrintFramework @@ -71,7 +71,7 @@ int32_t OH_Print_Release(); /** * @brief This API starts discovering printers. - * + * * @permission {@code ohos.permission.PRINT} * @param callback The {@link Print_PrinterChangeCallback} of printer discovery event. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -83,7 +83,7 @@ int32_t OH_Print_StartPrinterDiscovery(Print_PrinterChangeCallback callback); /** * @brief This API stops discovering printers. - * + * * @permission {@code ohos.permission.PRINT} * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. @@ -94,7 +94,7 @@ int32_t OH_Print_StopPrinterDiscovery(); /** * @brief This API connects to the printer using the printer id. - * + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be connected. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -106,7 +106,7 @@ int32_t OH_Print_ConnectPrinter(const char *printerId); /** * @brief This API starts initiating a print job. - * + * * @permission {@code ohos.permission.PRINT} * @param printJob A pointer to a {@link Print_PrintJob} instance that specifies the information for the print job. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -118,7 +118,7 @@ int32_t OH_Print_StartPrintJob(const Print_PrintJob *printJob); /** * @brief This API registers the callback for printer changes. - * + * * @permission {@code ohos.permission.PRINT} * @param callback The {@link Print_PrinterChangeCallback} to be registered. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -130,7 +130,7 @@ int32_t OH_Print_RegisterPrinterChangeListener(Print_PrinterChangeCallback callb /** * @brief This API unregisters the callback for printer changes. - * + * * @permission {@code ohos.permission.PRINT} * @syscap SystemCapability.Print.PrintFramework * @since 12 @@ -139,7 +139,7 @@ void OH_Print_UnregisterPrinterChangeListener(); /** * @brief This API queries for a list of added printers. - * + * * @permission {@code ohos.permission.PRINT} * @param printerIdList A pointer to a {@link Print_StringList} instance to store the queried printer id list. * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, @@ -151,7 +151,7 @@ int32_t OH_Print_QueryPrinterList(Print_StringList *printerIdList); /** * @brief This API frees up the printer list memory for the query. - * + * * @param printerIdList The queried printer id list to be released. * @syscap SystemCapability.Print.PrintFramework * @since 12 @@ -160,7 +160,7 @@ void OH_Print_ReleasePrinterList(Print_StringList *printerIdList); /** * @brief This API queries printer information based on the printer id. - * + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be queried. * @param printerInfo A pointer to a {@link Print_PrinterInfo} pointer to store the printer infomation. @@ -173,7 +173,7 @@ int32_t OH_Print_QueryPrinterInfo(const char *printerId, Print_PrinterInfo **pri /** * @brief This API frees up the printer infomation memory for the query. - * + * * @param printerInfo The pointer of the queried printer infomation to be released. * @syscap SystemCapability.Print.PrintFramework * @since 12 @@ -182,7 +182,7 @@ void OH_Print_ReleasePrinterInfo(Print_PrinterInfo *printerInfo); /** * @brief This API launches the system's printer management window. - * + * * @return Returns {@link Print_ErrorCode#PRINT_ERROR_NONE} if the execution is successful, * otherwise returns a specific error code, refer to {@link Print_ErrorCode}. * @syscap SystemCapability.Print.PrintFramework @@ -192,7 +192,7 @@ int32_t OH_Print_LaunchPrinterManager(); /** * @brief This API queries the corresponding printer property values based on the list of property keywords. - * + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be queried. * @param propertyKeyList The list of property keywords to be queried @@ -207,7 +207,7 @@ int32_t OH_Print_QueryPrinterProperties(const char *printerId, const Print_Strin /** * @brief This API frees up the property list memory for the query. - * + * * @param propertyList The pointer of the queried printer property values to be released. * @syscap SystemCapability.Print.PrintFramework * @since 12 @@ -216,7 +216,7 @@ void OH_Print_ReleasePrinterProperties(Print_PropertyList *propertyList); /** * @brief This API sets printer properties based on a list of property key-value pairs. - * + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be set. * @param propertyList The list of printer property values to be set. @@ -229,7 +229,7 @@ int32_t OH_Print_UpdatePrinterProperties(const char *printerId, const Print_Prop /** * @brief This API restores printer properties to default settings based on the list of property keywords. - * + * * @permission {@code ohos.permission.PRINT} * @param printerId The id of the printer to be restored. * @param propertyKeyList The list of property keywords to be restored. -- Gitee