Qt_C++读写NXP、富士通15693标签支持windows国产linux操作系统

news2024/11/23 6:22:50

常用15693标签NXP ICODE存储结构说明

      片内含1024位E2PROM,共分为32 Block,每个Block 32bit。其中64位为唯一序列号,32位用作特殊功能(EAS、AFI、DSFID等),32位用于Block锁定,其余为用户使用区。

本示例使用的发卡器: Android Linux RFID读写器NFC发卡器WEB可编程NDEF文本/智能海报/-淘宝网 (taobao.com)

#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include <QDebug>
#include "QLibrary"
#include "QMessageBox"
//#include <QStringListModel>


#define NEEDSERIAL 0x08;
#define NEEDHALT 0x20;

//QStringListModel *model;

//判断windows、linux系统,声明动态库函数----------------------------------------------------------------------------------------------------------------------------------------------
//让读写器发出声音
typedef  unsigned char (*pcdbeep)(unsigned long xms);
#ifdef Q_OS_WIN
    pcdbeep mypcdbeep = (pcdbeep)QLibrary("OUR_MIFARE.dll").resolve("pcdbeep");
#else
    pcdbeep mypcdbeep = (pcdbeep)QLibrary("./libOURIDR.so").resolve("pcdbeep");
#endif

//返回本读写器独一无二的设备编号
typedef  unsigned char (*pcdgetdevicenumber)(unsigned char *devicenumber);
#ifdef Q_OS_WIN
    pcdgetdevicenumber mypcdgetdevicenumber = (pcdgetdevicenumber)QLibrary("OUR_MIFARE.dll").resolve("pcdgetdevicenumber");
#else
    pcdgetdevicenumber mypcdgetdevicenumber = (pcdgetdevicenumber)QLibrary("./libOURIDR.so").resolve("pcdgetdevicenumber");
#endif

//轻松读15693卡
typedef unsigned char (*iso15693readex)(unsigned char ctrlword,unsigned char afi,unsigned char startblock,unsigned char blocknum,unsigned char *uid,unsigned char *piccdatabuf);
#ifdef Q_OS_WIN
    iso15693readex myiso15693readex = (iso15693readex)QLibrary("OUR_MIFARE.dll").resolve("iso15693readex");
#else
    iso15693readex myiso15693readex = (iso15693readex)QLibrary("./libOURIDR.so").resolve("iso15693readex");
#endif

//轻松写15693卡
typedef unsigned char (*iso15693writeex)(unsigned char ctrlword,unsigned char afi,unsigned char startblock,unsigned char blocknum,unsigned char *uid,unsigned char *piccdatabuf);
#ifdef Q_OS_WIN
    iso15693writeex myiso15693writeex = (iso15693writeex)QLibrary("OUR_MIFARE.dll").resolve("iso15693writeex");
#else
    iso15693writeex myiso15693writeex = (iso15693writeex)QLibrary("./libOURIDR.so").resolve("iso15693writeex");
#endif

