Aktualisiert auf Stand 29/03/2023

This commit is contained in:
Gerhard Hoffmann 2023-03-30 08:44:14 +02:00
parent 19befc2c58
commit e4a2f8fce3
6 changed files with 58 additions and 33 deletions

View File

@ -95,6 +95,7 @@ uint8_t dcBL_sendSuccess(uint8_t lastCommand);
// return val: 0: no response by now 1:error 10: OK // return val: 0: no response by now 1:error 10: OK
// lastCommand=0x21 for sendAddr or 0x22 for send data // lastCommand=0x21 for sendAddr or 0x22 for send data
char dcBL_loadBinary(char withDisplay);

View File

@ -71,7 +71,7 @@ Level 3): send command: "start payment process"
#include <QTabWidget> #include <QTabWidget>
#include <QtPlugin> #include <QtPlugin>
#include <QObject> #include <QObject>
#include <plugins/interfaces.h> #include <../plugins/interfaces.h>
#include "datIf.h" #include "datIf.h"
@ -988,6 +988,8 @@ public:
uint8_t bl_wasSendingAddOK(void) const override; uint8_t bl_wasSendingAddOK(void) const override;
// return val: 0: no response by now 1:error 10: OK // return val: 0: no response by now 1:error 10: OK
void bl_openBinary(void) const override;
void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const override; void bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const override;
// send 64 byte from bin file // send 64 byte from bin file
@ -998,9 +1000,9 @@ public:
void bl_stopBL(void) const override; void bl_stopBL(void) const override;
bool bl_isDiagAvailable(void) const override; //bool bl_isDiagAvailable(void) const override;
QString dc_getDiagText(void) const override; //QString dc_getDiagText(void) const override;
@ -1008,9 +1010,9 @@ public:
// Komplett-schreib Funktion, noch nicht getestet // Komplett-schreib Funktion, noch nicht getestet
// Nachteil: keine Rückmeldung wie lang's noch dauert // Nachteil: keine Rückmeldung wie lang's noch dauert
void bl_startSending(void) const override; //void bl_startSending(void) const override;
void bl_sendFile(void) const override; //void bl_sendFile(void) const override;

View File

