• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (C) 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 #ifndef C_TASK_INFO_H
17 #define C_TASK_INFO_H
18 
19 #include <stdint.h>
20 
21 #include <cstdint>
22 #include <string>
23 #include <vector>
24 
25 #include "c_form_item.h"
26 #include "c_progress.h"
27 #include "c_string_wrapper.h"
28 
29 struct CommonTaskInfo {
30     uint32_t taskId;
31     uint64_t uid;
32     uint8_t action;
33     uint8_t mode;
34     uint64_t ctime;
35     uint64_t mtime;
36     uint8_t reason;
37     bool gauge;
38     bool retry;
39     uint32_t tries;
40     uint8_t version;
41     uint32_t priority;
42 };
43 
44 struct CEachFileStatus {
45     CStringWrapper path;
46     uint8_t reason;
47     CStringWrapper message;
48 };
49 
50 struct EachFileStatus {
51     std::string path;
52     uint8_t reason;
53     std::string message;
54 };
55 
56 struct CTaskInfo {
57     CStringWrapper bundle;
58     CStringWrapper url;
59     CStringWrapper data;
60     CStringWrapper token;
61     CFormItem *formItemsPtr;
62     uint32_t formItemsLen;
63     CFileSpec *fileSpecsPtr;
64     uint32_t fileSpecsLen;
65     CStringWrapper title;
66     CStringWrapper description;
67     CStringWrapper mimeType;
68     CProgress progress;
69     CEachFileStatus *eachFileStatusPtr;
70     uint32_t eachFileStatusLen;
71     CommonTaskInfo commonData;
72 };
73 
74 struct TaskInfo {
75     std::string bundle;
76     std::string url;
77     std::string data;
78     std::string token;
79     std::vector<FormItem> formItems;
80     std::vector<FileSpec> fileSpecs;
81     std::string title;
82     std::string description;
83     std::string mimeType;
84     Progress progress;
85     std::vector<EachFileStatus> eachFileStatus;
86     CommonTaskInfo commonData;
87 };
88 
89 struct CUpdateInfo {
90     uint64_t mtime;
91     uint8_t reason;
92     uint32_t tries;
93     CStringWrapper mimeType;
94     CProgress progress;
95     CEachFileStatus *eachFileStatusPtr;
96     uint32_t eachFileStatusLen;
97 };
98 #ifdef __cplusplus
99 extern "C" {
100 #endif
101 
102 void DeleteCFormItem(CFormItem *ptr);
103 void DeleteCFileSpec(CFileSpec *ptr);
104 void DeleteCStringPtr(CStringWrapper *ptr);
105 void DeleteCEachFileStatus(CEachFileStatus *ptr);
106 void DeleteCTaskInfo(CTaskInfo *ptr);
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 #endif // C_TASK_INFO_H