Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

The process "/usr/bin/make" exited with code 2.



  • Goodmorning everyone.

    I have had a problem with my project for several days ... after reinstalling
    the ubuntu on another machine I exported the current project where I'm working.

    On this new machine I encounter this problem ... and I can't understand where ... it comes from.

    Can anyone help me?

    Thanks so much.

    ./agejet/program.cpp: In static member function ‘static Program* Program::import_program(std::__cxx11::string)’:
    ../agejet/program.cpp:28:37: error: cannot convert ‘bool’ to ‘Program*’ in return
         if(!prog_file.is_open()) return false;
                                         ^~~~~
    Makefile:1165: recipe for target 'program.o' failed
    make: *** [program.o] Error 1
    09:28:46: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project agejet (kit: Agejet)
    The kit Agejet has configuration issues which might be the root cause for this problem.
    When executing step "Make"
    09:28:46: Elapsed time: 00:02.   /// error list, down will find the source code
    
    

    Program *Program::import_program(string path)
    {
    ifstream prog_file;
    string line;
    QString name;
    QString support_qs;
    float fr_temp;
    float en_temp;
    QString void_prog;
    bool is_number;
    Program *new_p = new Program();
    new_p->treatment = new Treatment(10,"Program");
    new_p->is_void=1;
    prog_file.open(path);
    if(!prog_file.is_open()) return false; <- // error line
    getline(prog_file,line);
    void_prog = QString::fromStdString(line);
    if(void_prog!="0"){
    prog_file.close();
    return new_p;
    }


  • Qt Champions 2019

    @AntonioValentin The error message already tells you what you're doing wrong: you're trying to return false in a function that returns a pointer. A boolean cannot be implicitly converted to a pointer. Return nullptr instead of false.

    Also, please do not double post same question!
    Duplicate of https://forum.qt.io/topic/109497/project-problem-when-executing-step-make-line-28



  • @jsulm

    So what should you do?

    Change from false to true?

    if(!prog_file.is_open()) return false;

    The post being published has been canceled


  • Qt Champions 2019

    @AntonioValentin said in The process "/usr/bin/make" exited with code 2.:

    So what should you do?

    What I wrote: return nullptr instead of false.
    "Change from false to true?" - I did not write that anywhere and it would not make any difference.
    It is as simple as:

    if(!prog_file.is_open()) return nullptr;
    


  • This post is deleted!


  • @jsulm

    Hy,

    modified the command mentioned above.

    we say that the problem has been solved ... but in another file this error comes up.

    I errori sono questi

    ../agejet/rfid_worker.cpp: In constructor ‘rfid_worker::rfid_worker(QObject*)’:
    ../agejet/rfid_worker.cpp:8:35: warning: unused parameter ‘parent’ [-Wunused-parameter]
     rfid_worker::rfid_worker(QObject *parent)
                                       ^~~~~~
    ../agejet/rfid_worker.cpp: In member function ‘void rfid_worker::check_card_type()’:
    ../agejet/rfid_worker.cpp:80:36: warning: narrowing conversion of ‘(uchar)((rfid_worker*)this)->rfid_worker::MODEL_ADDR_OLD’ from ‘uchar {aka unsigned char}’ to ‘char’ inside { } [-Wnarrowing]
         char read_uid_c[] = {0x0E,0x03,MODEL_ADDR_OLD};
                                        ^~~~~~~~~~~~~~
    ../agejet/rfid_worker.cpp: In member function ‘void rfid_worker::find()’:
    ../agejet/rfid_worker.cpp:113:36: warning: narrowing conversion of ‘(uchar)((rfid_worker*)this)->rfid_worker::UID_ADDR’ from ‘uchar {aka unsigned char}’ to ‘char’ inside { } [-Wnarrowing]
         char read_uid_c[] = {0x04,0x03,UID_ADDR};
                                        ^~~~~~~~
    ../agejet/rfid_worker.cpp:123:25: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
                 if(answ[0]==0x05){
                             ^~~~
    In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:49:0,
                     from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47,
                     from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1,
                     from ../agejet/rfid_worker.h:4,
                     from ../agejet/rfid_worker.cpp:1:
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:534:17: note: candidate 1: bool QByteRef::operator==(char) const
         inline bool operator==(char c) const
                     ^~~~~~~~
    ../agejet/rfid_worker.cpp:123:25: note: candidate 2: operator==(int, int) <built-in>
                 if(answ[0]==0x05){
                             ^~~~
    ../agejet/rfid_worker.cpp: In member function ‘void rfid_worker::open_session()’:
    ../agejet/rfid_worker.cpp:136:35: error: narrowing conversion of ‘250’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
         char init_bytes[] = {0xFA,0x12};
                                       ^
    ../agejet/rfid_worker.cpp: In member function ‘QString rfid_worker::rnd()’:
    ../agejet/rfid_worker.cpp:182:10: warning: unused variable ‘o’ [-Wunused-variable]
         bool o;
              ^
    ../agejet/rfid_worker.cpp: In member function ‘void rfid_worker::tips_charge()’:
    ../agejet/rfid_worker.cpp:234:41: warning: narrowing conversion of ‘(uchar)((rfid_worker*)this)->rfid_worker::TIP_CHARGE_ADDR_OLD’ from ‘uchar {aka unsigned char}’ to ‘char’ inside { } [-Wnarrowing]
         char read_tips_cmd_c[] = {0x0e,0x03,TIP_CHARGE_ADDR_OLD};
                                             ^~~~~~~~~~~~~~~~~~~
    ../agejet/rfid_worker.cpp: In member function ‘void rfid_worker::hp_charge()’:
    ../agejet/rfid_worker.cpp:259:41: warning: narrowing conversion of ‘(uchar)((rfid_worker*)this)->rfid_worker::HP_CHARGE_ADDR_OLD’ from ‘uchar {aka unsigned char}’ to ‘char’ inside { } [-Wnarrowing]
         char read_tips_cmd_c[] = {0x0e,0x03,HP_CHARGE_ADDR_OLD};
                                             ^~~~~~~~~~~~~~~~~~
    ../agejet/rfid_worker.cpp: In member function ‘void rfid_worker::create_aes_masked()’:
    ../agejet/rfid_worker.cpp:281:180: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
         char aes_c[] = {0xFF,0xFF,0xFF,(*card_uid)[0],(*card_uid)[1],(*card_uid)[2],(*card_uid)[3],0xFF,0xFF,0xFF,0xFF,0xFF,(*card_uid)[0],(*card_uid)[1],(*card_uid)[2],(*card_uid)[3]};
                                                                                                                                                                                        ^
    ../agejet/rfid_worker.cpp:281:180: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
    ../agejet/rfid_worker.cpp:281:180: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
    ../agejet/rfid_worker.cpp:281:180: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
    ../agejet/rfid_worker.cpp:281:180: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
    ../agejet/rfid_worker.cpp:281:180: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
    ../agejet/rfid_worker.cpp:281:180: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
    ../agejet/rfid_worker.cpp:281:180: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
    ../agejet/rfid_worker.cpp: In member function ‘void rfid_worker::delete_old_card()’:
    ../agejet/rfid_worker.cpp:288:36: warning: narrowing conversion of ‘(uchar)((rfid_worker*)this)->rfid_worker::TIP_CHARGE_ADDR_OLD’ from ‘uchar {aka unsigned char}’ to ‘char’ inside { } [-Wnarrowing]
         char delete_cmd[] = {0x10,0x13,TIP_CHARGE_ADDR_OLD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
                                        ^~~~~~~~~~~~~~~~~~~
    ../agejet/rfid_worker.cpp:302:21: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
             if(answ[2]!=0x00){
                         ^~~~
    In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:49:0,
                     from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47,
                     from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1,
                     from ../agejet/rfid_worker.h:4,
                     from ../agejet/rfid_worker.cpp:1:
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:536:17: note: candidate 1: bool QByteRef::operator!=(char) const
         inline bool operator!=(char c) const
                     ^~~~~~~~
    ../agejet/rfid_worker.cpp:302:21: note: candidate 2: operator!=(int, int) <built-in>
             if(answ[2]!=0x00){
                         ^~~~
    ../agejet/rfid_worker.cpp:318:21: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
             if(answ[2]==0x00){
                         ^~~~
    In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:49:0,
                     from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47,
                     from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1,
                     from ../agejet/rfid_worker.h:4,
                     from ../agejet/rfid_worker.cpp:1:
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:534:17: note: candidate 1: bool QByteRef::operator==(char) const
         inline bool operator==(char c) const
                     ^~~~~~~~
    ../agejet/rfid_worker.cpp:318:21: note: candidate 2: operator==(int, int) <built-in>
             if(answ[2]==0x00){
                         ^~~~
    ../agejet/rfid_worker.cpp: In member function ‘void rfid_worker::delete_new_card()’:
    ../agejet/rfid_worker.cpp:337:36: warning: narrowing conversion of ‘(uchar)((rfid_worker*)this)->rfid_worker::MODEL_ADDR’ from ‘uchar {aka unsigned char}’ to ‘char’ inside { } [-Wnarrowing]
         char delete_cmd[] = {0x10,0x13,MODEL_ADDR,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
                                        ^~~~~~~~~~
    ../agejet/rfid_worker.cpp:351:21: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
             if(answ[2]!=0x00){
                         ^~~~
    In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:49:0,
                     from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47,
                     from /usr/include/x86_64-linux-gnu/qt5/QtCore/QObject:1,
                     from ../agejet/rfid_worker.h:4,
                     from ../agejet/rfid_worker.cpp:1:
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:536:17: note: candidate 1: bool QByteRef::operator!=(char) const
         inline bool operator!=(char c) const
                     ^~~~~~~~
    ../agejet/rfid_worker.cpp:351:21: note: candidate 2: operator!=(int, int) <built-in>
             if(answ[2]!=0x00){
                         ^~~~
    ../agejet/rfid_worker.cpp: In member function ‘bool rfid_worker::check_tips(QByteArray, uint)’:
    ../agejet/rfid_worker.cpp:384:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
    Makefile:1179: recipe for target 'rfid_worker.o' failed
    make: *** [rfid_worker.o] Error 1
    12:45:11: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project agejet (kit: Agejet)
    The kit Agejet has configuration issues which might be the root cause for this problem.
    When executing step "Make"
    12:45:11: Elapsed time: 00:02.
    

    File. - >

    #include "rfid_worker.h"
    #include <iostream>
    #include <fstream>
    #include <QString>
    #include "agejet.h"
    
    using namespace std;
    rfid_worker::rfid_worker(QObject *parent)
    {
        key_hex_clean = &Agejet::key_hex_clean;
        iv_hex = &Agejet::iv_hex;
        card_uid = &Agejet::card_uid;
    
        rs.setPortName(Agejet::rfid_serial_path);
        //rs.setPortName("/dev/ttyUSB1");
        rs.setBaudRate(QSerialPort::Baud9600);
        rs.setDataBits(QSerialPort::Data8);
        rs.setParity(QSerialPort::NoParity);
        rs.setStopBits(QSerialPort::OneStop);
        rs.setFlowControl(QSerialPort::NoFlowControl);
        rs.setDataBits(QSerialPort::Data8);
    }
    
    rfid_worker::~rfid_worker()
    {
    
    }
    
    void rfid_worker::run()
    {
        if(!rs.isOpen()){
            rs.open(QSerialPort::ReadWrite);
        }
        *outer_lock = true;
        if(rfid_function=="find"){
            find();
        }
        else {
            if(rfid_function=="open_session"){
                open_session();
            }
            else {
                if(rfid_function=="check_card"){
                    check_card_type();
                }
                else {
                    if(rfid_function=="hp_charge"){
                        hp_charge();
                    }
                    else {
                        if(rfid_function=="tip_charge"){
                            tips_charge();
                        }
                        else {
                            if(rfid_function=="tip_charge"){
                                tips_charge();
                            }
                            else {
                                if(rfid_function=="delete_old_card"){
                                    delete_old_card();
                                }
                                else {
                                    if(rfid_function=="delete_new_card"){
                                        delete_new_card();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        *outer_lock = false;
        rs.close();
    }
    
    void rfid_worker::check_card_type()
    {
    
        char read_uid_c[] = {0x0E,0x03,MODEL_ADDR_OLD};
        QByteArray ba_cmd = QByteArray(read_uid_c,4);
        QByteArray answ;
        QByteArray card_type_enc;
    
        rs.write(ba_cmd,3);
        rs.flush();
        rs.waitForBytesWritten(300);
        rs.waitForReadyRead(400);
    
        answ=rs.readAll();
        if(answ.length()==19){
            card_type_enc=answ.mid(3);
            Agejet::old_card_type = true;
        }
        else{
            Agejet::rfid_error=Agejet::CARD_TYPE;
            return;
        }
    
    
        //REIMPLEMNTARE:TOLTO PER HONG KONG
        /*int model_read = 17;
        Agejet::model==17;
        if(!model_read == Agejet::model){
            Agejet::rfid_error=Agejet::CARD_TYPE;
            return;
        }*/
    
    }
    
    void rfid_worker::find()
    {
        char read_uid_c[] = {0x04,0x03,UID_ADDR};
        QByteArray read_uid = QByteArray(read_uid_c);
        QByteArray answ;
        for(int i=0;i<wait_for_card_t;i+=retry_find_card_t){
            rs.write(read_uid,3);
            rs.flush();
            rs.waitForBytesWritten(200);
            rs.waitForReadyRead(300);
            answ=rs.readAll();
            if(answ.length()==7){
                if(answ[0]==0x05){
                    *card_uid = answ.mid(3);
                    create_aes_masked();
                    Agejet::rfid_error=Agejet::NO_ERROR;
                    return;
                }
            }
        }
        Agejet::rfid_error=Agejet::NOT_FOUND;
    }
    
    void rfid_worker::open_session()
    {
        char init_bytes[] = {0xFA,0x12};
        QByteArray ba_cmd = QByteArray(init_bytes);
        //QString rndA = rnd();
        QByteArray rndA = "AAAAAAAAAAAAAAAA";
        QByteArray rndA_enc;
        encrypt(rndA,rndA_enc);
        ba_cmd.append(rndA_enc);
    
        rs.write(ba_cmd,18);
        rs.flush();
        rs.waitForBytesWritten(200);
        rs.waitForReadyRead(300);
        QByteArray ba_answ = rs.readAll();
        QByteArray rndA_enc_shift_l = ba_answ.mid(3,16);
        QByteArray rndA_xor_rndB_enc_shift_l_reader = ba_answ.mid(19,16);
        QByteArray rndA_shift;
        decrypt(rndA_enc_shift_l,rndA_shift,*key_hex_clean);
        QByteArray rndA_from_reader;
        rndA_from_reader = rndA_shift.prepend(rndA_shift.at(15));
        rndA_from_reader = rndA_from_reader.mid(0,16);
        QByteArray rndA_xor_rndB_shift_l_reader;
        QByteArray rndB;
        decrypt(rndA_xor_rndB_enc_shift_l_reader,rndA_xor_rndB_shift_l_reader,*key_hex_clean);
        for(int i= 0;i < 16;i++) {
            rndB.append(((uchar)rndA_xor_rndB_shift_l_reader[i])^((uchar)rndA_enc[i]));
        }
        QByteArray rndB_shift;
        rndB_shift=rndB;
        rndB_shift.append(rndB_shift.at(0));
        rndB_shift= rndB_shift.mid(1,16);
    
        QByteArray rndB_shift_enc;
        encrypt(rndB_shift,rndB_shift_enc);
    
        QByteArray ba_cmd2 = init_bytes;
        ba_cmd2.append(rndB_shift_enc);
        rs.write(ba_cmd2,18);
        rs.flush();
        rs.waitForBytesWritten(200);
        rs.waitForReadyRead(300);
        ba_answ = rs.readAll();
    }
    
    QString rfid_worker::rnd()
    {
        int i=0;
        bool o;
        QString rnd_hex= "";
        while (i<2) {
            QString rnd=QString::number(qrand(),16);
            if(rnd.length()==8){
                rnd_hex+=rnd;
                i++;
            }
        }
        return rnd_hex;
    }
    
    void rfid_worker::decrypt(QByteArray cry, QByteArray &dec, QString key_hex)
    {
        QString param = "openssl enc -aes128 -d -nopad -nosalt -in %1 -out %2 -iv %3 -K %4 ";
        QString in_file = "/opt/crypt";
        QString out_file = "/opt/decrypt";
        ofstream o_strm (in_file.toLatin1().data(), ios::out | ios::binary);
        o_strm.write (cry.constData(), 16);
        o_strm.close();
        QString cmd = param.arg(in_file,out_file,*iv_hex,key_hex);
        system(cmd.toUtf8().constData());
        ifstream i_strm (out_file.toLatin1().data(), ios::in | ios::binary);
        char buffer[16];
        i_strm.read(buffer,16);
        dec = QByteArray(buffer,16);
        i_strm.close();
    }
    
    void rfid_worker::encrypt(QByteArray dec, QByteArray &enc)
    {
        QString param = "openssl enc -aes128 -nopad -nosalt -in %1 -out %2 -iv %3 -K %4 ";
        QString in_file = "/opt/clean";
        QString out_file = "/opt/crypt";
        ofstream o_strm (in_file.toLatin1().data(), ios::out | ios::binary);
        o_strm.write(dec.constData(), 16);
        o_strm.close();
        QString cmd = param.arg(in_file,out_file,*iv_hex,*key_hex_clean);
        system(cmd.toUtf8().constData());
        QThread::msleep(100);
        ifstream i_strm (out_file.toLatin1().data(), ios::in | ios::binary);
        char buffer[16];
        i_strm.read(buffer,16);
        enc = QByteArray(buffer,16);
        i_strm.close();
    }
    
    void rfid_worker::tips_charge()
    {
        QByteArray answ;
        QByteArray tips_enc;
        QByteArray tips_dec;
        char read_tips_cmd_c[] = {0x0e,0x03,TIP_CHARGE_ADDR_OLD};
        QByteArray read_tips_cmd = QByteArray(read_tips_cmd_c);
        rs.write(read_tips_cmd,3);
        rs.flush();
        rs.waitForBytesWritten(200);
        rs.waitForReadyRead(300);
        answ=rs.readAll();
        if(answ.length()==19){
            tips_enc=answ.mid(3);
        }
        QString aes_hex_QS = QString(aes_masked_key.toHex());
        decrypt(tips_enc,tips_dec,aes_hex_QS);
        if(check_tips(tips_dec,Agejet::DIV)){
            Agejet::rfid_error=Agejet::NO_ERROR;
        }
        else {
            Agejet::rfid_error=Agejet::TIPS_VALUE;
        }
    }
    
    void rfid_worker::hp_charge()
    {
        QByteArray answ;
        QByteArray tips_enc;
        QByteArray tips_dec;
        char read_tips_cmd_c[] = {0x0e,0x03,HP_CHARGE_ADDR_OLD};
        QByteArray read_tips_cmd = QByteArray(read_tips_cmd_c);
        rs.write(read_tips_cmd,3);
        rs.flush();
        rs.waitForBytesWritten(200);
        rs.waitForReadyRead(300);
        answ=rs.readAll();
        if(answ.length()==19){
            tips_enc=answ.mid(3);
        }
        QString aes_hex_QS = QString(aes_masked_key.toHex());
        decrypt(tips_enc,tips_dec,aes_hex_QS);
        if(check_tips(tips_dec,Agejet::DIV)){
            Agejet::rfid_error=Agejet::NO_ERROR;
        }
        else {
            Agejet::rfid_error=Agejet::NOT_VALID;
        }
    }
    
    void rfid_worker::create_aes_masked()
    {
        char aes_c[] = {0xFF,0xFF,0xFF,(*card_uid)[0],(*card_uid)[1],(*card_uid)[2],(*card_uid)[3],0xFF,0xFF,0xFF,0xFF,0xFF,(*card_uid)[0],(*card_uid)[1],(*card_uid)[2],(*card_uid)[3]};
        aes_masked_key = QByteArray(aes_c,16);
    }
    
    void rfid_worker::delete_old_card()
    {
        first_auth=false;
        char delete_cmd[] = {0x10,0x13,TIP_CHARGE_ADDR_OLD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
        QByteArray delete_cmd_q = QByteArray(delete_cmd,19);
        QByteArray payload = QByteArray(delete_cmd_q.mid(3,16));
        QByteArray payload_enc;
        encrypt(payload,payload_enc);
        delete_cmd_q = delete_cmd_q.mid(0,3);
        delete_cmd_q += payload_enc;
        rs.write(delete_cmd_q,19);
        rs.flush();
        rs.waitForBytesWritten(200);
        rs.waitForReadyRead(300);
        QByteArray answ;
        answ=rs.readAll();
        if(answ.length()==3){
            if(answ[2]!=0x00){
               Agejet::rfid_error=Agejet::SESSION_ERROR;
               return;
            }
        }
        else {
            Agejet::rfid_error=Agejet::SESSION_ERROR;
            return;
        }
        delete_cmd_q[2] = HP_CHARGE_ADDR_OLD;
        rs.write(delete_cmd_q,19);
        rs.flush();
        rs.waitForBytesWritten(200);
        rs.waitForReadyRead(300);
        answ=rs.readAll();
        if(answ.length()==3){
            if(answ[2]==0x00){
                Agejet::rfid_error=Agejet::NO_ERROR;
                return;
            }
            else {
                cout<<"C"<<endl;
               Agejet::rfid_error=Agejet::SESSION_ERROR;
               return;
            }
        }
        else {
            cout<<"D"<<endl;
            Agejet::rfid_error=Agejet::SESSION_ERROR;
            return;
        }
    }
    
    void rfid_worker::delete_new_card()
    {
        char delete_cmd[] = {0x10,0x13,MODEL_ADDR,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
        QByteArray delete_cmd_q = QByteArray(delete_cmd,19);
        QByteArray payload = QByteArray(delete_cmd_q.mid(3,16));
        QByteArray payload_enc;
        encrypt(payload,payload_enc);
        delete_cmd_q = delete_cmd_q.mid(0,3);
        delete_cmd_q += payload_enc;
        rs.write(delete_cmd_q,19);
        rs.flush();
        rs.waitForBytesWritten(200);
        rs.waitForReadyRead(300);
        QByteArray answ;
        answ=rs.readAll();
        if(answ.length()==3){
            if(answ[2]!=0x00){
               Agejet::rfid_error=Agejet::SESSION_ERROR;
               return;
            }
        }
        else {
            Agejet::rfid_error=Agejet::SESSION_ERROR;
            return;
        }
    }
    
    
    bool rfid_worker::check_tips(QByteArray tips_dec,uint div)
    {
        QByteArray tips_number_a = tips_dec.mid(0,4);
        bool ok;
        uint tips_number = tips_number_a.toHex().toInt(&ok,16);
        if(((tips_number % div)== 0)&&(tips_number!=0)){
            if(Agejet::charge_type.contains("tip")){
                Agejet::tips_charged_shoots=tips_number;
                return true;
            }
            else {
                if(Agejet::charge_type.contains("hp")){
                    Agejet::hp_charged_shoots=tips_number;
                    return true;
                }
            }
        }
        else {
           Agejet::rfid_error=Agejet::NOT_VALID;
           return false;
        }
    }
    
    QByteArray rfid_worker::aes_masked_key;
    QString *rfid_worker::key_hex_clean = NULL;
    QString *rfid_worker::iv_hex = NULL;
    QByteArray *rfid_worker::card_uid = NULL;
    
    /*
    void rfid_worker::check_card_type()
    {
    
        char read_uid_c[] = {0x0E,0x03,MODEL_ADDR_OLD};
        QByteArray ba_cmd = QByteArray(read_uid_c,4);
        QByteArray answ;
        QByteArray card_type_enc;
        QByteArray card_type_dec;
        rs.write(ba_cmd,3);
        rs.flush();
        rs.waitForBytesWritten(300);
        rs.waitForReadyRead(400);
    
        answ=rs.readAll();
        cout<<answ.toHex().constData()<<endl;
        if(answ.length()==19){
            card_type_enc=answ.mid(3);
            Agejet::old_card_type = true;
            cout<<"VECCHIA"<<endl;
        }
        else{
    
            ba_cmd[2] = MODEL_ADDR;
            rs.write(ba_cmd,3);
            rs.flush();
            rs.waitForBytesWritten(300);
            rs.waitForReadyRead(400);
            answ=rs.readAll();
            cout<<"HEX"<<answ.toHex().constData()<<endl;
            if(answ.length()==19){
                card_type_enc=answ.mid(3);
                cout<<"NUOBA"<<endl;
                Agejet::old_card_type = true;
            }
            else{
                cout<<"NESSUNA"<<endl;
                Agejet::rfid_error=Agejet::CARD_TYPE;
                return;
            }
        }
        QString aes_hex_QS = QString(aes_masked_key.toHex());
        decrypt(card_type_enc,card_type_dec,aes_hex_QS);
        card_type_dec=card_type_dec.mid(0,4);
        bool ok;
        int mod = card_type_dec.at(3);
        if(!Agejet::old_card_type){
            if(Agejet::model==mod){
                Agejet::rfid_error=Agejet::NO_ERROR;
                cout<<"mod "<<mod<<endl;
            }
            else{
                Agejet::rfid_error=Agejet::CARD_TYPE;
                cout<<"aaaaamod "<<mod<<endl;
                return;
            }
        }
        else {
            if(mod==0){
                Agejet::rfid_error=Agejet::NO_ERROR;
                cout<<"SIIIIIIIIIIIIIIIIIIIIIIIIIIIImod "<<mod<<endl;
                return;
            }
            else{
                Agejet::rfid_error=Agejet::CARD_TYPE;
                cout<<"aaaaamod "<<mod<<endl;
                return;
            }
        }
        card_type_enc = 0x00;
        if(Agejet::old_card_type)
        ba_cmd[2]= MODEL_ADDR_OLD;
        else
        ba_cmd[2]= MODEL_ADDR;
    
        rs.write(ba_cmd,3);
        rs.flush();
        rs.waitForBytesWritten(300);
        rs.waitForReadyRead(400);
        answ=rs.readAll();
        if(answ.length()==19){
            card_type_enc=answ.mid(3);
        }
        mod = card_type_dec.at(3);
        if(Agejet::model==mod){
             cout<<"mod = "<<mod<<endl;
            Agejet::rfid_error=Agejet::NO_ERROR;
        }
        else{
            cout<<"mod = "<<mod<<endl;
            Agejet::rfid_error=Agejet::CARD_TYPE;
        }
    */
    
    
    


  • @AntonioValentin
    What do you want us to say? You have a load of messages, either warnings or errors, which you should sort out, or maybe change compiler flags if you really want to ignore and they are ignorable. Nobody here is going to go through each of these messages and guess how you should correct.

    Plus you have been asked not to double-post in two forums but are still doing so, please do not....


  • Qt Champions 2019

    @AntonioValentin said in The process "/usr/bin/make" exited with code 2.:

    ../agejet/rfid_worker.cpp:136:35: error: narrowing conversion of ‘250’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
    char init_bytes[] = {0xFA,0x12};

    250 is too big for char (which is signed). Use unsigned char.

    And, please, keep in mind that you're asking questions completely unrelated to Qt. Use Google to search for your compiler errors/warnings, read a book about C++...


Log in to reply