• 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 FIRMWARE_TASK_TABLE_H
17 #define FIRMWARE_TASK_TABLE_H
18 
19 #ifdef RELATIONAL_STORE_NATIVE_RDB_ENABLE
20 #include "values_bucket.h"
21 
22 #include "itable.h"
23 #endif
24 #include "firmware_task.h"
25 
26 namespace OHOS {
27 namespace UpdateEngine {
28 const std::string FIRMWARE_TABLE_TASK = "task";
29 const std::string COLUMN_TASK_TASK_ID = "taskId";
30 const std::string COLUMN_TASK_STATUS = "status";
31 const std::string COLUMN_TASK_PROGRESS = "progress";
32 const std::string COLUMN_TASK_DOWNLOAD_TASK_ID = "downloadTaskId";
33 const std::string COLUMN_TASK_ERROR_CODE = "errorCode";
34 const std::string COLUMN_TASK_ERROR_MSG = "errorMsg";
35 const std::string COLUMN_TASK_COMBINATION_TYPE = "combinationType";
36 
37 const std::string COLUMN_TASK_DOWNLOAD_MODE = "downloadMode";
38 const std::string COLUMN_TASK_DOWNLOAD_ALLOW_NETWORK = "downloadAllowNetwork";
39 const std::string COLUMN_TASK_DOWNLOAD_ORDER = "downloadOrder";
40 const std::string COLUMN_TASK_UPGRADE_MODE = "upgradeMode";
41 const std::string COLUMN_TASK_UPGRADE_ORDER = "upgradeOrder";
42 
43 const std::string COLUMN_TASK_AUTH_RESULT = "authResult";
44 const std::string COLUMN_TASK_UPDATE_TOKEN = "updateToken";
45 const std::string COLUMN_TASK_DEVICE_TOKEN = "deviceToken";
46 const std::string COLUMN_TASK_TOKEN_H_MAC = "tokenHMac";
47 const std::string COLUMN_TASK_CURR_VERSION_LIST = "currentVersionList";
48 const std::string COLUMN_TASK_AUTH_TIME = "authTime";
49 
50 // 预留6个字段
51 const std::string COLUMN_TASK_EXTENDS1 = "extends1";
52 const std::string COLUMN_TASK_EXTENDS2 = "extends2";
53 const std::string COLUMN_TASK_EXTENDS3 = "extends3";
54 const std::string COLUMN_TASK_EXTENDS4 = "extends4";
55 const std::string COLUMN_TASK_EXTENDS5 = "extends5";
56 const std::string COLUMN_TASK_EXTENDS6 = "extends6";
57 
58 #ifdef RELATIONAL_STORE_NATIVE_RDB_ENABLE
59 class FirmwareTaskTable : public ITable<FirmwareTask> {
60 #else
61 class FirmwareTaskTable {
62 #endif
63 public:
64     FirmwareTaskTable() = default;
65     ~FirmwareTaskTable() = default;
66 #ifdef RELATIONAL_STORE_NATIVE_RDB_ENABLE
67     std::string GetTableName() final;
68     std::string GetTableCreateSql() final;
69     void ParseDbValue(ResultSet *resultSet, FirmwareTask &value) final;
70     void BuildDbValue(const FirmwareTask &value, NativeRdb::ValuesBucket &dbValue) final;
71 #else
72     std::string GetTableName();
73     std::string GetTableCreateSql();
74 #endif
75 };
76 } // namespace UpdateEngine
77 } // namespace OHOS
78 #endif // FIRMWARE_TASK_TABLE_H
79