• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16// @ts-nocheck
17import rpc from '@ohos.rpc';
18import { PrintJobState,PrintJobSubState,PrinterRange,PrintPageSize,PrintMargin,PreviewAttribute } from '@ohos/common';
19
20@Observed
21export class PrintJob implements rpc.Sequenceable{
22    constructor(public jobFiles: string[], public fdList : Array<number>, public jobId : string, public printerId : string,
23                public jobState: PrintJobState, public jobSubState : PrintJobSubState, public copyNumber: number, public pageRange: PrinterRange,
24                public isSequential : boolean, public pageSize : PrintPageSize, public isLandscape : boolean,
25                public colorMode : number, public duplexMode : number, public margin : PrintMargin,
26                public preview : PreviewAttribute, public option : string) {
27        this.jobFiles = jobFiles
28        this.fdList = fdList
29        this.jobId = jobId
30        this.printerId = printerId
31        this.jobState = jobState
32        this.jobSubState = jobSubState
33        this.copyNumber = copyNumber
34        this.pageRange = pageRange
35        this.isSequential = isSequential
36        this.pageSize = pageSize
37        this.isLandscape = isLandscape
38        this.colorMode = colorMode
39        this.duplexMode = duplexMode
40        this.margin = margin
41        this.preview = preview
42        this.option = option
43    }
44
45    /**
46     * Marshals this {@code Sequenceable} object into a {@link MessageParcel}.
47     */
48    marshalling(dataOut: rpc.MessageParcel): boolean {
49        dataOut.writeStringArray(this.jobFiles)
50        dataOut.writeIntArray(this.fdList)
51        dataOut.writeString(this.jobId)
52        dataOut.writeString(this.printerId)
53        dataOut.writeInt(this.jobState)
54        dataOut.writeInt(this.jobSubState)
55        dataOut.writeInt(this.copyNumber)
56        dataOut.writeSequenceable(this.pageRange)
57        dataOut.writeBoolean(this.isSequential)
58        dataOut.writeSequenceable(this.pageSize)
59        dataOut.writeBoolean(this.isLandscape)
60        dataOut.writeInt(this.colorMode)
61        dataOut.writeInt(this.duplexMode)
62        dataOut.writeSequenceable(this.margin)
63        dataOut.writeSequenceable(this.preview)
64        dataOut.writeString(this.option)
65        return true
66    }
67
68    /**
69     * Unmarshals this {@code Sequenceable} object from a {@link MessageParcel}.
70     */
71    unmarshalling(dataIn: rpc.MessageParcel): boolean{
72        dataIn.readStringArray(this.jobFiles);
73        dataIn.readIntArray(this.fdList);
74        this.jobId = dataIn.readString()
75        this.printerId = dataIn.readString()
76        this.jobState = dataIn.readInt()
77        this.jobSubState = dataIn.readInt()
78        this.copyNumber = dataIn.readInt()
79        dataIn.readSequenceable(this.pageRange)
80        this.isSequential = dataIn.readBoolean()
81        dataIn.readSequenceable(this.pageSize)
82        this.isLandscape = dataIn.readBoolean()
83        this.colorMode = dataIn.readInt()
84        this.duplexMode = dataIn.readInt()
85        dataIn.readSequenceable(this.margin)
86        dataIn.readSequenceable(this.preview)
87        this.option = dataIn.readString()
88        return true
89    }
90
91}
92