mirror of
https://gitee.com/openharmony/print_print_fwk
synced 2024-11-23 08:59:47 +00:00
Add seventh 0907 code
Signed-off-by: @chuangda_1 <fangwanning@huawei.com>
This commit is contained in:
parent
7f4325dc29
commit
a7a1b844ef
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"vector": "cpp"
|
||||
}
|
||||
}
|
@ -81,7 +81,7 @@ bool PrintExtensionCallbackStub::OnCallback(uint32_t printerId, MessageParcel &r
|
||||
capability.ConvertToParcel(reply);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,7 @@
|
||||
|
||||
namespace OHOS::Print {
|
||||
PrintExtensionInfo::PrintExtensionInfo()
|
||||
: extensionId_(0), vendorId_(0), vendorName_("PrintExtensionInfo"), vendorIcon_(0),
|
||||
version_("PrintExtensionInfo")
|
||||
: extensionId_(0), vendorId_(0), vendorName_("PrintExtensionInfo"), vendorIcon_(0), version_("PrintExtensionInfo")
|
||||
{}
|
||||
|
||||
void PrintExtensionInfo::SetExtensionId(uint32_t extensionId)
|
||||
|
@ -411,7 +411,7 @@ void PrintJob::ConvertToJs(napi_env env, napi_value *result) const
|
||||
napi_value preview;
|
||||
napi_create_object(env, &preview);
|
||||
NapiPrintUtils::SetStringPropertyUtf8(env, preview, "result", preview_.GetResult().c_str());
|
||||
|
||||
|
||||
napi_value subPageRange;
|
||||
napi_create_object(env, &subPageRange);
|
||||
SetSubPageRange(env, subPageRange);
|
||||
|
@ -369,7 +369,7 @@ bool PrintManagerClient::CancelPrintJob(const PrintJob &jobinfo)
|
||||
}
|
||||
PRINT_HILOGD("PrintManagerClient CancelPrintJob succeeded.");
|
||||
return printServiceProxy_->CancelPrintJob(jobinfo);
|
||||
}
|
||||
}
|
||||
|
||||
bool PrintManagerClient::AddPrinters(std::vector<PrinterInfo> arrayPrintInfo)
|
||||
{
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "print_resolution.h"
|
||||
|
||||
#include "print_log.h"
|
||||
|
||||
namespace OHOS::Print {
|
||||
|
@ -13,11 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "print_service_proxy.h"
|
||||
#include "napi_print_utils.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "iremote_broker.h"
|
||||
#include "napi_print_utils.h"
|
||||
#include "print_common.h"
|
||||
#include "print_job.h"
|
||||
#include "print_log.h"
|
||||
@ -264,6 +265,7 @@ bool PrintServiceProxy::QueryPrinterCapability(uint32_t printerId, PrinterCapabi
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(PrintServiceProxy::GetDescriptor());
|
||||
PRINT_HILOGD("printerId : %{public}d", printerId);
|
||||
data.WriteUint32(printerId);
|
||||
PRINT_HILOGD("PrintServiceProxy ChangeTaskPriority started.");
|
||||
bool ret = Remote()->SendRequest(CMD_QUERYPRINTERCAPABILITY, data, reply, option);
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include <memory>
|
||||
|
||||
#include "ability_connect_callback.h"
|
||||
#include "print_extension_context.h"
|
||||
#include "event_handler.h"
|
||||
#include "print_extension_context.h"
|
||||
|
||||
class NativeEngine;
|
||||
class NativeValue;
|
||||
@ -28,9 +28,8 @@ class NativeReference;
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
NativeValue* CreateJsPrintExtensionContext(NativeEngine& engine,
|
||||
std::shared_ptr<PrintExtensionContext> context);
|
||||
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
#endif // JS_PRINT_EXTENSION_CONTEXT_H
|
||||
NativeValue *CreateJsPrintExtensionContext(NativeEngine &engine, std::shared_ptr<PrintExtensionContext> context);
|
||||
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
#endif // JS_PRINT_EXTENSION_CONTEXT_H
|
@ -27,9 +27,9 @@
|
||||
#include "napi_common_want.h"
|
||||
#include "napi_print_utils.h"
|
||||
#include "napi_remote_object.h"
|
||||
#include "print_log.h"
|
||||
#include "print_manager_client.h"
|
||||
#include "printer_capability.h"
|
||||
#include "print_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
@ -340,26 +340,26 @@ void JsPrintExtension::RegisterAllCallback()
|
||||
callback->Exec(value, "onCancelPrintJob", arg, NapiPrintUtils::ARGC_ONE);
|
||||
return true;
|
||||
});
|
||||
PrintManagerClient::GetInstance()->RegisterExtCallback(PRINT_EXTCB_REQUEST_CAP,
|
||||
[](uint32_t printId, PrinterCapability &cap) -> bool {
|
||||
PRINT_HILOGD("Request Capability");
|
||||
HandleScope handleScope(jsExtension_->jsRuntime_);
|
||||
NativeEngine *nativeEng = &(jsExtension_->jsRuntime_).GetNativeEngine();
|
||||
napi_value jsPrintId =
|
||||
OHOS::AppExecFwk::WrapInt32ToJS(reinterpret_cast<napi_env>(nativeEng), static_cast<int32_t>(printId));
|
||||
NativeValue *nativePrintId = reinterpret_cast<NativeValue *>(jsPrintId);
|
||||
NativeValue *arg[] = { nativePrintId };
|
||||
auto callback = std::make_shared<JsPrintCallback>(jsExtension_->jsRuntime_);
|
||||
NativeValue *value = jsExtension_->jsObj_->Get();
|
||||
NativeValue* result = callback->Exec(value, "onRequestPrinterCapability", arg, NapiPrintUtils::ARGC_ONE);
|
||||
if (result != nullptr) {
|
||||
PRINT_HILOGD("Request Capability Success");
|
||||
cap.BuildFromJs(reinterpret_cast<napi_env>(nativeEng), reinterpret_cast<napi_value>(result));
|
||||
return true;
|
||||
}
|
||||
PRINT_HILOGD("Request Capability Failed!!!");
|
||||
return false;
|
||||
});
|
||||
PrintManagerClient::GetInstance()->RegisterExtCallback(
|
||||
PRINT_EXTCB_REQUEST_CAP, [](uint32_t printId, PrinterCapability &cap) -> bool {
|
||||
PRINT_HILOGD("Request Capability");
|
||||
HandleScope handleScope(jsExtension_->jsRuntime_);
|
||||
NativeEngine *nativeEng = &(jsExtension_->jsRuntime_).GetNativeEngine();
|
||||
napi_value jsPrintId =
|
||||
OHOS::AppExecFwk::WrapInt32ToJS(reinterpret_cast<napi_env>(nativeEng), static_cast<int32_t>(printId));
|
||||
NativeValue *nativePrintId = reinterpret_cast<NativeValue *>(jsPrintId);
|
||||
NativeValue *arg[] = { nativePrintId };
|
||||
auto callback = std::make_shared<JsPrintCallback>(jsExtension_->jsRuntime_);
|
||||
NativeValue *value = jsExtension_->jsObj_->Get();
|
||||
NativeValue *result = callback->Exec(value, "onRequestPrinterCapability", arg, NapiPrintUtils::ARGC_ONE);
|
||||
if (result != nullptr) {
|
||||
PRINT_HILOGD("Request Capability Success");
|
||||
cap.BuildFromJs(reinterpret_cast<napi_env>(nativeEng), reinterpret_cast<napi_value>(result));
|
||||
return true;
|
||||
}
|
||||
PRINT_HILOGD("Request Capability Failed!!!");
|
||||
return false;
|
||||
});
|
||||
PrintManagerClient::GetInstance()->RegisterExtCallback(
|
||||
PRINT_EXTCB_REQUEST_PREVIEW, [](const PrintJob &job) -> bool {
|
||||
PRINT_HILOGD("Requet preview");
|
||||
|
@ -14,19 +14,20 @@
|
||||
*/
|
||||
|
||||
#include "js_print_extension_context.h"
|
||||
|
||||
#include "js_data_struct_converter.h"
|
||||
#include "js_extension_context.h"
|
||||
#include "js_print_extension_connection.h"
|
||||
#include "js_data_struct_converter.h"
|
||||
#include "js_runtime.h"
|
||||
#include "js_runtime_utils.h"
|
||||
#include "napi/native_api.h"
|
||||
#include "napi_common_want.h"
|
||||
#include "napi_common_util.h"
|
||||
#include "napi_remote_object.h"
|
||||
#include "napi_common_start_options.h"
|
||||
#include "start_options.h"
|
||||
#include "napi_common_util.h"
|
||||
#include "napi_common_want.h"
|
||||
#include "napi_print_utils.h"
|
||||
#include "napi_remote_object.h"
|
||||
#include "print_log.h"
|
||||
#include "start_options.h"
|
||||
|
||||
using namespace OHOS::Print;
|
||||
|
||||
@ -86,9 +87,8 @@ private:
|
||||
{
|
||||
PRINT_HILOGD("OnStartAbility is called");
|
||||
// only support one or two or three params
|
||||
if (info.argc != NapiPrintUtils::ARGC_ONE
|
||||
&& info.argc != NapiPrintUtils::ARGC_TWO
|
||||
&& info.argc != NapiPrintUtils::ARGC_THREE) {
|
||||
if (info.argc != NapiPrintUtils::ARGC_ONE && info.argc != NapiPrintUtils::ARGC_TWO &&
|
||||
info.argc != NapiPrintUtils::ARGC_THREE) {
|
||||
PRINT_HILOGE("Not enough params");
|
||||
return engine.CreateUndefined();
|
||||
}
|
||||
@ -97,9 +97,7 @@ private:
|
||||
AAFwk::Want want;
|
||||
OHOS::AppExecFwk::UnwrapWant(reinterpret_cast<napi_env>(&engine),
|
||||
reinterpret_cast<napi_value>(info.argv[NapiPrintUtils::INDEX_ZERO]), want);
|
||||
PRINT_HILOGD("%{public}s bundlename:%{public}s abilityname:%{public}s",
|
||||
__func__,
|
||||
want.GetBundle().c_str(),
|
||||
PRINT_HILOGD("%{public}s bundlename:%{public}s abilityname:%{public}s", __func__, want.GetBundle().c_str(),
|
||||
want.GetElement().GetAbilityName().c_str());
|
||||
unwrapArgc++;
|
||||
|
||||
@ -142,9 +140,8 @@ private:
|
||||
{
|
||||
PRINT_HILOGD("OnStartAbilityWithAccount is called");
|
||||
// only support two or three or four params
|
||||
if (info.argc != NapiPrintUtils::ARGC_TWO
|
||||
&& info.argc != NapiPrintUtils::ARGC_THREE
|
||||
&& info.argc != NapiPrintUtils::ARGC_FOUR) {
|
||||
if (info.argc != NapiPrintUtils::ARGC_TWO && info.argc != NapiPrintUtils::ARGC_THREE &&
|
||||
info.argc != NapiPrintUtils::ARGC_FOUR) {
|
||||
PRINT_HILOGE("Not enough params");
|
||||
return engine.CreateUndefined();
|
||||
}
|
||||
@ -153,15 +150,13 @@ private:
|
||||
AAFwk::Want want;
|
||||
OHOS::AppExecFwk::UnwrapWant(reinterpret_cast<napi_env>(&engine),
|
||||
reinterpret_cast<napi_value>(info.argv[NapiPrintUtils::INDEX_ZERO]), want);
|
||||
PRINT_HILOGD("%{public}s bundlename:%{public}s abilityname:%{public}s",
|
||||
__func__,
|
||||
want.GetBundle().c_str(),
|
||||
PRINT_HILOGD("%{public}s bundlename:%{public}s abilityname:%{public}s", __func__, want.GetBundle().c_str(),
|
||||
want.GetElement().GetAbilityName().c_str());
|
||||
unwrapArgc++;
|
||||
|
||||
int32_t accountId = 0;
|
||||
if (!OHOS::AppExecFwk::UnwrapInt32FromJS2(reinterpret_cast<napi_env>(&engine),
|
||||
reinterpret_cast<napi_value>(info.argv[NapiPrintUtils::INDEX_ONE]), accountId)) {
|
||||
reinterpret_cast<napi_value>(info.argv[NapiPrintUtils::INDEX_ONE]), accountId)) {
|
||||
PRINT_HILOGD("%{public}s called, the second parameter is invalid.", __func__);
|
||||
return engine.CreateUndefined();
|
||||
}
|
||||
@ -187,8 +182,9 @@ private:
|
||||
}
|
||||
|
||||
ErrCode errcode = ERR_OK;
|
||||
(unwrapArgc == NapiPrintUtils::ARGC_TWO) ? errcode = context->StartAbilityWithAccount(want, accountId)
|
||||
: errcode = context->StartAbilityWithAccount(want, accountId, startOptions);
|
||||
(unwrapArgc == NapiPrintUtils::ARGC_TWO)
|
||||
? errcode = context->StartAbilityWithAccount(want, accountId)
|
||||
: errcode = context->StartAbilityWithAccount(want, accountId, startOptions);
|
||||
if (errcode == 0) {
|
||||
task.Resolve(engine, engine.CreateUndefined());
|
||||
} else {
|
||||
@ -230,8 +226,8 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
NativeValue *lastParam =
|
||||
(info.argc == NapiPrintUtils::ARGC_ZERO) ? nullptr : info.argv[NapiPrintUtils::INDEX_ZERO];
|
||||
NativeValue *lastParam =
|
||||
(info.argc == NapiPrintUtils::ARGC_ZERO) ? nullptr : info.argv[NapiPrintUtils::INDEX_ZERO];
|
||||
NativeValue *result = nullptr;
|
||||
AsyncTask::Schedule("PrintExtensionContext::OnTerminateAbility", engine,
|
||||
CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
|
||||
@ -299,14 +295,13 @@ private:
|
||||
|
||||
// unwrap want
|
||||
AAFwk::Want want;
|
||||
OHOS::AppExecFwk::UnwrapWant(
|
||||
reinterpret_cast<napi_env>(&engine), reinterpret_cast<napi_value>(info.argv[NapiPrintUtils::INDEX_ZERO]), want);
|
||||
PRINT_HILOGD("%{public}s bundlename:%{public}s abilityname:%{public}s", __func__,
|
||||
want.GetBundle().c_str(),want.GetElement().GetAbilityName().c_str());
|
||||
OHOS::AppExecFwk::UnwrapWant(reinterpret_cast<napi_env>(&engine),
|
||||
reinterpret_cast<napi_value>(info.argv[NapiPrintUtils::INDEX_ZERO]), want);
|
||||
PRINT_HILOGD("%{public}s bundlename:%{public}s abilityname:%{public}s", __func__, want.GetBundle().c_str(),
|
||||
want.GetElement().GetAbilityName().c_str());
|
||||
|
||||
int32_t accountId = 0;
|
||||
if (!OHOS::AppExecFwk::UnwrapInt32FromJS2(
|
||||
reinterpret_cast<napi_env>(&engine),
|
||||
if (!OHOS::AppExecFwk::UnwrapInt32FromJS2(reinterpret_cast<napi_env>(&engine),
|
||||
reinterpret_cast<napi_value>(info.argv[NapiPrintUtils::INDEX_ONE]), accountId)) {
|
||||
PRINT_HILOGD("%{public}s called, the second parameter is invalid.", __func__);
|
||||
return engine.CreateUndefined();
|
||||
@ -397,8 +392,8 @@ private:
|
||||
: task.Reject(engine, CreateJsError(engine, errcode, "Disconnect Ability failed."));
|
||||
};
|
||||
|
||||
NativeValue *lastParam = (info.argc ==
|
||||
NapiPrintUtils::ARGC_ONE) ? nullptr : info.argv[NapiPrintUtils::INDEX_ONE];
|
||||
NativeValue *lastParam =
|
||||
(info.argc == NapiPrintUtils::ARGC_ONE) ? nullptr : info.argv[NapiPrintUtils::INDEX_ONE];
|
||||
NativeValue *result = nullptr;
|
||||
AsyncTask::Schedule("PrintExtensionContext::OnDisconnectAbility", engine,
|
||||
CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
|
||||
@ -486,8 +481,7 @@ NativeValue *CreateJsPrintExtensionContext(NativeEngine &engine, std::shared_ptr
|
||||
BindNativeFunction(engine, *object, "terminateSelf", JsPrintExtensionContext::TerminateAbility);
|
||||
BindNativeFunction(engine, *object, "connectAbility", JsPrintExtensionContext::ConnectAbility);
|
||||
BindNativeFunction(engine, *object, "disconnectAbility", JsPrintExtensionContext::DisconnectAbility);
|
||||
BindNativeFunction(
|
||||
engine, *object, "startAbilityWithAccount", JsPrintExtensionContext::StartAbilityWithAccount);
|
||||
BindNativeFunction(engine, *object, "startAbilityWithAccount", JsPrintExtensionContext::StartAbilityWithAccount);
|
||||
BindNativeFunction(
|
||||
engine, *object, "connectAbilityWithAccount", JsPrintExtensionContext::ConnectAbilityWithAccount);
|
||||
#endif
|
||||
@ -512,5 +506,5 @@ NativeValue *CreateJsPrintExtensionContext(NativeEngine &engine, std::shared_ptr
|
||||
|
||||
return objValue;
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
@ -43,8 +43,9 @@ public:
|
||||
|
||||
static bool ParseInfoParam(napi_env env, napi_value InfoValue, PrinterInfo &info);
|
||||
static bool ParseCapParam(napi_env env, napi_value InfoValue, PrinterCapability &capability);
|
||||
static bool ParseArrPrintResolution(napi_env env, napi_value capValue, PrinterCapability &capability)
|
||||
static bool ParsePageSizeParam(napi_env env, napi_value capValue, PrintPageSize &PrintPageSize);
|
||||
static bool ParseArrPrintResolution(
|
||||
napi_env env, napi_value capValue, PrinterCapability &capability) static bool ParsePageSizeParam(napi_env env,
|
||||
napi_value capValue, PrintPageSize &PrintPageSize);
|
||||
static bool ParseResolutionParam(napi_env env, napi_value reValue, PrintResolution &PrintResolution);
|
||||
static bool ParseMarginParam(napi_env env, napi_value marginValue, PrintMargin &PrintMargin);
|
||||
static bool ParseJobParam(napi_env env, napi_value jobValue, PrintJob &printJob);
|
||||
|
@ -47,7 +47,7 @@ napi_value NapiInnerPrint::QueryExtensionInfo(napi_env env, napi_callback_info i
|
||||
for (uint32_t i = 0; i < extInfoLength; i++) {
|
||||
PRINT_HILOGD("ExtInfo, ExtensionId = %{public}d", context->arrExtInfo[i].GetExtensionId());
|
||||
PRINT_HILOGD("ExtInfo, VendorId = %{public}d", context->arrExtInfo[i].GetVendorId());
|
||||
PRINT_HILOGD("ExtInfo, VendorName = %{public}s",context->arrExtInfo[i].GetVendorName().c_str());
|
||||
PRINT_HILOGD("ExtInfo, VendorName = %{public}s", context->arrExtInfo[i].GetVendorName().c_str());
|
||||
PRINT_HILOGD("ExtInfo, VendorIcon = %{public}d", context->arrExtInfo[i].GetVendorIcon());
|
||||
PRINT_HILOGD("ExtInfo, Version = %{public}s", context->arrExtInfo[i].GetVersion().c_str());
|
||||
|
||||
@ -55,9 +55,11 @@ napi_value NapiInnerPrint::QueryExtensionInfo(napi_env env, napi_callback_info i
|
||||
napi_create_object(env, &PrinterInfo);
|
||||
NapiPrintUtils::SetUint32Property(env, PrinterInfo, "extensionId", context->arrExtInfo[i].GetExtensionId());
|
||||
NapiPrintUtils::SetUint32Property(env, PrinterInfo, "vendorId", context->arrExtInfo[i].GetVendorId());
|
||||
NapiPrintUtils::SetStringPropertyUtf8(env, PrinterInfo, "vendorName", context->arrExtInfo[i].GetVendorName().c_str());
|
||||
NapiPrintUtils::SetStringPropertyUtf8(
|
||||
env, PrinterInfo, "vendorName", context->arrExtInfo[i].GetVendorName().c_str());
|
||||
NapiPrintUtils::SetUint32Property(env, PrinterInfo, "vendorIcon", context->arrExtInfo[i].GetVendorIcon());
|
||||
NapiPrintUtils::SetStringPropertyUtf8(env, PrinterInfo, "version", context->arrExtInfo[i].GetVersion().c_str());
|
||||
NapiPrintUtils::SetStringPropertyUtf8(
|
||||
env, PrinterInfo, "version", context->arrExtInfo[i].GetVersion().c_str());
|
||||
status = napi_set_element(env, *result, i, PrinterInfo);
|
||||
}
|
||||
return napi_ok;
|
||||
@ -264,6 +266,8 @@ napi_value NapiInnerPrint::StartPrintJob(napi_env env, napi_callback_info info)
|
||||
return status;
|
||||
};
|
||||
auto exec = [context](AsyncCall::Context *ctx) {
|
||||
PRINT_HILOGD("exec----");
|
||||
context->printStartJob.Dump();
|
||||
context->result = PrintManagerClient::GetInstance()->StartPrintJob(context->printStartJob);
|
||||
if (context->result == true) {
|
||||
context->status = napi_ok;
|
||||
@ -303,6 +307,8 @@ napi_value NapiInnerPrint::CancelPrintJob(napi_env env, napi_callback_info info)
|
||||
return status;
|
||||
};
|
||||
auto exec = [context](AsyncCall::Context *ctx) {
|
||||
PRINT_HILOGD("exec----");
|
||||
context->printCancelJob.Dump();
|
||||
context->result = PrintManagerClient::GetInstance()->CancelPrintJob(context->printCancelJob);
|
||||
if (context->result == true) {
|
||||
context->status = napi_ok;
|
||||
@ -342,6 +348,8 @@ napi_value NapiInnerPrint::RequestPreview(napi_env env, napi_callback_info info)
|
||||
return status;
|
||||
};
|
||||
auto exec = [context](AsyncCall::Context *ctx) {
|
||||
PRINT_HILOGD("exec----");
|
||||
context->printReqPreviewJob.Dump();
|
||||
context->result =
|
||||
PrintManagerClient::GetInstance()->RequestPreview(context->printReqPreviewJob, context->previewResult);
|
||||
if (context->result == true) {
|
||||
|
@ -172,10 +172,8 @@ bool PrintParseType::ParseJob(napi_env env, napi_value jobValue, PrintJob &print
|
||||
PRINT_HILOGD("printJob_value GetPrinterId value is %{public}d", printJob.GetPrinterId());
|
||||
PRINT_HILOGD("printJob_value GetJobState value is %{public}d", printJob.GetJobState());
|
||||
PRINT_HILOGD("printJob_value GetCopyNumber value is %{public}d", printJob.GetCopyNumber());
|
||||
PRINT_HILOGD(
|
||||
"printJob_value SetIsLandscape value is %{public}s", printJob.GetIsLandscape() ? "true" : "false");
|
||||
PRINT_HILOGD(
|
||||
"printJob_value SetIsLandscape value is %{public}s", printJob.GetIsLandscape() ? "true" : "false");
|
||||
PRINT_HILOGD("printJob_value SetIsLandscape value is %{public}s", printJob.GetIsLandscape() ? "true" : "false");
|
||||
PRINT_HILOGD("printJob_value SetIsLandscape value is %{public}s", printJob.GetIsLandscape() ? "true" : "false");
|
||||
PRINT_HILOGD("printJob_value ColorMode value is %{public}d", printJob.GetIsSequential());
|
||||
PRINT_HILOGD("printJob_value DuplexMode value is %{public}d", printJob.GetDuplexMode());
|
||||
return true;
|
||||
@ -290,7 +288,7 @@ bool PrintParseType::ParseCapParam(napi_env env, napi_value capValue, PrinterCap
|
||||
capability.SetPageSize(pageSizeList);
|
||||
}
|
||||
|
||||
if(!ParseArrPrintResolution(env, capValue, capability)){
|
||||
if (!ParseArrPrintResolution(env, capValue, capability)) {
|
||||
PRINT_HILOGD("error Arr PrintResolution");
|
||||
return false;
|
||||
}
|
||||
@ -343,7 +341,7 @@ bool PrintParseType::ParseArrPrintResolution(napi_env env, napi_value capValue,
|
||||
bool PrintParseType::ParsePageSizeParam(napi_env env, napi_value capValue, PrintPageSize &pageSize)
|
||||
{
|
||||
napi_value param_one = NapiPrintUtils::GetNamedProperty(env, capValue, PARAM_PAGESIZE_ID);
|
||||
if (NapiPrintUtils::GetValueType(env, param_one) != napi_number) {
|
||||
if (NapiPrintUtils::GetValueType(env, param_one) != napi_string) {
|
||||
PRINT_HILOGD("error param_one");
|
||||
return false;
|
||||
}
|
||||
@ -535,7 +533,7 @@ bool PrintParseType::ParseHasObj(napi_env env, napi_value jobValue, PrintJob &pr
|
||||
|
||||
bool PrintParseType::ParseJobParam(napi_env env, napi_value jobValue, PrintJob &printJob)
|
||||
{
|
||||
if(!ParseArrFiles(env, jobValue, printJob)){
|
||||
if (!ParseArrFiles(env, jobValue, printJob)) {
|
||||
PRINT_HILOGD("ParseArrFiles error");
|
||||
return false;
|
||||
}
|
||||
@ -573,7 +571,7 @@ bool PrintParseType::ParseJobParam(napi_env env, napi_value jobValue, PrintJob &
|
||||
printJob.SetPageRange(range);
|
||||
}
|
||||
|
||||
if(!ParseHasObj(env, jobValue, printJob) && !ParseHasNum(env, jobValue, printJob)){
|
||||
if (!ParseHasObj(env, jobValue, printJob) && !ParseHasNum(env, jobValue, printJob)) {
|
||||
PRINT_HILOGD("default-value has error!");
|
||||
return false;
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ bool PrintExtensionCallbackProxy::OnCallback(uint32_t printerId, MessageParcel &
|
||||
MessageParcel data;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
data.WriteUint32(printerId);
|
||||
int error = Remote()->SendRequest(PRINT_EXTCB_PRINTCAPABILITY, data, reply, option);
|
||||
if (error != 0) {
|
||||
PRINT_HILOGE("SendRequest failed, error %{public}d", error);
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "print_service_stub.h"
|
||||
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iprint_service.h"
|
||||
#include "message_parcel.h"
|
||||
@ -279,7 +280,7 @@ bool PrintServiceStub::OnRequestPreview(MessageParcel &data, MessageParcel &repl
|
||||
{
|
||||
PRINT_HILOGD("PrintServiceStub::OnRequestPreview in");
|
||||
PrintJob jobinfo;
|
||||
MakePrintJob(data, jobinfo);
|
||||
jobinfo.BuildFromParcel(data);
|
||||
jobinfo.Dump();
|
||||
|
||||
std::string previewResult = "";
|
||||
@ -296,8 +297,10 @@ bool PrintServiceStub::OnRequestPreview(MessageParcel &data, MessageParcel &repl
|
||||
bool PrintServiceStub::OnQueryPrinterCapability(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
PRINT_HILOGD("PrintServiceStub::OnQueryPrinterCapability in");
|
||||
uint32_t printerId = data.ReadUint32();
|
||||
PRINT_HILOGD("printerId : %{public}d", printerId);
|
||||
PrinterCapability printerCapability;
|
||||
bool result = QueryPrinterCapability(data.ReadUint32(), printerCapability);
|
||||
bool result = QueryPrinterCapability(printerId, printerCapability);
|
||||
printerCapability.ConvertToParcel(reply);
|
||||
if (!reply.WriteBool(result)) {
|
||||
PRINT_HILOGD("WriteBool failed");
|
||||
|
Loading…
Reference in New Issue
Block a user