qt rfid serialport
-
hello can i a question about serialport in qt
[Edit ~aha_1980: Moved to general & desktop]
-
@veysel.olgun Sure you can - which question do you have?
-
void MainWindow::on_all_sector_authentication_clicked() { QString x1,y1; x1=ui->combo_key->currentText(); y1=ui->combo_type->currentText(); int a1,b1; if(x1=="A") { a1=0; } else if(x1=="B") { a1=4; } if(y1=="0") { b1=0; } else if(y1=="1") { b1=1; } QByteArray data; data[8]=a1; data[9]=b1; QString command="DF78"; QString command2="B0"; data[10]=0X4; seriport->write(paketle(command,command2,data)); QByteArray data_read; data_read[8]=0X10; QString command_read="DF78"; QString command2_read="A5"; seriport->write(paketle(command_read,command2_read,data_read)); / / send data to card reader and after take a response but it is now coming }
this is my code, i have a rfid card reader i send a code to authenticate after that i send to data_read to read a specific block (data_read[8]=0X10) BUT it is not work
[koahnig: added code tags]
-
Hi and welcome to devnet,
You have to be more precise than that.
it is no work
doesn't say much.What are you expecting ?
What are you getting ?
What version of Qt are you using ?
What platform are you running ?
Did you connect thereadyRead
signal ?
Did you check that your RFID reader does indeed answer to other commands ? -
@SGaist said in qt rfid serialport:
indeed
first of all thank you to answer,
i am expecting to authentication all of sectors in my mifare card with one push button after that to read all of blocks with one push button
if i send only this seriport->write(paketle(command,command2,data)); it is work and i am getting response from rfid card reader but if i send this, it is no send to response to me
for(int i=0;i<16;i++)
{
QByteArray data;data[8]=a1; //load keyA data[9]=b1; //load key type
QString command="DF78"; mifare command
data[10]=i; // this is saying autenticate to i. sector
}i am using Qt creator 4.5.1
i am using windows10
i am using readyread signal
my rfid card reader working correctly but if i send data with loop it sending data to cardreader but card reader does not send response to me
here what i am saying
for(int i=0;i<16;i++)
{
QByteArray data;data[8]=a1; //load keyA data[9]=b1; //load key type
QString command="DF78"; mifare command
QString command2="B0"; authentication command data[10]=i; //
}
I hope, I could express it correctly.
thank you
-
What answer are you expecting ?
-
this is if i do click "authenticate" button 3 times it give me this datas but i want to click "be authentication all sectors" button just one time, and be authenticate all sectors(i mean sector0,sector1.....sector14,sector15
-
Then you should send the command one after the other only when the last one has finished.
-
actually i try but no work if i click "authenticate " button many times it send to me data (spin box is 1 and i click authenticate button and i am taking data, spin box is 2 and i click authenticate button and i am taking data...)
-
That's the idea of my suggestion: trigger the next command only when you received the answer to the last one, not in a tight loop.
-
thank you i will try this i hope it works that time
-
@veysel-olgun
sir, please share rfid coding