• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #ifndef PRINT_SERVICE_STUB_H
17 #define PRINT_SERVICE_STUB_H
18 
19 #include "iprint_service.h"
20 #include "iremote_stub.h"
21 
22 namespace OHOS::Print {
23 class PrintServiceStub : public IRemoteStub<IPrintService> {
24 public:
25     explicit PrintServiceStub();
26     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
27 
28 private:
29     bool OnStartPrint(MessageParcel &data, MessageParcel &reply);
30     bool OnStopPrint(MessageParcel &data, MessageParcel &reply);
31     bool OnEventOn(MessageParcel &data, MessageParcel &reply);
32     bool OnEventOff(MessageParcel &data, MessageParcel &reply);
33     bool OnFindPrinterExtension(MessageParcel &data, MessageParcel &reply);
34     bool OnRegisterEvent(MessageParcel &data, MessageParcel &reply);
35     bool OnQueryAllExtension(MessageParcel &data, MessageParcel &reply);
36     bool OnLoadExtension(MessageParcel &data, MessageParcel &reply);
37     bool OnStartDiscoverPrinter(MessageParcel &data, MessageParcel &reply);
38     bool OnStopDiscoverPrint(MessageParcel &data, MessageParcel &reply);
39     bool OnAddPrinters(MessageParcel &data, MessageParcel &reply);
40     bool OnRemovePrinters(MessageParcel &data, MessageParcel &reply);
41     bool OnUpdatePrinters(MessageParcel &data, MessageParcel &reply);
42     bool OnConnectPrinter(MessageParcel &data, MessageParcel &reply);
43     bool OnDisconnectPrinter(MessageParcel &data, MessageParcel &reply);
44     bool OnRequestCapability(MessageParcel &data, MessageParcel &reply);
45     bool OnStartPrintJob(MessageParcel &data, MessageParcel &reply);
46     bool OnCancelPrintJob(MessageParcel &data, MessageParcel &reply);
47     bool OnUpdatePrinterState(MessageParcel &data, MessageParcel &reply);
48     bool OnUpdatePrintJobState(MessageParcel &data, MessageParcel &reply);
49     bool OnUpdateExtensionInfo(MessageParcel &data, MessageParcel &reply);
50     bool OnRequestPreview(MessageParcel &data, MessageParcel &reply);
51     bool OnQueryPrinterCapability(MessageParcel &data, MessageParcel &reply);
52     bool OnRegisterExtCallback(MessageParcel &data, MessageParcel &reply);
53     bool OnUnregisterAllExtCallback(MessageParcel &data, MessageParcel &reply);
54     bool OnLoadExtSuccess(MessageParcel &data, MessageParcel &reply);
55     bool OnQueryAllPrintJob(MessageParcel &data, MessageParcel &reply);
56     bool OnQueryPrintJobById(MessageParcel &data, MessageParcel &reply);
57     bool OnAddPrinterToCups(MessageParcel &data, MessageParcel &reply);
58     bool OnQueryPrinterCapabilityByUri(MessageParcel &data, MessageParcel &reply);
59 
60 private:
61     using PrintCmdHandler = bool (PrintServiceStub::*)(MessageParcel &, MessageParcel &);
62     std::map<uint32_t, PrintCmdHandler> cmdMap_;
63 };
64 } // namespace OHOS::Print
65 #endif // PRINT_SERVICE_STUB_H
66