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
// 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 <QtPlugin>
#include <QObject>
#include <plugins/interfaces.h>
#include <../plugins/interfaces.h>
#include "datIf.h"
@ -988,6 +988,8 @@ public:
uint8_t bl_wasSendingAddOK(void) const override;
// 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;
// send 64 byte from bin file
@ -998,9 +1000,9 @@ public:
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
// 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)
{
cycl_running=1;
qDebug() << "datif: sending 160 byte block, len: " << dataBufLen;
//qDebug() << "datif: sending 160 byte block, len: " << dataBufLen;
datif_OUT_SendRandomData(dataSendBuf, dataBufLen);
BlockCounter=0;
return 0;
@ -151,7 +151,7 @@ char T_datif::datif_cycleSend()
} else
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);
// "docNr" in datif_OutCmdpara1 blockNr in dbl
@ -174,7 +174,7 @@ char T_datif::datif_cycleSend()
#ifdef USEHANDSHAKES
else
{
qDebug() << "last request not yet finished";
//qDebug() << "last request not yet finished";
}
#endif
} else
@ -298,7 +298,7 @@ void T_datif::sendWRcommand(uint16_t nextWrCmd)
case SENDDIRCMD_MIF_SWONOFF:
datif_sendIOrequest(CMD2DC_MIFREADERON, 0, 1); // 0x2900
indat_storeMifarePower(datif_OutCmdpara1);
qDebug()<<"switching mifare on/off "<< datif_OutCmdpara1;
//qDebug()<<"switching mifare on/off "<< datif_OutCmdpara1;
break;
case SENDDIRCMD_MOD_SWONOFF:
@ -345,12 +345,12 @@ void T_datif::sendWRcommand(uint16_t nextWrCmd)
case SENDDIR_REJMOT_ON:
datif_sendIOrequest(CMD2DC_REJMOT_ON, 0, 1);
qDebug() << "Datif: send cmd reject motor";
//qDebug() << "Datif: send cmd reject motor";
break;
case SENDDIR_REJMOT_RUN:
datif_sendIOrequest(CMD2DC_REJMOT_RUN, 0, 0);
qDebug() << "Datif: send cmd do coin reject";
//qDebug() << "Datif: send cmd do coin reject";
break;
@ -427,7 +427,7 @@ void T_datif::send_requests(uint16_t nextWrCmd)
case SEND_REQU_MIFDATA :
// Type, UID, Header of card
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;
// case SEND_REQU_MIF_ATB_TYPE :
@ -483,12 +483,12 @@ void T_datif::sendHighLevel(uint16_t nxtHLCmd)
{
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);
break;
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);
break;

View File

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

View File

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