显示两台一样的打印机 Signed-off-by:baozewei@huawei.com

Signed-off-by: b30052170 <baozewei@huawei.com>
This commit is contained in:
b30052170 2024-10-04 16:45:21 +08:00
parent 9f7b864317
commit 3104d02926
12 changed files with 33 additions and 11 deletions

View File

@ -13,11 +13,13 @@
import("//base/print/print_fwk/print.gni")
import("//build/ohos.gni")
cflags_cc = []
config("print_interfaces_kits_napi_config") {
visibility = [ ":*" ]
include_dirs = [ "include" ]
cflags_cc = [ "-fno-exceptions" ]
cflags_cc += [ "-fno-exceptions" ]
}
ohos_shared_library("print_helper") {
include_dirs = [

View File

@ -13,11 +13,13 @@
import("//base/print/print_fwk/print.gni")
import("//build/ohos.gni")
cflags_cc = []
config("scan_interfaces_kits_napi_config") {
visibility = [ ":*" ]
include_dirs = [ "include" ]
cflags_cc = [ "-fno-exceptions" ]
cflags_cc += [ "-fno-exceptions" ]
}
ohos_shared_library("scan_helper") {
include_dirs = [

View File

@ -13,11 +13,13 @@
import("//base/print/print_fwk/print.gni")
import("//build/ohos.gni")
cflags_cc = []
config("scan_interfaces_kits_napi_config") {
visibility = [ ":*" ]
include_dirs = [ "include" ]
cflags_cc = [ "-fno-exceptions" ]
cflags_cc += [ "-fno-exceptions" ]
}
ohos_shared_library("scan_client") {

View File

@ -14,6 +14,8 @@
import("//base/print/print_fwk/print.gni")
import("//build/ohos.gni")
cflags_cc = []
config("ability_config") {
visibility = [ ":*" ]
include_dirs = [
@ -42,7 +44,7 @@ config("ability_public_config") {
"//third_party/json/include",
]
cflags_cc = [ "-fno-exceptions" ]
cflags_cc += [ "-fno-exceptions" ]
}
ohos_shared_library("print_extension_framework") {

View File

@ -13,11 +13,13 @@
import("//base/print/print_fwk/print.gni")
import("//build/ohos.gni")
cflags_cc = []
config("print_models_config") {
visibility = [ ":*" ]
include_dirs = [ "include" ]
cflags_cc = [ "-fexceptions" ]
cflags_cc += [ "-fexceptions" ]
}
ohos_shared_library("print_models") {
include_dirs = [ "${print_utils_path}/include" ]

View File

@ -13,11 +13,13 @@
import("//base/print/print_fwk/print.gni")
import("//build/ohos.gni")
cflags_cc = []
config("print_ndk_config") {
visibility = [ ":*" ]
include_dirs = []
cflags_cc = [ "-fno-exceptions" ]
cflags_cc += [ "-fno-exceptions" ]
}
ohos_shared_library("ohprint") {
include_dirs = [

View File

@ -13,11 +13,13 @@
import("//base/print/print_fwk/print.gni")
import("//build/ohos.gni")
cflags_cc = []
config("scan_ndk_config") {
visibility = [ ":*" ]
include_dirs = []
cflags_cc = [ "-fno-exceptions" ]
cflags_cc += [ "-fno-exceptions" ]
}
ohos_shared_library("ohscan") {

View File

@ -55,7 +55,7 @@ ohos_shared_library("printextensionability_napi") {
external_deps = [ "napi:ace_napi" ]
if (build_variant == "user") {
cflags_cc += [ "-DIS_RELEASE_VERSION" ]
cflags_cc = [ "-DIS_RELEASE_VERSION" ]
}
relative_install_dir = "module/app/ability"

View File

@ -55,7 +55,7 @@ ohos_shared_library("printextensioncontext_napi") {
external_deps = [ "napi:ace_napi" ]
if (build_variant == "user") {
cflags_cc += [ "-DIS_RELEASE_VERSION" ]
cflags_cc = [ "-DIS_RELEASE_VERSION" ]
}
relative_install_dir = "module"

View File

@ -398,7 +398,7 @@ napi_value NapiPrintExt::QueryPrinterCapabilityByUri(napi_env env, napi_callback
PRINT_ASSERT_BASE(env, valuetype == napi_string, "printerId is not a string", napi_string_expected);
std::string printerId = NapiPrintUtils::GetStringFromValueUtf8(env, argv[NapiPrintUtils::INDEX_ONE]);
PRINT_HILOGD("printerId : %{private}s", printerUri.c_str());
PRINT_HILOGD("printerId : %{private}s", printerId.c_str());
context->printerId = printerId;
}
return napi_ok;

View File

@ -13,11 +13,13 @@
import("//base/print/print_fwk/print.gni")
import("//build/ohos.gni")
cflags_cc = []
config("scan_interfaces_kits_napi_config") {
visibility = [ ":*" ]
include_dirs = [ "include" ]
cflags_cc = [ "-fexceptions" ]
cflags_cc += [ "-fexceptions" ]
}
ohos_shared_library("scan_napi") {

View File

@ -1544,6 +1544,12 @@ bool PrintServiceAbility::UpdatePrinterCapability(const std::string &printerId,
info.GetCapability(printerCaps);
WriteEprinterPreference(printerId, printerCaps);
}
if (printSystemData_.IsPrinterAdded(printerId)) {
PRINT_HILOGE("This printer has been added.");
return false;
}
CupsPrinterInfo cupsPrinterInfo;
auto output = info;
cupsPrinterInfo.name = info.GetPrinterName();