FileName |
Description |
|---|---|
dvagent.h |
北向接口。 |
Method |
|---|
int32_t DVAgentInit(DVAgentConfig *dvAgentConfig) 完成DVAgent SDK内部初始化。开始使用DVAgent业务时,第一个被调用接口。 |
Parameters
Name |
Description |
|---|---|
dvAgentConfig |
设备配置信息。 typedef struct {
/* Vendor ID */
uint32_t vendorID;
/* 设备蓝牙地址 */
uint8_t brMac[DVAGENT_BR_MAC_LEN];
/* 设备支持的连接方式,
第0bit位为0表示不支持无线,为1表示支持无线;
第1bit位为0表示不支持USB,为1标志支持USB */
int32_t connectAllowType;
/* 设备唯一标识 */
char *deviceId;
/* 标识的长度 */
uint32_t idLen;
/* 设备名字 */
char *deviceName;
/* 设备名字长度 */
uint32_t nameLen;
} DVAgentDeviceInfo;
typedef struct {
DVAgentDeviceInfo deviceInfo;
} DVAgentConfig; |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,小于0失败。 |
Method |
|---|
int32_t DVAgentRelease() 完成DVAgent系统内部注销。不再使用DVAgent业务时调用。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,小于0失败。 |
Method |
|---|
int (*SetParam)(SetParamsType paramType, void* priv) 向DVAgent注册一系列监听,用于接收DVAgent设备状态变化,服务变化等。 |
Parameters
Name |
Description |
|---|---|
listener |
DVAgent监听者集合,结构体。 typedef void (*DVAgentLogFunc)(const char *tag, const char *funcName, const char *format, …); typedef struct {
DVAgentLogFunc logD;
DVAgentLogFunc logI;
DVAgentLogFunc logW;
DVAgentLogFunc logE;
} DvAgentLogFuncGroup;
typedef struct {
/* DVAgent设备状态上报 */
void (*DeviceChange)(DV_AGENT_HANDLE handle, const char *remoteDeviceName, uint32_t nameLen, int state);
/* DVAgent服务状态上报 */
void (*DeviceServiceChange)(DV_AGENT_HANDLE handle, const char *serviceId, uint32_t idLen, int state);
/* 接收来自DVAgent的数据 */
void (*DataReceive)(DV_AGENT_HANDLE handle, int dataType, char *data, uint32_t dataLen);
/* 接收来自DVAgent鉴权认证过程中的PIN码并显示 */
void (*PinCode)(const char *pinCode, uint32_t codeLen);
/* 获取DVAgent鉴权认证中文件存储的大小 */
int32_t (*GetSecureFileSize)(const char *filename);
/* 读鉴权认证文件的内容 */
int32_t (*ReadSecureFile)(const char *filename, uint32_t offset, uint8_t *buf, uint32_t len);
/* 向鉴权认证文件写数据 */
int32_t (*WriteSecureFile)(const char *filename, uint32_t offset, uint8_t *buf, uint32_t len);
/* 删除鉴权认证文件 */
int32_t (*RemoveSecureFile)(const char *filename);
/* 日志回调 */
DvAgentLogFuncGroup logGroup;
} DVAgentListener; |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,小于0失败。 |
Method |
|---|
int32_t DVAgentUnRegisterListener() 向DVAgent注销监听。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,小于0失败。 |
Method |
|---|
DV_AGENT_HANDLE DVAgentCreateServiceHandle() 创建DVAgent会话句柄,基于会话句柄与DV Engine服务进行交互。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,小于0失败。 |
Method |
|---|
void DVAgentDestoryServiceHandle(DV_AGENT_HANDLE handle) 删除DVAgent会话句柄。 |
Parameters
Name |
Description |
|---|---|
handle |
DVAgent句柄。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,小于0失败。 |
Method |
|---|
char *DVAgentGetSdkVersion() 获取DVAgent的版本号。用于后续SDK的版本升级。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,小于0失败。 |
Method |
|---|
int32_t DVAgentGetTrustDeviceList(DV_AGENT_HANDLE handle, DVAgentTrustPhoneInfo *list, uint32_t num) 厂商可以获取当前和设备完成鉴权认证后的设备列表。 |
Parameters
Name |
Description |
|---|---|
handle |
厂商可以获取当前和设备完成鉴权认证后的设备列表。 |
list |
完成鉴权认证的设备(手机)列表。 typedef struct {
/* 手机ID长度 */
uint32_t phoneIdRealLen;
/* 手机ID,最大长度128 */
uint8_t phoneId[DVAGENT_PHONE_ID_MAX_LEN + 1];
/* 手机名称长度 */
uint8_t phoneNameRealLen;
/* 手机名称,最大长度256 */
uint8_t phoneName[DVAGENT_PHONE_NAME_MAX_LEN + 1];
/* 最近一次连接的系统时间 */
int64_t lastConnectTime;
} DVAgentTrustPhoneInfo; |
num |
列表个数。 |
Return
Type |
Description |
|---|---|
int32_t |
0:成功,小于0失败。 |