本示例使用的读卡器
#include <QDebug>
#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include "QLibrary"
#include "QMessageBox"
#include <QtGlobal>
//函数声明
//驱动发卡器响声
typedef unsigned char (*idr_beep)(unsigned long xms);
#ifdef Q_OS_WIN
idr_beep myidr_beep = (idr_beep)QLibrary("OUR_IDR.dll").resolve("idr_beep");
#else
idr_beep myidr_beep = (idr_beep)QLibrary("./libOURIDR.so").resolve("idr_beep");
#endif
//读取发卡器编号
typedef unsigned char (*pcdgetdevicenumber)(unsigned char *devicenumber);
#ifdef Q_OS_WIN
pcdgetdevicenumber mypcdgetdevicenumber = (pcdgetdevicenumber)QLibrary("OUR_IDR.dll").resolve("pcdgetdevicenumber");
#else
pcdgetdevicenumber mypcdgetdevicenumber = (pcdgetdevicenumber)QLibrary("./libOURIDR.so").resolve("pcdgetdevicenumber");
#endif
//读id卡
typedef unsigned char (*idr_read)(unsigned char *piccserial);
#ifdef Q_OS_WIN
idr_read myidr_read = (idr_read)QLibrary("OUR_IDR.dll").resolve("idr_read");
#else
idr_read myidr_read = (idr_read)QLibrary("./libOURIDR.so").resolve("idr_read");
#endif
status=myidr_read(mypiccserial);
if(status==0){
myidr_beep(30);
QString idser=QString::asprintf("%02X%02X%02X%02X%02X", mypiccserial[0],mypiccserial[1],mypiccserial[2],mypiccserial[3],mypiccserial[4]);
ui->text_idserial->setText(idser);
on_push_changeid0_clicked();
QMessageBox::information(NULL, "提示", "读ID卡成功,卡号:"+idser);
}else{
disperrinf(status);
}