1 /* 2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 HI_GV_ADM_H 17 #define HI_GV_ADM_H 18 19 #include "hi_type.h" 20 #include "hi_gv_widget.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /* ADM and DDB support MAX filed number */ 27 #define HIGV_DB_MAX_FIELDNUM 64 28 #define HIGV_DB_MAX_FIELD_STR_LEN 4096 29 30 /* The type of data are supported */ 31 typedef enum { 32 /* char */ 33 HIGV_DT_S8 = 0, 34 /* unsigned char */ 35 HIGV_DT_U8, 36 /* short */ 37 HIGV_DT_S16, 38 /* unsigned short */ 39 HIGV_DT_U16, 40 /* int */ 41 HIGV_DT_S32, 42 /* unsigned int */ 43 HIGV_DT_U32, 44 /* long long */ 45 HIGV_DT_S64, 46 /* unsigned long long */ 47 HIGV_DT_U64, 48 /* float */ 49 HIGV_DT_F32, 50 /* double */ 51 HIGV_DT_D64, 52 /* char * */ 53 HIGV_DT_STRING, 54 /* image handle */ 55 HIGV_DT_HIMAGE, 56 /* multi-langugae string ID */ 57 HIGV_DT_STRID, 58 HIGV_DT_BUTT 59 } HIGV_DT_E; 60 61 /* The type of data change. */ 62 typedef enum { 63 /* insert data */ 64 HIGV_DC_INSERT = 0, 65 /* modify data */ 66 HIGV_DC_MODIFY, 67 /* delete data */ 68 HIGV_DC_DELETE, 69 /* updata data,sealed operations */ 70 HIGV_DC_UPDATE, 71 /* clear all the data */ 72 HIGV_DC_CLEAR, 73 /* destroy the data source */ 74 HIGV_DC_DESTROY, 75 HIGV_DC_BUTT 76 } HIGV_DC_E; 77 78 /* The data change info */ 79 typedef struct { 80 /* the type of data change */ 81 HIGV_DC_E Action; 82 /* the start row of data change */ 83 HI_U16 StartRow; 84 /* rows aggregate have data change */ 85 HI_U16 Rows; 86 } HIGV_DCINFO_S; 87 88 /* Cell attribute.CNconmment:ֶ */ 89 typedef struct hiHIGV_CELLATTR_S { 90 /* data type */ 91 HIGV_DT_E eDataType; 92 /* max field str len, value must less than ::HIGV_DB_MAX_FIELD_STR_LEN */ 93 HI_U32 MaxSize; 94 } HIGV_FIELDATTR_S; 95 96 /* Row deferable. */ 97 typedef struct hiHIGV_DBROW_S { 98 /* data size */ 99 HI_U32 Size; 100 /* data pointer */ 101 HI_VOID *pData; 102 } HIGV_DBROW_S; 103 104 typedef HI_S32 (*GetCountFunc)(HIGV_HANDLE dbSource, HI_U32 *rowCnt); 105 typedef HI_S32 (*GetRowValueFunc)(HIGV_HANDLE dbSource, HI_U32 row, HI_U32 num, const HI_VOID *data, HI_U32 *rowNum); 106 typedef HI_S32 (*RegisterDataChangeFunc)(HIGV_HANDLE dbSource, HIGV_HANDLE adm); 107 typedef HI_S32 (*UnregisterDataChangeFunc)(HIGV_HANDLE dbSource, HIGV_HANDLE adm); 108 109 typedef struct hiADM_OPT_S { 110 /* data source */ 111 HI_U32 DBSource; 112 /* data source field count */ 113 HI_U32 FieldCount; 114 /* field attribute */ 115 HIGV_FIELDATTR_S *pFieldAttr; 116 /* rows at buffer */ 117 HI_U32 BufferRows; 118 /* get rows count function */ 119 GetCountFunc GetCount; 120 GetRowValueFunc GetRowValue; 121 /* get rows value from appoint rows function */ 122 RegisterDataChangeFunc RegisterDataChange; 123 /* Register the function when data change */ 124 UnregisterDataChangeFunc UnregisterDataChange; 125 /* Unregister the function when data change */ 126 } HIGV_ADMOPT_S; 127 128 HI_S32 HI_GV_ADM_Create(const HIGV_ADMOPT_S *dataSource, HIGV_HANDLE *admHandle); 129 130 HI_S32 HI_GV_ADM_CreateByHandle(const HIGV_ADMOPT_S *dataSource, HIGV_HANDLE admHandle); 131 132 HI_S32 HI_GV_ADM_CreateDefault(HIGV_HANDLE dbHandle, HI_U32 fieldCount, HIGV_FIELDATTR_S *fieldAttr, 133 HIGV_HANDLE *admHandle); 134 135 HI_S32 HI_GV_ADM_CreateDefaultByHandle(HIGV_HANDLE dbHandle, HI_U32 fieldCount, 136 const HIGV_FIELDATTR_S *fieldAttr, HIGV_HANDLE admHandle); 137 138 HI_S32 HI_GV_ADM_Destroy(HIGV_HANDLE admHandle); 139 140 HI_S32 HI_GV_ADM_Bind(HIGV_HANDLE widgetHandle, HIGV_HANDLE admHandle); 141 142 HI_S32 HI_GV_ADM_UnBind(HIGV_HANDLE widgetHandle, HIGV_HANDLE admHandle); 143 144 HI_S32 HI_GV_ADM_GetFieldAttr(HIGV_HANDLE admHandle, HI_U32 col, HIGV_FIELDATTR_S *fieldAttr); 145 146 HI_S32 HI_GV_ADM_GetRowCount(HIGV_HANDLE admHandle, HI_U32 *count); 147 148 HI_S32 HI_GV_ADM_GetCellData(HIGV_HANDLE admHandle, HI_U32 row, HI_U32 col, HI_VOID *data, HI_U32 len); 149 150 HI_S32 HI_GV_ADM_GetCellDataString(HIGV_HANDLE admHandle, HI_U32 row, HI_U32 col, HI_CHAR *dataString, HI_U32 len); 151 152 HI_S32 HI_GV_ADM_SetDCCallBack(HIGV_HANDLE admHandle, HIGV_MSG_PROC customProc, HIGV_PROCORDER_E procOrder); 153 154 HI_S32 HI_GV_ADM_GetDDBHandle(HIGV_HANDLE admHandle, HIGV_HANDLE *ddbHandle); 155 156 HI_S32 HI_GV_ADM_GetColNum(HIGV_HANDLE admHandle, HI_U32 *colNum); 157 158 HI_S32 HI_GV_ADM_Sync(HIGV_HANDLE admHandle); 159 160 HI_S32 HI_GV_ADM_ClearAllData(HI_VOID); 161 162 #ifdef __cplusplus 163 } 164 #endif 165 #endif /* HI_GV_ADM_H */ 166