//寻一张15693卡
typedef unsigned char (*iso15693inventory)(unsigned char flags,unsigned char afi,unsigned char masklen,unsigned char *maskuid,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693inventory myiso15693inventory = (iso15693inventory)QLibrary("OUR_MIFARE.dll").resolve("iso15693inventory");
#else
    iso15693inventory myiso15693inventory = (iso15693inventory)QLibrary("./libOURIDR.so").resolve("iso15693inventory");
#endif

//寻多张15693卡
typedef unsigned char (*iso15693inventory16)(unsigned char flags,unsigned char afi,unsigned char masklen,unsigned char *maskuid,unsigned char *revlen,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693inventory16 myiso15693inventory16 = (iso15693inventory16)QLibrary("OUR_MIFARE.dll").resolve("iso15693inventory16");
#else
    iso15693inventory16 myiso15693inventory16 = (iso15693inventory16)QLibrary("./libOURIDR.so").resolve("iso15693inventory16");
#endif

//让15693卡进入闲置(Quiet)静止状态
typedef unsigned char (*iso15693stayquiet)(unsigned char flags,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693stayquiet myiso15693stayquiet = (iso15693stayquiet)QLibrary("OUR_MIFARE.dll").resolve("iso15693stayquiet");
#else
    iso15693stayquiet myiso15693stayquiet = (iso15693stayquiet)QLibrary("./libOURIDR.so").resolve("iso15693stayquiet");
#endif

//使15693卡进入选择(selected )状态
typedef unsigned char (*iso15693Select)(unsigned char flags,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693Select myiso15693Select = (iso15693Select)QLibrary("OUR_MIFARE.dll").resolve("iso15693Select");
#else
    iso15693Select myiso15693Select = (iso15693Select)QLibrary("./libOURIDR.so").resolve("iso15693Select");
#endif

//使15693卡进入准备(Ready)状态
typedef unsigned char (*iso15693resettoready)(unsigned char flags,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693resettoready myiso15693resettoready = (iso15693resettoready)QLibrary("OUR_MIFARE.dll").resolve("iso15693resettoready");
#else
    iso15693resettoready myiso15693resettoready = (iso15693resettoready)QLibrary("./libOURIDR.so").resolve("iso15693resettoready");
#endif

//写15693卡AFI
typedef unsigned char (*iso15693writeafi)(unsigned char flags,unsigned char afi,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693writeafi myiso15693writeafi = (iso15693writeafi)QLibrary("OUR_MIFARE.dll").resolve("iso15693writeafi");
#else
    iso15693writeafi myiso15693writeafi = (iso15693writeafi)QLibrary("./libOURIDR.so").resolve("iso15693writeafi");
#endif

//锁15693卡AFI
typedef unsigned char (*iso15693lockafi)(unsigned char flags,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693lockafi myiso15693lockafi = (iso15693lockafi)QLibrary("OUR_MIFARE.dll").resolve("iso15693lockafi");
#else
    iso15693lockafi myiso15693lockafi = (iso15693lockafi)QLibrary("./libOURIDR.so").resolve("iso15693lockafi");
#endif

//写15693卡DSFID
typedef unsigned char (*iso15693writedsfid)(unsigned char flags,unsigned char dsfid,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693writedsfid myiso15693writedsfid = (iso15693writedsfid)QLibrary("OUR_MIFARE.dll").resolve("iso15693writedsfid");
#else
    iso15693writedsfid myiso15693writedsfid = (iso15693writedsfid)QLibrary("./libOURIDR.so").resolve("iso15693writedsfid");
#endif

//锁15693卡DSFID
typedef unsigned char (*iso15693lockdsfid)(unsigned char flags,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693lockdsfid myiso15693lockdsfid = (iso15693lockdsfid)QLibrary("OUR_MIFARE.dll").resolve("iso15693lockdsfid");
#else
    iso15693lockdsfid myiso15693lockdsfid = (iso15693lockdsfid)QLibrary("./libOURIDR.so").resolve("iso15693lockdsfid");
#endif

//锁15693卡数据块
typedef unsigned char (*iso15693lockblock)(unsigned char flags,unsigned char startblock,unsigned char *uid);
#ifdef Q_OS_WIN
    iso15693lockblock myiso15693lockblock = (iso15693lockblock)QLibrary("OUR_MIFARE.dll").resolve("iso15693lockblock");
#else
    iso15693lockblock myiso15693lockblock = (iso15693lockblock)QLibrary("./libOURIDR.so").resolve("iso15693lockblock");
#endif

//获取15693卡系统信息
typedef unsigned char (*iso15693readinfo)(unsigned char flags,unsigned char *uid,unsigned char *revlen,unsigned char *revbuf);
#ifdef Q_OS_WIN
    iso15693readinfo myiso15693readinfo = (iso15693readinfo)QLibrary("OUR_MIFARE.dll").resolve("iso15693readinfo");
#else
    iso15693readinfo myiso15693readinfo = (iso15693readinfo)QLibrary("./libOURIDR.so").resolve("iso15693readinfo");
#endif

//获取15693卡块安全信息
typedef unsigned char (*iso15693readsecuritystate)(unsigned char flags,unsigned char startblock,unsigned char blocknum,unsigned char *uid,unsigned char *revlen,unsigned char *revbuf);
#ifdef Q_OS_WIN
    iso15693readsecuritystate myiso15693readsecuritystate = (iso15693readsecuritystate)QLibrary("OUR_MIFARE.dll").resolve("iso15693readsecuritystate");
#else
    iso15693readsecuritystate myiso15693readsecuritystate = (iso15693readsecuritystate)QLibrary("./libOURIDR.so").resolve("iso15693readsecuritystate");
#endif

//读15693卡指定块
typedef unsigned char (*iso15693readblock)(unsigned char flags,unsigned char startblock,unsigned char blocknum,unsigned char *uid,unsigned char *revlen,unsigned char *piccdatabuf);
#ifdef Q_OS_WIN
    iso15693readblock myiso15693readblock = (iso15693readblock)QLibrary("OUR_MIFARE.dll").resolve("iso15693readblock");
#else
    iso15693readblock myiso15693readblock = (iso15693readblock)QLibrary("./libOURIDR.so").resolve("iso15693readblock");
#endif

//写15693卡指定块
typedef unsigned char (*iso15693writeblock)(unsigned char flags,unsigned char startblock,unsigned char blocknum,unsigned char *uid,unsigned char writelen,unsigned char *writebuf);
#ifdef Q_OS_WIN
    iso15693writeblock myiso15693writeblock= (iso15693writeblock)QLibrary("OUR_MIFARE.dll").resolve("iso15693writeblock");
#else
    iso15693writeblock myiso15693writeblock= (iso15693writeblock)QLibrary("./libOURIDR.so").resolve("iso15693writeblock");
#endif

//检测输入数据是否为16进制数
static bool checkinput(QString inputstr){
    QString inputyes="0123456789abcdefABCDEF";
    for(int i=0;i<inputstr.length();i++){
        if(inputyes.contains(inputstr.mid(i,1),Qt::CaseSensitive)){
        }else{return false;}
    }
    return true;
}

//检测动态库文件是否在运行目录内
static bool checkdllos(){
#ifdef Q_OS_WIN
    QLibrary mylib("OUR_MIFARE.dll");
    if (!mylib.load()){                //判断windows系统下,OUR_MIFARE.dll是否在运行目录内
        QMessageBox::information(NULL, "提示", "请将OUR_MIFARE.dll文件拷贝到生成exe文件相同目录下!");
        return false;
    }else{return true;}
#else
    QLibrary mylib("./libOURIDR.so");
    if (!mylib.load()){                //判断linux系统下,libOURIDR.so是否正运行目录内
        QMessageBox::information(NULL, "提示", "请将libOURIDR.so文件拷贝到生成的运行文件相同目录下!");
        return false;
    }else{return true;}
#endif
}

//显示返回的错误代码信息
static void disperrinf(unsigned char result){
    switch (result) {
    case 1:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",0~2块都没读出来,可能刷卡太块。但卡序列号已被读出来!");
        break;
    case 2:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",第0块已被读出,但1~2块读取失败。卡序列号已被读出来!");
        break;
    case 3:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",第0、1块已被读出,但2块读取失败。卡序列号已被读出来!");
        break;
    case 8:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",未寻到卡,请重新拿开卡后再放到感应区!");
        break;
    case 9:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",有多张卡在感应区,寻卡过程中防冲突失败,读序列吗错误!");
        break;
    case 10:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",该卡可能已被休眠,无法选中卡片!");
        break;
    case 11:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",密码装载失败!");
        break;
    case 12:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",卡片密码认证失败!");
        break;
    case 13:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",读指定块失败,原因是刷卡太快或本块所对应的区还没通过密码认证!");
        break;
    case 14:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",写指定块失败,原因是刷卡太快或本块所对应的区还没通过密码认证!");
        break;
    case 18:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",写UID失败,此卡可能不是UID卡!");
        break;
    case 22:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",动态库或驱动程序异常!");
        break;
    case 23:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",驱动程序错误或发卡器尚未安装!");
        break;
    case 24:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",操作超时,一般是动态库没有反应!");
        break;
    case 25:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",发送字数不够!");
        break;
    case 26:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",驱动程序错误或发卡器尚未安装!");
        break;
    case 27:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",操作超时,一般是动态库没有反应!");
        break;
    case 28:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",发送字数不够!");
        break;
    default:
        QMessageBox::critical(NULL, "提示", QString::asprintf("错误代码:%d", result)+",未知的错误信息!");
        break;
    }
}


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pb_beep_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    status = mypcdbeep(30);
    if(status==0){
    }
    else
    {
        disperrinf(status);
    }
}


