1 /*
2  * Copyright (c) 2023-2024 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 #include "asset_api.h"
17 
18 #include "asset_system_api.h"
19 #include "asset_system_type.h"
20 
OH_Asset_Add(const Asset_Attr * attributes,uint32_t attrCnt)21 int32_t OH_Asset_Add(const Asset_Attr *attributes, uint32_t attrCnt)
22 {
23     return AssetAdd((const AssetAttr *)attributes, attrCnt);
24 }
25 
OH_Asset_Remove(const Asset_Attr * query,uint32_t queryCnt)26 int32_t OH_Asset_Remove(const Asset_Attr *query, uint32_t queryCnt)
27 {
28     return AssetRemove((const AssetAttr *)query, queryCnt);
29 }
30 
OH_Asset_Update(const Asset_Attr * query,uint32_t queryCnt,const Asset_Attr * attributesToUpdate,uint32_t updateCnt)31 int32_t OH_Asset_Update(const Asset_Attr *query, uint32_t queryCnt,
32     const Asset_Attr *attributesToUpdate, uint32_t updateCnt)
33 {
34     return AssetUpdate((const AssetAttr *)query, queryCnt, (const AssetAttr *)attributesToUpdate, updateCnt);
35 }
36 
OH_Asset_PreQuery(const Asset_Attr * query,uint32_t queryCnt,Asset_Blob * challenge)37 int32_t OH_Asset_PreQuery(const Asset_Attr *query, uint32_t queryCnt, Asset_Blob *challenge)
38 {
39     return AssetPreQuery((const AssetAttr *)query, queryCnt, (AssetBlob *)challenge);
40 }
41 
OH_Asset_Query(const Asset_Attr * query,uint32_t queryCnt,Asset_ResultSet * resultSet)42 int32_t OH_Asset_Query(const Asset_Attr *query, uint32_t queryCnt, Asset_ResultSet *resultSet)
43 {
44     return AssetQuery((const AssetAttr *)query, queryCnt, (AssetResultSet *)resultSet);
45 }
46 
OH_Asset_PostQuery(const Asset_Attr * handle,uint32_t handleCnt)47 int32_t OH_Asset_PostQuery(const Asset_Attr *handle, uint32_t handleCnt)
48 {
49     return AssetPostQuery((const AssetAttr *)handle, handleCnt);
50 }
51 
OH_Asset_ParseAttr(const Asset_Result * result,Asset_Tag tag)52 Asset_Attr *OH_Asset_ParseAttr(const Asset_Result *result, Asset_Tag tag)
53 {
54     return (Asset_Attr *)AssetParseAttr((const AssetResult *)result, (AssetTag)tag);
55 }
56 
OH_Asset_FreeBlob(Asset_Blob * blob)57 void OH_Asset_FreeBlob(Asset_Blob *blob)
58 {
59     AssetFreeBlob((AssetBlob *)blob);
60 }
61 
OH_Asset_FreeResultSet(Asset_ResultSet * resultSet)62 void OH_Asset_FreeResultSet(Asset_ResultSet *resultSet)
63 {
64     AssetFreeResultSet((AssetResultSet *)resultSet);
65 }