• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright (c) 2025 Huawei Device Co., Ltd.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef ANI_PRINT_TASK_H
17 #define ANI_PRINT_TASK_H
18 
19 #include <vector>
20 #include <stdint.h>
21 #include <ani.h>
22 #include <string>
23 #include "ability.h"
24 #include "print_attributes.h"
25 #include "print_constant.h"
26 #include "print_utils.h"
27 #include "ui_ability_thread.h"
28 #include "fd_list_wrapper.h"
29 #include "print_ets_ui_callback.h"
30 #include "iprint_callback.h"
31 #include "modal_ui_extension_config.h"
32 #include "ui_content.h"
33 
34 namespace OHOS::Print {
35 class AniPrintTask {
36 public:
37     AniPrintTask(ani_env *env);
38     ~AniPrintTask();
39     int32_t StartPrintWithContext(const std::vector<std::string>& files, std::shared_ptr<AbilityRuntime::Context> ctx);
40     int32_t StartPrintWithAttributes(const std::string& jobName, std::shared_ptr<AbilityRuntime::Context> ctx,
41         const PrintAttributes& attributes, const sptr<IPrintCallback> &listener);
42     int32_t On(std::string type, sptr<IPrintCallback> callback);
43     int32_t Off(std::string type, sptr<IPrintCallback> callback);
44 private:
45     uint32_t CallSpooler(const std::shared_ptr<AdapterParam>& adapterParam,
46         const std::vector<std::string>& files, std::shared_ptr<AbilityRuntime::Context> ctx);
47     OHOS::Ace::UIContent* GetUIContent(std::shared_ptr<OHOS::AbilityRuntime::Context> ctx);
48 
49     ani_vm *aniVm_ = nullptr;
50     std::string jobId_;
51 };
52 
53 } // namespace OHOS::Print
54 
55 #endif  // ANI_PRINT_TASK_H