void MainWindow::on_pb_getdevnum_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char devicenumber[4];
    unsigned char status;
    status = mypcdgetdevicenumber(devicenumber);
    if(status==0){
        mypcdbeep(30);
        QMessageBox::information(NULL, "提示", QString::asprintf("设备编号:%03d-%03d-%03d-%03d", devicenumber[0],devicenumber[1],devicenumber[2],devicenumber[3]));
    }
    else
    {
        disperrinf(status);
    }
}


void MainWindow::on_pb_easyread_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char ctrlword=0x00;    //读任何卡,不需指定卡号,读完后不静止该卡,可赋值NEEDSERIAL及NEEDHALT的组合模式,或为0
    unsigned char afi;
    unsigned char myuid[8];
    unsigned char startblock;
    unsigned char blocknum;
    unsigned char piccdatabuf[255];

    ui->lineEdit_uid->setText("");
    ui->plainTextEdit_data->setPlainText("");

    QString afistr=ui->lineEdit_afi->text().trimmed();
    if(afistr.length()==2 and checkinput(afistr)){
        bool ok;
        afi=afistr.toInt(&ok,16);
    }else{
        QMessageBox::critical(NULL, "提示","请输入2位16进制AFI!");
        ui->lineEdit_afi->setFocus();
        return;
    }

    startblock=ui->spinBox_star->value();
    blocknum=ui->spinBox_num->value();

    if(blocknum>12){
        QMessageBox::critical(NULL, "提示","一次最多只能读取12块数据!");
        return;
    }

    status = myiso15693readex(ctrlword,afi,startblock,blocknum,myuid,piccdatabuf);
    if(status==0){
        mypcdbeep(30);
        QString uidstr="";
        for(int i=0;i<8;i++){
            uidstr=uidstr+QString::asprintf("%02X", myuid[i]);
        }
        ui->lineEdit_uid->setText(uidstr);
        QString datastr="";
        for(int i=1;i<=piccdatabuf[0];i++){
            datastr=datastr+QString::asprintf("%02X ", piccdatabuf[i]);
        }
        ui->plainTextEdit_data->setPlainText(datastr);
        QMessageBox::information(NULL, "提示", "读卡成功,卡片UID:"+uidstr);
    }
    else
    {
        if(status==46){
            QString uidstr="";
            for(int i=0;i<8;i++){
                uidstr=uidstr+QString::asprintf("%02X", myuid[i]);
            }
            ui->lineEdit_uid->setText(uidstr);
            QMessageBox::information(NULL, "提示", "本次读取的块数超过卡片允许的一次读取最多块数,读取卡片UID:"+uidstr);
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_easywrite_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char ctrlword=0x00;    //读任何卡,不需指定卡号,读完后不静止该卡,可赋值NEEDSERIAL及NEEDHALT的组合模式,或为0
    unsigned char afi=0x00;
    unsigned char myuid[8];
    unsigned char startblock;
    unsigned char blocknum;
    unsigned char piccdatabuf[255];
    unsigned char eachblocksize;

    ui->lineEdit_uid->setText("");

    QString afistr=ui->lineEdit_afi->text().trimmed();
    if(afistr.length()==2 and checkinput(afistr)){
        bool ok;
        afi=afistr.toInt(&ok,16);
    }else{
        QMessageBox::critical(NULL, "提示","请输入2位16进制AFI!");
        return;
    }

    startblock=ui->spinBox_star->value();
    blocknum=ui->spinBox_num->value();

    if(blocknum>12){
        QMessageBox::critical(NULL, "提示","一次最多只能写12块数据!");
        return;
    }

    switch(ui->comboBox_cardtype->currentIndex()){
    case 0:
        eachblocksize=4;
        break;
    case 1:
        eachblocksize=8;
        break;
    default:
        eachblocksize=32;
        break;
    }

    piccdatabuf[0]=blocknum*eachblocksize;

    //检测写卡数据
    QChar ch;
    QString writinf = ui->plainTextEdit_data->toPlainText().trimmed();
    QString writinf1 = "";
    int m = 1;
    int n = 0;
    char s;

    if(writinf.length()<1){
        QMessageBox::critical(NULL, "提示", "请输入正确的16进制写卡数据!");
        ui->plainTextEdit_data->setFocus();
        return;
    }

    ch = writinf.at(0);
    s = writinf.at(0).toLatin1();
    for(int i=0; i<writinf.length() ; i++)
    {
        ch = writinf.at(i);
        s = writinf.at(i).toLatin1();
        if((('0' <= s) && (s <= '9')) || (('A' <= s) && (s <= 'F')) || (('a' <= s) && (s <= 'f')))
        {
            writinf1 += ch;
            n++;
            if(n==2){
                bool ok;
                piccdatabuf[m++] = writinf1.toInt(&ok,16);
                writinf1 = "";
                n = 0;
                if(m>=49){
                    break;
                }
            }
        }
        else if(s == ' '){

        }
        else
        {
            QMessageBox::critical(NULL, "提示", "写卡数据错误,请输入正确的16进制数据!");
            ui->plainTextEdit_data->setFocus();
            return;
        }
    }

    if(m<=piccdatabuf[0]){
        QMessageBox::critical(NULL, "提示", "写卡数据不足,请输入"+QString::asprintf("错误代码:%d", piccdatabuf[0])+"个字节16进制数据!");
        ui->plainTextEdit_data->setFocus();
        return;
    }

    status = myiso15693writeex(ctrlword,afi,startblock,blocknum,myuid,piccdatabuf);

    if(status==0){
        mypcdbeep(30);
        QString uidstr="";
        for(int i=0;i<8;i++){
            uidstr=uidstr+QString::asprintf("%02X", myuid[i]);
        }
        ui->lineEdit_uid->setText(uidstr);
        QMessageBox::information(NULL, "提示", "写卡成功,卡片UID:"+uidstr);
    }
    else
    {
        if(status==45){
            QString uidstr="";
            for(int i=0;i<8;i++){
                uidstr=uidstr+QString::asprintf("%02X", myuid[i]);
            }
            ui->lineEdit_uid->setText(uidstr);
            QMessageBox::information(NULL, "提示", "每块字节数选错,卡片UID:"+uidstr);
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_search1_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char afi;
    unsigned char maskuid[8];   //卡号掩码,一般可以不理这个参数
    unsigned char masklen;
    unsigned char uid[9];

    ui->lineEdit_uid->setText("");

    ui->lineEdit_flags->setText("36");
    flags=54;

    QString afistr=ui->lineEdit_afi->text().trimmed();
    if(afistr.length()==2 and checkinput(afistr)){
        bool ok;
        afi=afistr.toInt(&ok,16);
    }else{
        QMessageBox::critical(NULL, "提示","请输入2位16进制AFI!");
        return;
    }

    QString masklstr=ui->lineEdit_masklen->text().trimmed();
    if(masklstr.length()==2 and checkinput(masklstr)){
        bool ok;
        masklen=masklstr.toInt(&ok,16);
    }else{
        QMessageBox::critical(NULL, "提示","请输入2位16进制掩码长度!");
        return;
    }

    status = myiso15693inventory(flags, afi, masklen, maskuid, uid);
    if(status==0){
        mypcdbeep(30);
        ui->lineEdit_dsfid->setText(QString::asprintf("%02X", uid[0]));
        QString uidstr="";
        for(int i=1;i<9;i++){
            uidstr=uidstr+QString::asprintf("%02X", uid[i]);
        }
        ui->lineEdit_uid->setText(uidstr);
    }else{
        disperrinf(status);
    }
}


void MainWindow::on_pb_searchall_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char afi;
    unsigned char maskuid[8];   //卡号掩码,一般可以不理这个参数
    unsigned char masklen;
    unsigned char uid[9];
    unsigned char revlen[1];

    ui->lineEdit_uid->setText("");
    ui->comboBox_uid->clear();

    ui->lineEdit_flags->setText("16");
    flags=22;

    QString afistr=ui->lineEdit_afi->text().trimmed();
    if(afistr.length()==2 and checkinput(afistr)){
        bool ok;
        afi=afistr.toInt(&ok,16);
    }else{
        QMessageBox::critical(NULL, "提示","请输入2位16进制AFI!");
        ui->lineEdit_afi->setFocus();
        return;
    }

    QString masklstr=ui->lineEdit_masklen->text().trimmed();
    if(masklstr.length()==2 and checkinput(masklstr)){
        bool ok;
        masklen=masklstr.toInt(&ok,16);
    }else{
        QMessageBox::critical(NULL, "提示","请输入2位16进制掩码长度!");
        return;
    }

    status = myiso15693inventory16(flags, afi, masklen, maskuid,revlen, uid);
    if(status==0){
        mypcdbeep(30);
        ui->lineEdit_dsfid->setText(QString::asprintf("%02X", uid[0]));
        QString uidstr="";
        for(int i=1;i<9;i++){
            uidstr=uidstr+QString::asprintf("%02X", uid[i]);
        }
        ui->lineEdit_uid->setText(uidstr);

//        QStringList strlist;

        int j=0;
        while (j<revlen[0]){
            QString cardinfstr="DSFID:"+QString::asprintf("%02X", uid[j])+",UID:";
            for (int i=1;i<9;i++){
                cardinfstr=cardinfstr+QString::asprintf("%02X", uid[j+i]);
            }
//            strlist.append(cardinfstr);
            ui->comboBox_uid->addItem(cardinfstr);
            j=j+9;
        }
//        model = new QStringListModel(strlist);      //QStringListModel将QStringList包装了起来
//        ui->listView->setModel(model);              //填充到listview
//        ui->listView->setEditTriggers(QAbstractItemView::NoEditTriggers);  //设置item内容不可编辑
    }else{
        disperrinf(status);
    }
}


void MainWindow::on_pb_quiet_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char uid[8];

    ui->lineEdit_flags->setText("22");
    flags=34;

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
        bool ok;
        for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
        }
    }else{
        QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
        ui->lineEdit_uid->setFocus();
        return;
    }

    status = myiso15693stayquiet(flags, uid);
    if(status==0){
        mypcdbeep(30);
        QMessageBox::information(NULL, "提示", "操作成功,卡片已静止!");
    }else{
        if(status==40){
            QMessageBox::critical(NULL, "提示","使卡进入静止(Quiet)状态失败!");
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_select_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char uid[8];

    ui->lineEdit_flags->setText("22");
    flags=34;

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
        bool ok;
        for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
        }
    }else{
        QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
        ui->lineEdit_uid->setFocus();
        return;
    }

    status = myiso15693Select(flags, uid);
    if(status==0){
        mypcdbeep(30);
        QMessageBox::information(NULL, "提示", "操作成功,卡片已在选中状态!");
    }else{
        if(status==41){
            QMessageBox::critical(NULL, "提示","使卡进入选中状态失败!");
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_restare_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char uid[8];

    ui->lineEdit_flags->setText("22");
    flags=34;

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
        bool ok;
        for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
        }
    }else{
        QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
        ui->lineEdit_uid->setFocus();
        return;
    }

    status = myiso15693resettoready(flags, uid);
    if(status==0){
        mypcdbeep(30);
        QMessageBox::information(NULL, "提示", "操作成功,卡片已从静止中重起到准备状态!");
    }else{
        if(status==42){
            QMessageBox::critical(NULL, "提示","让卡从静止中重起准备失败!");
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_afi_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char afi;
    unsigned char uid[8];

    ui->lineEdit_flags->setText("22");
    flags=34;

    QString afistr=ui->lineEdit_afi->text().trimmed();
    if(afistr.length()==2 and checkinput(afistr)){
        bool ok;
        afi=afistr.toInt(&ok,16);
    }else{
        QMessageBox::critical(NULL, "提示","请输入2位16进制AFI!");
        ui->lineEdit_afi->setFocus();
        return;
    }

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
        bool ok;
        for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
        }
    }else{
        QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
        ui->lineEdit_uid->setFocus();
        return;
    }

    status = myiso15693writeafi(flags, afi,uid);
    if(status==0){
        mypcdbeep(30);
        QMessageBox::information(NULL, "提示", "写AIF操作成功!");
    }else{
        if(status==46){
            QMessageBox::critical(NULL, "提示","写AIF操作失败!");
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_dsfid_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char dsfid;
    unsigned char uid[8];

    ui->lineEdit_flags->setText("22");
    flags=34;

    QString dsfidstr=ui->lineEdit_dsfid->text().trimmed();
    if(dsfidstr.length()==2 and checkinput(dsfidstr)){
        bool ok;
        dsfid=dsfidstr.toInt(&ok,16);
    }else{
        QMessageBox::critical(NULL, "提示","请输入2位16进制dsfid!");
        ui->lineEdit_dsfid->setFocus();
        return;
    }

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
        bool ok;
        for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
        }
    }else{
        QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
        ui->lineEdit_uid->setFocus();
        return;
    }

    status = myiso15693writedsfid(flags, dsfid,uid);
    if(status==0){
        mypcdbeep(30);
        QMessageBox::information(NULL, "提示", "写DSFID操作成功!");
    }else{
        if(status==41){
            QMessageBox::critical(NULL, "提示","写DSFID操作失败!");
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_systeminf_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char uid[8];
    unsigned char revlen[1];
    unsigned char revbuf[255];

    ui->plainTextEdit_data->setPlainText("");

    ui->lineEdit_flags->setText("22");
    flags=34;

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
        bool ok;
        for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
        }
    }else{
        QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
        ui->lineEdit_uid->setFocus();
        return;
    }

    status = myiso15693readinfo(flags, uid,revlen,revbuf);
    if(status==0){
        mypcdbeep(30);
        int j=0;
        QString cardinfstr="";
        while (j<revlen[0]){
            cardinfstr=cardinfstr+QString::asprintf("%02X ", revbuf[j]);
            j++;
        }
        ui->plainTextEdit_data->setPlainText(cardinfstr);
        QMessageBox::information(NULL, "提示", "读取卡片系统信息成功!");
    }else{
        disperrinf(status);
    }
}