@ -120,7 +120,7 @@ char T_datif::datif_cycleSend()
if (dbl>0) if (dbl>0)
{ {
cycl_running=1; cycl_running=1;
qDebug() << "datif: sending 160 byte block, len: " << dataBufLen; //qDebug() << "datif: sending 160 byte block, len: " << dataBufLen;
datif_OUT_SendRandomData(dataSendBuf, dataBufLen); datif_OUT_SendRandomData(dataSendBuf, dataBufLen);
BlockCounter=0; BlockCounter=0;
return 0; return 0;
@ -151,7 +151,7 @@ char T_datif::datif_cycleSend()
} else } else
if (who==3) if (who==3)
{ {
qDebug() << "datif: sending printer text, docnr: " <<datif_OutCmdpara1 << " blknr: " << BlockCounter; //qDebug() << "datif: sending printer text, docnr: " <<datif_OutCmdpara1 << " blknr: " << BlockCounter;
datif_sendToMemory(CMD2DC_PRI_STORE_DOC, datif_OutCmdpara1, BlockCounter, dataSendBuf); datif_sendToMemory(CMD2DC_PRI_STORE_DOC, datif_OutCmdpara1, BlockCounter, dataSendBuf);
// "docNr" in datif_OutCmdpara1 blockNr in dbl // "docNr" in datif_OutCmdpara1 blockNr in dbl
@ -174,7 +174,7 @@ char T_datif::datif_cycleSend()
#ifdef USEHANDSHAKES #ifdef USEHANDSHAKES
else else
{ {
qDebug() << "last request not yet finished"; //qDebug() << "last request not yet finished";
} }
#endif #endif
} else } else
@ -298,7 +298,7 @@ void T_datif::sendWRcommand(uint16_t nextWrCmd)
case SENDDIRCMD_MIF_SWONOFF: case SENDDIRCMD_MIF_SWONOFF:
datif_sendIOrequest(CMD2DC_MIFREADERON, 0, 1); // 0x2900 datif_sendIOrequest(CMD2DC_MIFREADERON, 0, 1); // 0x2900
indat_storeMifarePower(datif_OutCmdpara1); indat_storeMifarePower(datif_OutCmdpara1);
qDebug()<<"switching mifare on/off "<< datif_OutCmdpara1; //qDebug()<<"switching mifare on/off "<< datif_OutCmdpara1;
break; break;
case SENDDIRCMD_MOD_SWONOFF: case SENDDIRCMD_MOD_SWONOFF:
@ -345,12 +345,12 @@ void T_datif::sendWRcommand(uint16_t nextWrCmd)
case SENDDIR_REJMOT_ON: case SENDDIR_REJMOT_ON:
datif_sendIOrequest(CMD2DC_REJMOT_ON, 0, 1); datif_sendIOrequest(CMD2DC_REJMOT_ON, 0, 1);
qDebug() << "Datif: send cmd reject motor"; //qDebug() << "Datif: send cmd reject motor";
break; break;
case SENDDIR_REJMOT_RUN: case SENDDIR_REJMOT_RUN:
datif_sendIOrequest(CMD2DC_REJMOT_RUN, 0, 0); datif_sendIOrequest(CMD2DC_REJMOT_RUN, 0, 0);
qDebug() << "Datif: send cmd do coin reject"; //qDebug() << "Datif: send cmd do coin reject";
break; break;
@ -427,7 +427,7 @@ void T_datif::send_requests(uint16_t nextWrCmd)
case SEND_REQU_MIFDATA : case SEND_REQU_MIFDATA :
// Type, UID, Header of card // Type, UID, Header of card
datif_sendIOrequest(0, CMD2DC_RdBk_MifData, 1); // immer nur blk 0 anfordern datif_sendIOrequest(0, CMD2DC_RdBk_MifData, 1); // immer nur blk 0 anfordern
qDebug()<<"manual requesting mif card data"; //qDebug()<<"manual requesting mif card data";
break; break;
// case SEND_REQU_MIF_ATB_TYPE : // case SEND_REQU_MIF_ATB_TYPE :
@ -483,12 +483,12 @@ void T_datif::sendHighLevel(uint16_t nxtHLCmd)
{ {
case SENDDIRCMD_SHUTOPENBYTIME: case SENDDIRCMD_SHUTOPENBYTIME:
qDebug() << "open by time " << datif_OutCmdpara1 << " "<< datif_OutCmdpara2; //qDebug() << "open by time " << datif_OutCmdpara1 << " "<< datif_OutCmdpara2;
datif_sendIOrequest(CMD2DC_SHUTTER_OPEN3S, 0, 1); datif_sendIOrequest(CMD2DC_SHUTTER_OPEN3S, 0, 1);
break; break;
case SENDDIRCMD_SHUTOPENBYCOIN: case SENDDIRCMD_SHUTOPENBYCOIN:
qDebug() << "open by coin " << datif_OutCmdpara1 << " "<< datif_OutCmdpara2; //qDebug() << "open by coin " << datif_OutCmdpara1 << " "<< datif_OutCmdpara2;
datif_sendIOrequest(CMD2DC_SHUTTER_COIN, 0, 2); datif_sendIOrequest(CMD2DC_SHUTTER_COIN, 0, 2);
break; break;

View File

@ -362,8 +362,8 @@ uint8_t dcBL_ChkResponse()
if (recLen==0) if (recLen==0)
return 0; // no response by now return 0; // no response by now
qDebug()<<" DCBL_chkResp got answer " << recLen ; //qDebug()<<" DCBL_chkResp got answer " << recLen ;
dcBL_writeText("DCBL_chkResp got answer"); //dcBL_writeText("DCBL_chkResp got answer");
if (buf[0]==2 && buf[1]==(dcBL_LastBLcmd | 0x80) ) if (buf[0]==2 && buf[1]==(dcBL_LastBLcmd | 0x80) )
return 10; // OK return 10; // OK
@ -474,9 +474,8 @@ char dcBL_loadBinary(char withDisplay)
uint32_t ultmp, fileLen; uint32_t ultmp, fileLen;
QString tmpStr="", s2tmp=""; QString tmpStr="", s2tmp="";
//QFile file("/own/H2B/dc2.hex"); // laesst sich genauso oeffnen qDebug()<<"dcBL loading DC2c binary...";
QFile file("/own/H2B/dc2.bin"); QFile file("../dc2c4.bin");
if (!file.exists()) if (!file.exists())
{ {
//qDebug()<<"file _own_H2B_dc2.bin does not exist"; //qDebug()<<"file _own_H2B_dc2.bin does not exist";
@ -1185,6 +1184,7 @@ void dcBL_iniLoading(void)
} }
// nicht verwendet
void dcBL_startLoading(void) void dcBL_startLoading(void)
{ {
if (dcBL_step==0 || dcBL_step>17) if (dcBL_step==0 || dcBL_step>17)
@ -1200,13 +1200,15 @@ void dcBL_startLoading(void)
} }
// nicht verwendet
uint8_t dcBL_sendHexfile(void) uint8_t dcBL_sendHexfile(void)
{ {
QString tmpStr=""; QString tmpStr="";
uint8_t buf[70], sendBuf[160], len, sendLen, gotResp; //, recLen; recBuff[160], ii, uint8_t buf[70], sendBuf[160], len, sendLen, gotResp; //, recLen; recBuff[160], ii,
QString stemp=" "; QString stemp=" ";
uint32_t ultmp; uint32_t ultmp;
uint8_t uit8tmp, ii; //uint8_t uit8tmp, ii;
gotResp=dcBL_ChkResponse(); gotResp=dcBL_ChkResponse();
@ -1261,7 +1263,7 @@ uint8_t dcBL_sendHexfile(void)
len=dcBL_getFileBlock(dcBL_BlkCtr, buf); // read from file, len = 0...64 len=dcBL_getFileBlock(dcBL_BlkCtr, buf); // read from file, len = 0...64
//lastBlkLength=len; // recognize last block or end //lastBlkLength=len; // recognize last block or end
sendLen=dcBL_prepareDC_BLcmd(0x22, len, buf, sendBuf); // pack into protocol frame sendLen=dcBL_prepareDC_BLcmd(0x22, len, buf, sendBuf); // pack into protocol frame
/*
// Kontrolle: // Kontrolle:
qDebug()<<"dcBL sending: "; qDebug()<<"dcBL sending: ";
ii=0; ii=0;
@ -1273,7 +1275,7 @@ uint8_t dcBL_sendHexfile(void)
qDebug() << stemp << " "; // Anzeige in hex qDebug() << stemp << " "; // Anzeige in hex
} while (ii<100); } while (ii<100);
*/
sendWRcmd_setSendBlock160(sendLen, sendBuf); // send 140 bytes sendWRcmd_setSendBlock160(sendLen, sendBuf); // send 140 bytes
delay(100); delay(100);
dcBL_writeText("blk nr: "); dcBL_writeText("blk nr: ");
@ -1392,7 +1394,7 @@ void gpi_storeRawReceivedData(uint8_t RdDlen, uint8_t *receivedData)
Sdata_LengthRawData=RAW_BL_DATALEN; Sdata_LengthRawData=RAW_BL_DATALEN;
for (nn=0; nn<Sdata_LengthRawData; nn++) for (nn=0; nn<Sdata_LengthRawData; nn++)
Sdata_rawData[nn]=receivedData[nn]; Sdata_rawData[nn]=receivedData[nn];
qDebug()<<"dcBL got data"<< Sdata_LengthRawData << "bytes :)"; //qDebug()<<"dcBL got data"<< Sdata_LengthRawData << "bytes :)";
} }

View File

@ -2651,14 +2651,33 @@ uint8_t hwapi::bl_wasSendingAddOK(void) const
} }
void hwapi::bl_openBinary(void) const
{
dcBL_loadBinary(0);
}
void hwapi::bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const void hwapi::bl_sendDataBlock(uint8_t length, u_int8_t *buffer) const
{ {
// send 64 byte from bin file // send 64 byte from bin file
uint8_t LL=length, sendBuf[66], sendLen; uint8_t LL=length, sendBuf[80], sendLen;
if (LL>64) LL=64; if (LL>64) LL=64;
tslib_strclr(sendBuf,0,80);
/* hier ist alles richtig
qDebug() << "bl_sendDataBlock "<<LL<< " bytes: " << buffer[0] << " " << buffer[1] << " "
<< buffer[2] << " " << buffer[3] << " " << buffer[4] << " " << buffer[5] << " "
<< buffer[6] << " " << buffer[7] << " " << buffer[8] << " " << buffer[9] << " "
<< buffer[61] << " " << buffer[62] << " " << buffer[63] << " " << buffer[64] << " "
<< buffer[65] << " " << buffer[66] << " " << buffer[67] << " " << buffer[68] << " ";
*/
sendLen=dcBL_prepareDC_BLcmd(0x22, LL, buffer, sendBuf); // pack into protocol frame sendLen=dcBL_prepareDC_BLcmd(0x22, LL, buffer, sendBuf); // pack into protocol frame
/*
qDebug() << "bl_sendDataBlock "<<sendLen<< " bytes: " << sendBuf[0] << " " << sendBuf[1] << " "
<< sendBuf[2] << " " << sendBuf[3] << " " << sendBuf[4] << " " << sendBuf[5] << " "
<< sendBuf[6] << " " << sendBuf[68] << " " << sendBuf[69] << " " << sendBuf[70] << " "
<< sendBuf[71] << " " << sendBuf[72] << " " << sendBuf[73] << " " << sendBuf[74] << " ";
*/
sendWRcmd_setSendBlock160(sendLen, sendBuf); // send 140 bytes sendWRcmd_setSendBlock160(sendLen, sendBuf); // send 140 bytes
delay(100); delay(100);
} }
@ -2690,7 +2709,7 @@ void hwapi::bl_stopBL(void) const
sendWRcmd_setSendBlock160(len, buf); sendWRcmd_setSendBlock160(len, buf);
} }
/*
bool hwapi::bl_isDiagAvailable(void) const bool hwapi::bl_isDiagAvailable(void) const
{ {
@ -2702,9 +2721,9 @@ QString hwapi::dc_getDiagText(void) const
{ {
return dcBL_readText(); // read from 0...9 (oldest first) return dcBL_readText(); // read from 0...9 (oldest first)
} }
*/
/*
// geht noch nicht ////// // geht noch nicht //////
void hwapi::bl_startSending(void) const void hwapi::bl_startSending(void) const
{ {
@ -2720,7 +2739,7 @@ void hwapi::bl_sendFile(void) const
dcBL_sendHexfile(); dcBL_sendHexfile();
} }
*/

