@@ -37,6 +37,9 @@ QVariant ChipDbTableModel::data(const QModelIndex &index, int role) const
37
37
case CHIP_PARAM_BLOCK_SIZE:
38
38
case CHIP_PARAM_TOTAL_SIZE:
39
39
case CHIP_PARAM_SPARE_SIZE:
40
+ chipDb->getHexStringFromParam ((*chipDb)[index.row ()]->params [column],
41
+ paramStr);
42
+ return paramStr;
40
43
case CHIP_PARAM_T_CS:
41
44
case CHIP_PARAM_T_CLS:
42
45
case CHIP_PARAM_T_ALS:
@@ -61,13 +64,13 @@ QVariant ChipDbTableModel::data(const QModelIndex &index, int role) const
61
64
case CHIP_PARAM_WRITE1_CMD:
62
65
case CHIP_PARAM_ERASE1_CMD:
63
66
case CHIP_PARAM_STATUS_CMD:
64
- chipDb->getStringFromParam ((*chipDb)[index.row ()]->params [column],
67
+ chipDb->getHexStringFromParam ((*chipDb)[index.row ()]->params [column],
65
68
paramStr);
66
69
return paramStr;
67
70
case CHIP_PARAM_READ2_CMD:
68
71
case CHIP_PARAM_WRITE2_CMD:
69
72
case CHIP_PARAM_ERASE2_CMD:
70
- chipDb->getStringFromOptParam ((*chipDb)[index.row ()]->params [column],
73
+ chipDb->getHexStringFromOptParam ((*chipDb)[index.row ()]->params [column],
71
74
paramStr);
72
75
return paramStr;
73
76
}
@@ -212,6 +215,10 @@ bool ChipDbTableModel::setData(const QModelIndex &index, const QVariant &value,
212
215
case CHIP_PARAM_BLOCK_SIZE:
213
216
case CHIP_PARAM_TOTAL_SIZE:
214
217
case CHIP_PARAM_SPARE_SIZE:
218
+ if (chipDb->getParamFromHexString (value.toString (), paramVal))
219
+ return false ;
220
+ (*chipDb)[index.row ()]->params [index.column ()] = paramVal;
221
+ return true ;
215
222
case CHIP_PARAM_T_CS:
216
223
case CHIP_PARAM_T_CLS:
217
224
case CHIP_PARAM_T_ALS:
@@ -248,7 +255,7 @@ bool ChipDbTableModel::setData(const QModelIndex &index, const QVariant &value,
248
255
case CHIP_PARAM_WRITE1_CMD:
249
256
case CHIP_PARAM_ERASE1_CMD:
250
257
case CHIP_PARAM_STATUS_CMD:
251
- if (chipDb->getParamFromString (value.toString (), paramVal))
258
+ if (chipDb->getParamFromHexString (value.toString (), paramVal))
252
259
return false ;
253
260
if (!chipDb->isParamValid (paramVal, 0x00 , 0xFF ))
254
261
return false ;
@@ -257,7 +264,7 @@ bool ChipDbTableModel::setData(const QModelIndex &index, const QVariant &value,
257
264
case CHIP_PARAM_READ2_CMD:
258
265
case CHIP_PARAM_WRITE2_CMD:
259
266
case CHIP_PARAM_ERASE2_CMD:
260
- if (chipDb->getOptParamFromString (value.toString (), paramVal))
267
+ if (chipDb->getOptParamFromHexString (value.toString (), paramVal))
261
268
return false ;
262
269
if (!chipDb->isOptParamValid (paramVal, 0x00 , 0xFF ))
263
270
return false ;
0 commit comments