void MainWindow::on_pb_secure_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char startblock;
    unsigned char blocknum;
    unsigned char uid[8];
    unsigned char revlen[1];
    unsigned char revbuf[255];

    ui->plainTextEdit_data->setPlainText("");

    ui->lineEdit_flags->setText("22");
    flags=34;

    startblock=ui->spinBox_star->value();
    blocknum=ui->spinBox_num->value();

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
        bool ok;
        for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
        }
    }else{
        QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
        ui->lineEdit_uid->setFocus();
        return;
    }

    status = myiso15693readsecuritystate(flags, startblock,blocknum,uid,revlen,revbuf);
    if(status==0){
        mypcdbeep(30);
        int j=0;
        QString cardinfstr="";
        while (j<revlen[0]){
            cardinfstr=cardinfstr+QString::asprintf("%02X ", revbuf[j]);
            j++;
        }
        ui->plainTextEdit_data->setPlainText(cardinfstr);
        QMessageBox::information(NULL, "提示", "读取卡片系统信息成功!");
    }else{
        disperrinf(status);
    }
}


void MainWindow::on_pb_lockafi_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    int answ=QMessageBox::question (this, "警告", "你确定要锁定卡片的AFI吗 ?锁定后不可以再次修改!", QMessageBox::Ok, QMessageBox::Cancel);
    if (answ ==1024){
        unsigned char status;
        unsigned char flags;
        unsigned char uid[8];

        ui->lineEdit_flags->setText("22");
        flags=34;

        QString uidstr=ui->lineEdit_uid->text().trimmed();
        if(uidstr.length()==16 and checkinput(uidstr)){
            bool ok;
            for(int i=0;i<8;i++){
                uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
            }
        }else{
            QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
            ui->lineEdit_uid->setFocus();
            return;
        }

        status = myiso15693lockafi(flags, uid);
        if(status==0){
            mypcdbeep(30);
            QMessageBox::information(NULL, "提示", "锁AFI操作成功!");
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_lockdsfid_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    int answ=QMessageBox::question (this, "警告", "你确定要锁定卡片的DSFID吗 ?锁定后不可以再次修改!", QMessageBox::Ok, QMessageBox::Cancel);
    if (answ ==1024){
        unsigned char status;
        unsigned char flags;
        unsigned char uid[8];

        ui->lineEdit_flags->setText("22");
        flags=34;

        QString uidstr=ui->lineEdit_uid->text().trimmed();
        if(uidstr.length()==16 and checkinput(uidstr)){
            bool ok;
            for(int i=0;i<8;i++){
                uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
            }
        }else{
            QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
            ui->lineEdit_uid->setFocus();
            return;
        }

        status = myiso15693lockdsfid(flags, uid);
        if(status==0){
            mypcdbeep(30);
            QMessageBox::information(NULL, "提示", "数据存储格式标识DSFID锁定成功!");
        }else{
            disperrinf(status);
        }
    }
}


void MainWindow::on_pb_lockdata_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    int answ=QMessageBox::question (this, "警告", "你确定要锁定卡片的数据块吗 ?锁定后不可以再次修改!", QMessageBox::Ok, QMessageBox::Cancel);
    if (answ ==1024){
        unsigned char status;
        unsigned char flags;
        unsigned char startblock;
        unsigned char uid[8];

        ui->lineEdit_flags->setText("22");
        flags=34;

        startblock=ui->spinBox_star->value();

        QString uidstr=ui->lineEdit_uid->text().trimmed();
        if(uidstr.length()==16 and checkinput(uidstr)){
            bool ok;
            for(int i=0;i<8;i++){
                uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
            }
        }else{
            QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
            ui->lineEdit_uid->setFocus();
            return;
        }

        status = myiso15693lockblock(flags,startblock, uid);
        if(status==0){
            mypcdbeep(30);
            QMessageBox::information(NULL, "提示", "数据块锁定成功!");
        }else{
            disperrinf(status);
        }
    }
}




