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