在国产系统麒麟V10系统上面上使用的 USB HID POS 的 SDK 包.
特别说明涉及到永久参数的函数接口,请勿频繁使用.如果是出厂或者偶尔设置推荐使用永久参数,如果是每次读码都进行参数修改,请使用临时参数.频繁进行永久参数操作会减小扫码设备的使用寿命.
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include "tx_scanner.h"
/*************************************************************************
内部宏定义
*************************************************************************/
/*************************************************************************
内部结构、枚举、公用体等结构声明
*************************************************************************/
/*************************************************************************
内部静态变量定义
全局变量定义
extern 外部变量声明
*************************************************************************/
/*************************************************************************
静态函数声明
extern 外部函数声明
*************************************************************************/
/**解码数据回调函数**/
static int32 tx_scanner_sdk_decode_data_cb(uint8 ucCodeType, uint8 *pBuf, uint32 uiBufLen);
/**连接状态回调函数**/
static void tx_scanner_sdk_comm_state_cb_fun(uint8 ucState);
static void tx_scanner_sdk_show_menu(void);
/*************************************************************************
函数定义
*************************************************************************/
int32 main(void)
{
int32 iRet;
uint8 ucVer[64] = "";
uint8 ucTemp1;
uint8 ucTemp2;
uint8 ucTemp3[50];
int length = 0;
tx_scanner_get_version(ucVer, sizeof(ucVer));
printf("linux c/c++ usb hidpos demo ver:%s\r\n", ucVer);
/**注册解码数据回调函数**/
iRet = tx_scanner_decode_data_fun_register(tx_scanner_sdk_decode_data_cb);
if(iRet < 0)
{
printf("tx_scanner_decode_data_fun_register fail!!!\r\n");
return 1;
}
/**注册设备连接状态回调函数**/
iRet = tx_scanner_comm_state_fun_register(tx_scanner_sdk_comm_state_cb_fun);
if(iRet < 0)
{
printf("tx_scanner_comm_state_fun_register fail!!!\r\n");
return 1;
}
/**初始化**/
iRet = tx_scanner_init();
if(iRet < 0)
{
printf("tx_scanner_init fail!!!\r\n");
return 1;
}
printf("******************************************************\r\n");
printf("a:start decode\r\n");
printf("b:stop decode\r\n");
printf("c:no time decode start\r\n");