void MainWindow::on_pb_read_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char startblock;
    unsigned char blocknum;
    unsigned char uid[8];
    unsigned char revlen[1];
    unsigned char revbuf[255];

    ui->plainTextEdit_data->setPlainText("");

    ui->lineEdit_flags->setText("22");
    flags=34;

    startblock=ui->spinBox_star->value();
    blocknum=startblock+ui->spinBox_num->value();

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
        bool ok;
        for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
        }
    }else{
        QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
        ui->lineEdit_uid->setFocus();
        return;
    }

    QString blockdata="";
    while (startblock<blocknum){
        status = myiso15693readblock(flags, startblock, 1, uid, revlen, revbuf);
        if(status==0){
            int j=0;

            while(j<revlen[0]){
                blockdata=blockdata+QString::asprintf("%02X ", revbuf[j]);
                j++;
            }
            startblock++;
        }else{
            blocknum=startblock-1;
        }
    }
    if(startblock==blocknum){
        mypcdbeep(30);
        ui->plainTextEdit_data->setPlainText(blockdata);
        QMessageBox::information(NULL, "提示", "读卡成功,卡片UID:"+uidstr);
    }else{
         QMessageBox::critical(NULL, "提示",QString::asprintf("在读取第 :%d", startblock)+",块时返回错误代码:"+QString::asprintf("%d", status));
    }

}


