API参考
载入中...
搜索中...
未找到
bsl_ui.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15#ifndef BSL_UI_H
16#define BSL_UI_H
17
18#include <stdint.h>
19#include <stdbool.h>
20#ifdef __cplusplus
21extern "C" {
22#endif
23
28typedef enum {
29 BSL_UIM_NONE = 0,
30 BSL_UIM_OPEN,
31 BSL_UIM_WRITE,
32 BSL_UIM_READ,
33 BSL_UIM_CLOSE
34} BSL_UI_MethodTypes;
35
40typedef enum {
41 BSL_UI_DATA_NONE = 0,
42 BSL_UI_DATA_READ,
43 BSL_UI_DATA_WRITE
44} BSL_UI_DataTypes;
45
50typedef enum {
51 BSL_UI_DATA_FLAG_NONE = 0, // Setting the Echo Display 01, follow with 010 0100
52 BSL_UI_DATA_FLAG_ECHO = 0x1,
53 BSL_UI_DATA_FLAG_USER = 0x10000
54} BSL_UI_DataFlags;
55
60typedef struct {
61 uint32_t flags;
62 char *buff;
63 uint32_t buffLen;
64 char *verifyBuff;
66
71typedef struct {
72 const char *desc;
73 const char *name;
74 bool verify;
76
77typedef struct UI_Control BSL_UI;
78typedef struct UI_ControlMethod BSL_UI_Method;
79typedef struct UI_ControlDataPack BSL_UI_DataPack;
80
93typedef int32_t (*BSL_UI_Open) (BSL_UI *ui);
94
107typedef int32_t (*BSL_UI_Write) (BSL_UI *ui, BSL_UI_DataPack *data);
108
124typedef int32_t (*BSL_UI_Read) (BSL_UI *ui, BSL_UI_DataPack *data);
125
138typedef int32_t (*BSL_UI_Close) (BSL_UI *ui);
139
154typedef int32_t (*BSL_UI_CheckDataCallBack) (BSL_UI *ui, char *buff, uint32_t buffLen, void *callBackData);
155
170BSL_UI *BSL_UI_New(const BSL_UI_Method *method);
171
184void BSL_UI_Free(BSL_UI *ui);
185
197BSL_UI_Method *BSL_UI_MethodNew(void);
198
211void BSL_UI_MethodFree(BSL_UI_Method *method);
212
227const BSL_UI_Method *BSL_UI_GetOperMethod(const BSL_UI *ui);
228
244int32_t BSL_UI_SetMethod(BSL_UI_Method *method, uint8_t type, void *func);
245
261int32_t BSL_UI_GetMethod(const BSL_UI_Method *method, uint8_t type, void **func);
262
283int32_t BSL_UI_ReadPwdUtil(BSL_UI_ReadPwdParam *param, char *buff, uint32_t *buffLen,
284 const BSL_UI_CheckDataCallBack checkDataCallBack, void *callBackData);
285
297BSL_UI_DataPack *BSL_UI_DataPackNew(void);
298
311void BSL_UI_DataPackFree(BSL_UI_DataPack *data);
312
329int32_t BSL_UI_DataCtrl(BSL_UI_DataPack *data, uint32_t type, void *parg, uint32_t larg);
330
346int32_t BSL_UI_GetDataResult(BSL_UI_DataPack *data, char **result, uint32_t *resultLen);
347
362char *BSL_UI_ConstructPrompt(const char *objectDesc, const char *objectName);
363
364#ifdef __cplusplus
365}
366#endif
367
368#endif
BSL_UI_Ctrl get parameters
定义 bsl_ui.h:60
BSL_UI read pwd parameters
定义 bsl_ui.h:71