View File

@ -195,10 +195,11 @@ void T_prot::setBLsendData( uint8_t len, uint8_t *buf)
this->setRecLen(100); // how many?? this->setRecLen(100); // how many??
//readAddress= // needed?? //readAddress= // needed??
qDebug()<<"prot: got BL data " << len << "bytes, "; //qDebug()<<"prot: got BL data " << len << "bytes, ";
for (int i=0; i<len; ++i) { //for (int i=0; i<len; ++i) {
printf("%02x ", (unsigned char)buf[i]); // printf("%02x ", (unsigned char)buf[i]);
} printf("\n"); //} printf("\n");
/* /*
qDebug()<<buf[0] <<buf[1] <<buf[2] <<buf[3] <<buf[4] <<buf[5] <<buf[6] <<buf[7]; qDebug()<<buf[0] <<buf[1] <<buf[2] <<buf[3] <<buf[4] <<buf[5] <<buf[6] <<buf[7];
qDebug() <<buf[8] <<buf[9] <<buf[10] <<buf[11] <<buf[12] <<buf[13]<<buf[14]<<buf[15]; qDebug() <<buf[8] <<buf[9] <<buf[10] <<buf[11] <<buf[12] <<buf[13]<<buf[14]<<buf[15];
@ -432,7 +433,7 @@ uint8_t recBuffer[FRAME_MAXLEN];
// read from "VCP": // read from "VCP":
mySerialPort->readFromSerial(Indata, recLength); mySerialPort->readFromSerial(Indata, recLength);
qDebug()<<"prot: got data " << recLength; //qDebug()<<"prot: got data " << recLength;
if (recLength>FRAME_MAXLEN) if (recLength>FRAME_MAXLEN)
recLength=FRAME_MAXLEN; recLength=FRAME_MAXLEN;
for (int nn=0; nn<recLength; nn++) for (int nn=0; nn<recLength; nn++)