void MainWindow::on_pb_write_clicked()
{
    if(!checkdllos()){return;}      //判断运行目录内动态库文件是否存在

    unsigned char status;
    unsigned char flags;
    unsigned char eachblocksize;
    unsigned char startblock;
    unsigned char blocknum;
    unsigned char uid[8];

    unsigned char writebuf[2000];
    int writelen;

    ui->lineEdit_flags->setText("22");
    flags=34;

    startblock=ui->spinBox_star->value();
    blocknum=startblock+ui->spinBox_num->value();
    switch(ui->comboBox_cardtype->currentIndex()){
    case 0:
         eachblocksize=4;
         break;
    case 1:
         eachblocksize=8;
         break;
    default:
         eachblocksize=32;
         break;
    }
    writelen=blocknum*eachblocksize;

    QString uidstr=ui->lineEdit_uid->text().trimmed();
    if(uidstr.length()==16 and checkinput(uidstr)){
         bool ok;
         for(int i=0;i<8;i++){
            uid[i]=QString(uidstr.mid(i*2,2)).toInt(&ok,16);
         }
    }else{
         QMessageBox::critical(NULL, "提示","请先寻找卡片或输入16位16进制UID!");
         ui->lineEdit_uid->setFocus();
         return;
    }

    for(int i=0;i<2000;i++){writebuf[i]=0x00;}


    //检测写卡数据
    QChar ch;
    QString writinf = ui->plainTextEdit_data->toPlainText().trimmed();
    QString writinf1 = "";
    int m = 0;
    int n = 0;
    char s;

    if(writinf.length()<1){
         QMessageBox::critical(NULL, "提示", "请输入正确的16进制写卡数据!");
         ui->plainTextEdit_data->setFocus();
         return;
    }

    ch = writinf.at(0);
    s = writinf.at(0).toLatin1();
    for(int i=0; i<writinf.length() ; i++)
    {
         ch = writinf.at(i);
         s = writinf.at(i).toLatin1();
         if((('0' <= s) && (s <= '9')) || (('A' <= s) && (s <= 'F')) || (('a' <= s) && (s <= 'f')))
         {
            writinf1 += ch;
            n++;
            if(n==2){
                bool ok;
                writebuf[m++] = writinf1.toInt(&ok,16);
                writinf1 = "";
                n = 0;
            }
         }
         else if(s == ' '){

         }
         else
         {
            QMessageBox::critical(NULL, "提示", "写卡数据错误,请输入正确的16进制数据!");
            ui->plainTextEdit_data->setFocus();
            return;
         }
    }

    int i=0;
    while (startblock<blocknum){
         unsigned char wbuf[eachblocksize];
         for(int j=0;j<eachblocksize;j++){
            wbuf[j]=writebuf[i+j];

         }
         status = myiso15693writeblock(flags, startblock, 1, uid, eachblocksize, wbuf);
         if(status==0){
            startblock=startblock+1;
            i=i+eachblocksize;
         }else{
            blocknum=startblock-1;
         }
    }
    if(startblock==blocknum){
        mypcdbeep(30);
        QMessageBox::information(NULL, "提示", "写卡成功,卡片UID:"+uidstr);
    }else{
         QMessageBox::critical(NULL, "提示",QString::asprintf("在写第 :%d", startblock)+",块时返回错误代码:"+QString::asprintf("%d", status));
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/649464.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

mock测试(挡板测试)

https://www.cnblogs.com/lc-blogs/p/17027617.html mock测试&#xff08;挡板测试&#xff09;就是在测试过程中&#xff0c;对于某些不容易构造或者不容易获取的对象&#xff0c;用一个虚拟的对象来创建以便测试的测试方法。 比如&#xff1a;测试天气这个接口&#xff0c;最…

RIP协议路由配置(Cisco Packet Tracer)

实验环境&#xff1a; windows10操作系统、思科模拟器、网络正常&#xff1b; 实验内容&#xff1a; 新建packettracer拓扑图&#xff1b;设置PC机的网络配置信息&#xff1b;配置路由器的接口IP&#xff1b;为路由器的RIP添加地址&#xff1b;为路由器添加静态路由。测试PC…

由于找不到wpcap.dll导致软件无法运行的解决办法,特此记录

由于找不到wpcap.dll导致软件无法运行的解决办法&#xff0c;特此记录提示 目录 前言 一、解决找不到wpcap.dll错误的办法 前言 今天在运行一个软件时弹出&#xff0c;找不到wpcap.dll&#xff0c;无法运行的弹出&#xff0c;目前已解决此问题&#xff0c;特此记录&#xff…

MQTT服务等级

1.QoS含义 Quality of Service,服务质量 很多时候&#xff0c;使用 MQTT 协议的设备都运行在网络受限的环境下&#xff0c;而只依靠底层的 TCP传输协议&#xff0c;并不能完全保证消息的可靠到达。因此&#xff0c;MQTT 提供了 QoS机制&#xff0c;其核心是设计了多种消息交互…

什么是electron?

Electron是一个使用 JavaScript、HTML 和 CSS 构建桌面应用程序的框架。 嵌入 Chromium 和 Node.js 到 二进制的 Electron 允许您保持一个 JavaScript 代码代码库并创建 在Windows上运行的跨平台应用 macOS和Linux——不需要本地开发 经验 election的主要组成部分&#xff1a;…

5、共享模型之内存

目录 5.1 Java的内存模型5.2 可见性1、退不出的循环2、解决办法&#xff1a;3、可见性 vs 原子性 5.3 有序性1、为什么会有指令重排2、如何禁止指令重排3、原理之volatile4、happens-before 5.1 Java的内存模型 JMM 即 Java Memory Model&#xff08;Java内存模型&#xff09;…

如何学习Java“高并发”,并在项目中实际应用?

前几天收到一位粉丝私信&#xff0c;说的是他才一年半经验&#xff0c;去面试却被各种问到分布式&#xff0c;高并发&#xff0c;多线程之间的问题。基础层面上的是可以答上来&#xff0c;但是面试官深问的话就不会了&#xff01;被问得都怀疑现在Java招聘初级岗位到底招的是初…

DMHS同步原理介绍以及DM8同步到DM8

一、DMHS原理介绍 1.DMHS介绍 达梦数据实时同步软件 DMHS 是达梦公司推出的新一代支持异构环境的高性能、高可靠和高可扩展的数据库实时同步系统。该产品基于成熟的关系数据模型和标准接口&#xff0c;跨越多种软硬件平台实现秒级数据实时同步。该产品可广泛应用于应急系统、…

什么是产品经理 | 文末赠书

目录 一. 产品经理是什么&#xff1f;二. 产品经理需要具备的技能三. 产品经理的职责四. 产品经理在软件开发过程中如何平衡不同利益方的需求&#xff1f;五. 入门建议六. 发展前景七. 总结&#x1f981;文末福利图书介绍作者简介 一. 产品经理是什么&#xff1f; 产品经理是指…

使用阿里巴巴开源神器Arthas进行性能分析

目录 前言&#xff1a; Arthas介绍 启动 分析命令 Profiler工具 前言&#xff1a; Arthas是一款由阿里巴巴开源的Java诊断工具&#xff0c;它可以在生产环境中帮助开发人员快速地定位问题&#xff0c;并进行高效的性能分析。通过在命令行中输入简单的命令&#xff0c;开发人员…

Win10开机后自动显示右键菜单怎么办?

Win10开机后自动显示右键菜单怎么办&#xff1f;用户打开Win10电脑后发现电脑自动显示右键菜单&#xff0c;如果是使用联想电脑的用户&#xff0c;需要打开联想管家&#xff0c;关掉联想锁屏即可&#xff0c;若是系统不兼容导致的&#xff0c;这时候用户就需要恢复Win10系统来解…

前端性能优化:高在性能,大在范围,必要前置知识一网打尽!(上)

前言 前端性能优化 又是个听起来很高大上的词&#xff0c;确实是的&#xff0c;因为它需要 高在性能&#xff0c;大在范围 &#xff0c;所幸很多大佬都已经输出了很多高质量的内容供大家参考&#xff0c;作者最近也在学习和了解这方面的内容&#xff0c;对如下文中的一些理解若…

死磕测试 10 余年,呕心整理出了核心知识点已经做成PDF,无私奉献

前言&#xff1a; 想在面试、工作中脱颖而出&#xff1f;想在最短的时间内快速掌握 软件测试 的核心基础知识点&#xff1f;想要成为一位优秀的测试工程师&#xff1f;本篇文章能助你一臂之力&#xff01; 目前正值招聘求职旺季&#xff0c;很多同学对一些新技术名词都能侃侃…

智能文本生成:进展与挑战

智能文本生成&#xff1a;进展与挑战 万小军 北京大学王选计算机研究所 摘要&#xff1a;智能文本生成是人工智能与自然语言处理领域的前沿研究方向&#xff0c;也是AI生成内容&#xff08;AIGC&#xff09;的关键技术支撑&#xff0c;近些年受到学术界和产业界的高度关注&…

[笔记]pg常用命令

数据库版本 &#xff1a;9.6.6 注意 &#xff1a;PostgreSQL中的不同类型的权限有SELECT,INSERT,UPDATE,DELETE,TRUNCATE,REFERENCES,TRIGGER,CREATE,CONNECT,TEMPORARY,EXECUTE 和 USAGE。 1. 登录PG数据库 以管理员身份 postgres 登陆&#xff0c;然后通过 #psql -U postg…

【TA100 】3.3 曲面细分与几何着色器---大规模草渲染

一、两者的应用列举 1-1.曲面细分着色器的应用 ①海浪、雪地等 2著名的应用&#xff1a;和置换贴图&#xff08;DIsplacement mapping&#xff0c;也叫位移贴图&#xff09;结合使用 ● 使用普通法线的模型&#xff0c;在边缘部分的凹凸感会不理想 ● 如果使用置换贴图&#…

HarmonyOS学习路之开发篇—Java UI框架(自定义组件与布局 二)

自定义布局 当Java UI框架提供的布局无法满足需求时&#xff0c;可以创建自定义布局&#xff0c;根据需求自定义布局规则 常用接口 Component类相关接口 接口名称 作用 setEstimateSizeListener 设置测量组件的侦听器 setEstimatedSize 设置测量的宽度和高度 onEstima…

极速了解GPT生态

第一部分&#xff1a; 1、chatGPT:一个大语言模型&#xff0c;可以通过API去访问&#xff0c;下面很多是根据API去访问&#xff0c;然后来进行集成。 2、Vector store&#xff0c;你也可以叫是Vector search&#xff0c;主要目就是存储各种向量&#xff0c;然后去计算向量的各…

【Linux】基础IO——文件描述符:缓冲区的理解

上个月学校考试&#xff0c;进行课程复习&#xff0c;一直没有更新博客&#xff0c;现考试结束&#xff0c;继续保持更新&#xff0c;欢迎大家关注&#xff01; 目录 1 模仿C库自主封装简单的文件接口2 对缓冲区的理解2.1 数据刷新到磁盘的过程分析2.2 如何强制刷新内核 1 模仿…

00后是真的卷不过,工作没两年,跳槽到我们公司起薪17K都快接近我了

在程序员职场上&#xff0c;什么样的人最让人反感呢? 是技术不好的人吗?并不是。技术不好的同事&#xff0c;我们可以帮他。 是技术太强的人吗?也不是。技术很强的同事&#xff0c;可遇不可求&#xff0c;向他学习还来不及呢。 真正让人反感的&#xff0c;是技术平平&…