2023-04-11 14:04:38 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <QString>
|
|
|
|
#include <QDebug>
|
|
|
|
#include "storeINdata.h"
|
|
|
|
#include "tslib.h"
|
|
|
|
|
|
|
|
// gpi: grafical access to PI: access from external devices over device controller FOR GUI
|
|
|
|
// epi: external access from GUI to PI: FOR external devices (DC)
|
|
|
|
|
|
|
|
|
|
|
|
// store power on/off condition of the devices to control the data request
|
|
|
|
|
|
|
|
static bool indat_savePrnPwr;
|
|
|
|
|
|
|
|
void indat_storePrinterPower(bool isOn)
|
|
|
|
{
|
|
|
|
indat_savePrnPwr=isOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool indat_isPrinterOn()
|
|
|
|
{
|
|
|
|
return indat_savePrnPwr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool indat_saveMifPwr;
|
|
|
|
|
|
|
|
void indat_storeMifarePower(bool isOn)
|
|
|
|
{
|
|
|
|
indat_saveMifPwr=isOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool indat_isMifareOn()
|
|
|
|
{
|
|
|
|
return indat_saveMifPwr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool indat_MdbIsOn;
|
|
|
|
|
|
|
|
void indat_storeMDBisOn(bool isOn)
|
|
|
|
{
|
|
|
|
indat_MdbIsOn=isOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool indat_isMdbOn()
|
|
|
|
{
|
|
|
|
return indat_MdbIsOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// //////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t ndbs, pari, nsb, br;
|
|
|
|
|
|
|
|
void gpi_storeSlaveSerParams(uint8_t slaveBaudRate, uint8_t NrDataBits,
|
|
|
|
uint8_t parity, uint8_t NrStopBits)
|
|
|
|
{
|
|
|
|
// store numbers
|
|
|
|
ndbs=NrDataBits;
|
|
|
|
pari=parity;
|
|
|
|
nsb=NrStopBits;
|
|
|
|
br=slaveBaudRate;
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_getSlaveSerParams(uint8_t *slaveBaudRate, uint8_t *NrDataBits,
|
|
|
|
uint8_t *parity, uint8_t *NrStopBits)
|
|
|
|
{
|
|
|
|
*NrDataBits=ndbs;
|
|
|
|
*parity=pari;
|
|
|
|
*NrStopBits=nsb;
|
|
|
|
*slaveBaudRate=br;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QString epi_getSlaveParamSTR()
|
|
|
|
{
|
|
|
|
QString mySt;
|
|
|
|
mySt.clear();
|
|
|
|
switch (br)
|
|
|
|
{
|
|
|
|
case 1: mySt="1200 ";break;
|
|
|
|
case 2: mySt="9600 ";break;
|
|
|
|
case 3: mySt="19200 ";break;
|
|
|
|
case 4: mySt="38400 ";break;
|
|
|
|
case 5: mySt="57600 ";break;
|
|
|
|
case 6: mySt="115200 ";break;
|
|
|
|
}
|
|
|
|
mySt.append(ndbs+0x30);
|
|
|
|
|
|
|
|
mySt.append(pari);
|
|
|
|
mySt.append(nsb+0x30);
|
|
|
|
//mySt="Hallo";
|
|
|
|
return mySt;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static QString genStrings[MAXNROF_GENSTR];
|
|
|
|
// 0=HW 1=SW 2=State
|
|
|
|
|
|
|
|
void gpi_storeGenerals(uint8_t genNr, QString text)
|
|
|
|
{
|
|
|
|
// 0=HW 1=SW 2=State
|
|
|
|
if (genNr<MAXNROF_GENSTR)
|
|
|
|
{
|
|
|
|
genStrings[genNr]=text;
|
|
|
|
//qDebug() << "store gen's: " << genNr << " " <<text;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QString epi_loadGenerals(uint8_t genNr)
|
|
|
|
{
|
|
|
|
if (genNr<MAXNROF_GENSTR)
|
|
|
|
{
|
|
|
|
if (genNr==2) // DC2 State is shorter (8byte, not 64)
|
|
|
|
//genStrings[2][8]=0;
|
|
|
|
genStrings[2].chop(8);
|
|
|
|
|
|
|
|
return genStrings[genNr];
|
|
|
|
}
|
|
|
|
return " ";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------
|
|
|
|
|
|
|
|
static uint64_t Sdata_slaveUID;
|
|
|
|
static uint8_t Sdata_UIDstr[8];
|
|
|
|
|
|
|
|
void gpi_storeUID(uint8_t *buf8byteUid)
|
|
|
|
{
|
|
|
|
uint64_t udltmp=0;
|
|
|
|
|
|
|
|
//qDebug()<< "store UID ";
|
|
|
|
|
|
|
|
for (int ii=0; ii<8; ii++)
|
|
|
|
{
|
|
|
|
//qDebug()<< buf8byteUid[ii] << " ";
|
|
|
|
|
|
|
|
Sdata_UIDstr[ii]=buf8byteUid[ii];
|
|
|
|
udltmp|=buf8byteUid[ii];
|
|
|
|
udltmp<<=8;
|
|
|
|
}
|
|
|
|
Sdata_slaveUID=udltmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_getUIDdec(uint8_t *buf8byteUid)
|
|
|
|
{
|
|
|
|
//qDebug()<< "get UID ";
|
|
|
|
for (int ii=0; ii<8; ii++)
|
|
|
|
{
|
|
|
|
//qDebug()<<Sdata_UIDstr[ii] << " ";
|
|
|
|
buf8byteUid[ii]=Sdata_UIDstr[ii];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString epi_getUIDstr()
|
|
|
|
{
|
|
|
|
// die UID besteht aus 8 bytes (8 dezimalzahlen)
|
|
|
|
// -> umformen in hexstring
|
|
|
|
|
|
|
|
QString myStr;
|
|
|
|
for (int ii=0;ii<8; ii++)
|
|
|
|
{
|
|
|
|
|
|
|
|
myStr+=QString::number(Sdata_UIDstr[ii],16);
|
|
|
|
myStr+=" ";
|
|
|
|
}
|
|
|
|
return myStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Time and Date
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
struct T_globTime
|
|
|
|
{
|
|
|
|
// Reihenfolge nicht vertauschen!!!!!
|
|
|
|
uint8_t hour;
|
|
|
|
uint8_t minute;
|
|
|
|
uint8_t second;
|
|
|
|
uint8_t Year;
|
|
|
|
uint8_t Month;
|
|
|
|
uint8_t DayOfMonth;
|
|
|
|
uint8_t DayOfWeek; // 1=monday...7
|
|
|
|
uint8_t reserve1;
|
|
|
|
|
|
|
|
uint16_t MinutesOfToday;
|
|
|
|
uint16_t reserve2;
|
|
|
|
|
|
|
|
uint32_t SecondsOfToday;
|
|
|
|
|
|
|
|
uint8_t IsLeapyear;
|
|
|
|
uint8_t nextLeap;
|
|
|
|
uint8_t lastLeap;
|
|
|
|
uint8_t hoursOfWeek;
|
|
|
|
|
|
|
|
uint16_t minOfWeek;
|
|
|
|
uint16_t hoursOfMonth;
|
|
|
|
uint16_t minOfMonth;
|
|
|
|
uint16_t dayOfYear;
|
|
|
|
uint16_t hoursOfYear;
|
|
|
|
uint16_t reserve3;
|
|
|
|
|
|
|
|
uint32_t minOfYear;
|
|
|
|
|
|
|
|
uint8_t squareOutMode;
|
|
|
|
uint8_t free1;
|
|
|
|
uint16_t reserve4;
|
|
|
|
uint32_t minOfMillenium;
|
|
|
|
// bis hierher 44byts
|
|
|
|
uint32_t free2;
|
|
|
|
uint32_t free3;
|
|
|
|
uint32_t free4;
|
|
|
|
|
|
|
|
};
|
|
|
|
static T_globTime getGlobalTime;
|
|
|
|
|
|
|
|
|
|
|
|
void gpi_backupSquareMode(uint8_t squMode)
|
|
|
|
{
|
|
|
|
getGlobalTime.squareOutMode=squMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getSquareMode()
|
|
|
|
{
|
|
|
|
return getGlobalTime.squareOutMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void gpi_backupTime(uint8_t *timeBuffer, uint8_t Leng)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
// Daten kommen in gleicher Reihenfolge vom Slave
|
|
|
|
uint8_t *pTime;
|
|
|
|
pTime=&getGlobalTime.hour;
|
|
|
|
if (Leng>44) Leng=44; // mehr brauch ma ned
|
|
|
|
for (int nn=0; nn<Leng; nn++)
|
|
|
|
{
|
|
|
|
*pTime++=timeBuffer[nn];
|
|
|
|
}*/
|
|
|
|
|
|
|
|
// new, FastProt: 0=dayOfWeek 1=min 2=sec 3=hours 4=year 5=month 6=dayOfMonth
|
|
|
|
getGlobalTime.second=Leng; // nur damit CompilerWarnung weg ist
|
|
|
|
|
|
|
|
getGlobalTime.DayOfWeek=timeBuffer[0];
|
|
|
|
getGlobalTime.minute=timeBuffer[1];
|
|
|
|
getGlobalTime.second=timeBuffer[2];
|
|
|
|
getGlobalTime.hour=timeBuffer[3];
|
|
|
|
getGlobalTime.Year=timeBuffer[4];
|
|
|
|
getGlobalTime.Month=timeBuffer[5];
|
|
|
|
getGlobalTime.DayOfMonth=timeBuffer[6];
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_getTime(uint8_t *hh, uint8_t *mm, uint8_t *ss)
|
|
|
|
{
|
|
|
|
*hh=getGlobalTime.hour;
|
|
|
|
*mm=getGlobalTime.minute;
|
|
|
|
*ss=getGlobalTime.second;
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_getDate(uint8_t *yy, uint8_t *mm, uint8_t *dd)
|
|
|
|
{
|
|
|
|
*yy=getGlobalTime.Year;
|
|
|
|
*mm=getGlobalTime.Month;
|
|
|
|
*dd=getGlobalTime.DayOfMonth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_getToday(uint8_t *dow, uint16_t *minOfToday, uint32_t *secOfToday)
|
|
|
|
{
|
|
|
|
*dow=getGlobalTime.DayOfWeek;
|
|
|
|
*minOfToday=getGlobalTime.MinutesOfToday;
|
|
|
|
*secOfToday=getGlobalTime.SecondsOfToday;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_isLeapYear(uint8_t *lastLeapYear, uint8_t *NextLeapYear)
|
|
|
|
{
|
|
|
|
*lastLeapYear=getGlobalTime.lastLeap;
|
|
|
|
*NextLeapYear=getGlobalTime.nextLeap;
|
|
|
|
if (getGlobalTime.IsLeapyear)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_isLeapYear()
|
|
|
|
{
|
|
|
|
if (getGlobalTime.IsLeapyear)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_getSpecialWeekTimeDate(uint8_t *DayOfWeek, uint8_t *HoursOfWeek, uint16_t *MinutesOfWeek)
|
|
|
|
{
|
|
|
|
*DayOfWeek=getGlobalTime.DayOfWeek;
|
|
|
|
*HoursOfWeek=getGlobalTime.hoursOfWeek;
|
|
|
|
*MinutesOfWeek=getGlobalTime.minOfWeek;
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_getSpecialMonthTimeDate(uint8_t *DayOfMonth, uint16_t *HoursOfMonth, uint16_t *MinutesOfMonth)
|
|
|
|
{
|
|
|
|
*DayOfMonth=getGlobalTime.DayOfMonth;
|
|
|
|
*HoursOfMonth=getGlobalTime.hoursOfMonth;
|
|
|
|
*MinutesOfMonth=getGlobalTime.minOfMonth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_getSpecialYearTimeDate(uint16_t *DayOfYear, uint16_t *HoursOfYear, uint32_t *MinutesOfYear)
|
|
|
|
{
|
|
|
|
*DayOfYear=getGlobalTime.dayOfYear;
|
|
|
|
*HoursOfYear=getGlobalTime.hoursOfYear;
|
|
|
|
*MinutesOfYear=getGlobalTime.minOfYear;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString epi_getRtcTimeStr(uint8_t timeStyle)
|
|
|
|
{
|
|
|
|
// style: 0: hh:mm 1: hh:mm:ss
|
|
|
|
QString mystr=nullptr, tempStr=nullptr;
|
|
|
|
|
|
|
|
tempStr.setNum(getGlobalTime.hour,10);
|
|
|
|
mystr=tempStr.rightJustified(2,'0',false); // macht feste Länge, 5->05
|
|
|
|
mystr.append(':');
|
|
|
|
//tempStr.clear();
|
|
|
|
tempStr.setNum(getGlobalTime.minute,10); // mit 16 statt 10 wirds in HEX angezeigt
|
|
|
|
//mystr.append(tempStr);
|
|
|
|
mystr+=tempStr.rightJustified(2,'0',false);
|
|
|
|
//mystr.append(':'); // so
|
|
|
|
//mystr+=':'; // oder so, =gleich
|
|
|
|
|
|
|
|
if (timeStyle==1) // hh:mm:ss
|
|
|
|
{
|
|
|
|
mystr.append(':');
|
|
|
|
tempStr.setNum(getGlobalTime.second,10);
|
|
|
|
mystr.append(tempStr.rightJustified(2,'0',false)); // wie +=
|
|
|
|
}
|
|
|
|
return mystr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString epi_getRtcDateStr(uint8_t dateStyle)
|
|
|
|
{
|
|
|
|
// 1=german dd.mm.yy 2=american yy/mm/dd 3=mm.dd.yy
|
|
|
|
QString tmpStr=nullptr, YYstr=nullptr, MMstr=nullptr, DDstr=nullptr, mystr=nullptr;
|
|
|
|
mystr.clear();
|
|
|
|
|
|
|
|
tmpStr.setNum(getGlobalTime.Year,10); // itoa decimal
|
|
|
|
YYstr=tmpStr.rightJustified(4,'0',false); // immer vierstellig
|
|
|
|
YYstr[0]='2'; // 2000 dazu
|
|
|
|
|
|
|
|
tmpStr.setNum(getGlobalTime.Month,10);
|
|
|
|
MMstr=tmpStr.rightJustified(2,'0',false);
|
|
|
|
|
|
|
|
tmpStr.setNum(getGlobalTime.DayOfMonth,10);
|
|
|
|
DDstr=tmpStr.rightJustified(2,'0',false);
|
|
|
|
|
|
|
|
if (dateStyle==1) // Germany dd.mm.yy
|
|
|
|
{
|
|
|
|
mystr=DDstr + '.' + MMstr + '.' + YYstr;
|
|
|
|
} else
|
|
|
|
if (dateStyle==2) // american yy/mm/dd
|
|
|
|
{
|
|
|
|
mystr=YYstr + '/' + MMstr + '/' + DDstr;
|
|
|
|
} else
|
|
|
|
// mm.dd.yy
|
|
|
|
{
|
|
|
|
mystr=MMstr + '.' + DDstr + '.' + YYstr;
|
|
|
|
}
|
|
|
|
return mystr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString epi_getSlaveTimeDateStr()
|
|
|
|
{
|
|
|
|
QString myStr;
|
|
|
|
myStr=epi_getRtcTimeStr(1) + " " + epi_getRtcDateStr(1);
|
|
|
|
return myStr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// analog values
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
static uint16_t AI_val[MAXNROF_AI];
|
|
|
|
|
|
|
|
uint8_t gpi_getMaxNrAIs()
|
|
|
|
{
|
|
|
|
return MAXNROF_AI;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gpi_storeAIs(uint8_t aiNr, uint16_t val)
|
|
|
|
{
|
|
|
|
if (aiNr<MAXNROF_AI)
|
|
|
|
AI_val[aiNr]=val;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t epi_loadAIs(uint8_t aiNr)
|
|
|
|
{
|
|
|
|
if (aiNr<MAXNROF_AI)
|
|
|
|
return AI_val[aiNr];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------
|
|
|
|
// measurement values
|
|
|
|
// ADC0: temp
|
|
|
|
// 1: voltage
|
|
|
|
// 2: brightness
|
|
|
|
#define MAXNROF_MEASURE 4
|
|
|
|
|
|
|
|
static uint32_t Sdata_measurement[MAXNROF_MEASURE];
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t epi_loadMeasureValue(uint8_t ValueNr)
|
|
|
|
{
|
|
|
|
// ValueNr 0=ADC0, 1=ADC1 aso...
|
|
|
|
if (ValueNr<MAXNROF_MEASURE)
|
|
|
|
return Sdata_measurement[ValueNr];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gpi_storeMeasureValue(uint8_t ValueNr, uint32_t val)
|
|
|
|
{
|
|
|
|
// in mV, also bis 65,535V
|
|
|
|
if (ValueNr<MAXNROF_MEASURE)
|
|
|
|
Sdata_measurement[ValueNr]=val;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QString epi_getSlaveTemperatureStr()
|
|
|
|
{
|
|
|
|
char myStr[8], halfDegree=0, Minus=0, oneChar;
|
|
|
|
int16_t val=0, pp, einer, zehner;
|
|
|
|
QString myqStr;
|
|
|
|
|
|
|
|
//qDebug() << "AIN0: " << epi_loadAIs(0) << "AIN1: " << epi_loadAIs(1);
|
|
|
|
|
|
|
|
uint32_t meas_temper=epi_loadMeasureValue(MEASCHAN_TEMPERATURE);
|
|
|
|
// im SaxFormat gespeichert, hier umwandeln in String
|
|
|
|
|
|
|
|
//qDebug() << "meas_temper: " << meas_temper;
|
|
|
|
|
|
|
|
|
|
|
|
for (pp=0; pp<8; pp++) myStr[pp]=0;
|
|
|
|
if (meas_temper&1) // ungerade, also ,5°C
|
|
|
|
{
|
|
|
|
halfDegree=1;
|
|
|
|
meas_temper &=0xFFFE; // um 0,5°C abrunden
|
|
|
|
}
|
|
|
|
if (meas_temper<100)
|
|
|
|
{
|
|
|
|
Minus=1;
|
|
|
|
val=int16_t(meas_temper)/2;
|
|
|
|
val-=50;
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
val=int16_t(meas_temper)-100;
|
|
|
|
val/=2;
|
|
|
|
}
|
|
|
|
pp=0; // pointer auf string
|
|
|
|
if (Minus)
|
|
|
|
myStr[pp++]='-';
|
|
|
|
// val is now 0..150 for pos Temp or 0..49 for negativ temperature
|
|
|
|
if (val<10)
|
|
|
|
{
|
|
|
|
// only one digit, just change to ascii
|
|
|
|
oneChar = char(val)+0x30;
|
|
|
|
if (tslib_isDecAsciiNumber(oneChar))
|
|
|
|
myStr[pp++]=oneChar;
|
|
|
|
else
|
|
|
|
myStr[pp++]='0';
|
|
|
|
} else
|
|
|
|
if (val<100)
|
|
|
|
{
|
|
|
|
// 10...99
|
|
|
|
einer=val%10;
|
|
|
|
zehner=val/10;
|
|
|
|
//myStr[pp++]=char(zehner);
|
|
|
|
//myStr[pp++]=char(einer);
|
|
|
|
|
|
|
|
oneChar = char(zehner)+0x30;
|
|
|
|
if (tslib_isDecAsciiNumber(oneChar))
|
|
|
|
myStr[pp++]=oneChar;
|
|
|
|
else
|
|
|
|
myStr[pp++]='0';
|
|
|
|
|
|
|
|
oneChar = char(einer)+0x30;
|
|
|
|
if (tslib_isDecAsciiNumber(oneChar))
|
|
|
|
myStr[pp++]=oneChar;
|
|
|
|
else
|
|
|
|
myStr[pp++]='0';
|
|
|
|
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
// 100...150
|
|
|
|
myStr[pp++]='1'; // hunderter Stelle immer 1
|
|
|
|
val-=100;
|
|
|
|
einer=val%10;
|
|
|
|
zehner=val/10;
|
|
|
|
//myStr[pp++]=char(zehner)+0x30;
|
|
|
|
//myStr[pp++]=char(einer)+0x30;
|
|
|
|
oneChar = char(zehner)+0x30;
|
|
|
|
if (tslib_isDecAsciiNumber(oneChar))
|
|
|
|
myStr[pp++]=oneChar;
|
|
|
|
else
|
|
|
|
myStr[pp++]='0';
|
|
|
|
|
|
|
|
oneChar = char(einer)+0x30;
|
|
|
|
if (tslib_isDecAsciiNumber(oneChar))
|
|
|
|
myStr[pp++]=oneChar;
|
|
|
|
else
|
|
|
|
myStr[pp++]='0';
|
|
|
|
}
|
|
|
|
myStr[pp++]=',';
|
|
|
|
if (halfDegree)
|
|
|
|
myStr[pp++]='5';
|
|
|
|
else
|
|
|
|
myStr[pp++]='0';
|
|
|
|
myqStr.clear();
|
|
|
|
myqStr.append(myStr);
|
|
|
|
myqStr.append("°C");
|
|
|
|
return myqStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString epi_getSlaveVoltageStr()
|
|
|
|
{
|
|
|
|
// value in "meas_volt" in mV, also bis 65,535V. Value range [6000...16000] (6V...16V)
|
|
|
|
QString myqStr;
|
|
|
|
uint32_t vor, nach, tmp32;
|
|
|
|
uint16_t pp;
|
|
|
|
char myStr[12], ke; //, kz, kh;
|
|
|
|
|
|
|
|
uint32_t ultmp=epi_loadMeasureValue(MEASCHAN_VOLTAGE);
|
|
|
|
for (pp=0; pp<12; pp++) myStr[pp]=0;
|
|
|
|
|
|
|
|
//qDebug() << ultmp << "mV";
|
|
|
|
|
|
|
|
myqStr.clear();
|
|
|
|
vor=ultmp/1000;
|
|
|
|
//qDebug() << "vor: " << vor;
|
|
|
|
|
|
|
|
nach=ultmp%1000;
|
|
|
|
//qDebug() << "nach: " << nach;
|
|
|
|
pp=0;
|
|
|
|
if (vor>9)
|
|
|
|
{
|
|
|
|
myStr[pp++]=char(vor/10)+0x30;
|
|
|
|
}
|
|
|
|
myStr[pp++]=char(vor%10)+0x30;
|
|
|
|
myStr[pp++]=',';
|
|
|
|
|
|
|
|
ke=char(nach/100);
|
|
|
|
//qDebug() << "ke: " << ke;
|
|
|
|
myStr[pp++]=char(ke)+0x30;
|
|
|
|
|
|
|
|
tmp32=nach%100;
|
|
|
|
ke=char(tmp32/10);
|
|
|
|
//qDebug() << "ke: " << ke;
|
|
|
|
myStr[pp++]=char(ke)+0x30;
|
|
|
|
|
|
|
|
tmp32=nach%10;
|
|
|
|
ke=char(tmp32);
|
|
|
|
//qDebug() << "ke: " << ke;
|
|
|
|
myStr[pp++]=char(ke)+0x30;
|
|
|
|
|
|
|
|
|
|
|
|
myStr[pp++]='V';
|
|
|
|
myqStr.append(myStr);
|
|
|
|
return myqStr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// digital inputs
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/* come all in with 0x1201:
|
|
|
|
D0: upper door D1: low door D2:vault door
|
|
|
|
D3: cash box D4: bill box in
|
|
|
|
D5: bit 0: upper lockbar up bit1:down
|
|
|
|
D6: bit 0: lower lockbar up bit1:down
|
|
|
|
|
|
|
|
D7: 0
|
|
|
|
D7: DI_contact Power Is On
|
|
|
|
|
|
|
|
D8: OptoIn 1,2
|
|
|
|
D9: Aux0...5
|
|
|
|
D10:Wake from ptu
|
|
|
|
D11: DI Wake From Mdb
|
|
|
|
D12: Ready from printer
|
|
|
|
D13: Coin Shutter Input
|
|
|
|
D14: CoinEscrow switch
|
|
|
|
D15: Mifare IN
|
|
|
|
D16: Modem_Wake In
|
|
|
|
|
|
|
|
D18: DI Mif Pwr is on
|
|
|
|
D19: DI MDB_TxD_rdBack
|
|
|
|
D20: DI Aux Pwr is on
|
|
|
|
D21: DI GSM Pwr from PO2 is ON
|
|
|
|
D22: DI Credit Pwr from PO2 is on
|
|
|
|
=DI RdBack Credit Wake
|
|
|
|
D23: DI Printer Pwr from PO2 is on
|
|
|
|
D24: DI MDB Pwr from PO2 is on
|
|
|
|
*/
|
|
|
|
|
|
|
|
static uint8_t di_doorSwitch;
|
|
|
|
void gpi_storeDI_doorSwitches(uint8_t upperDoor, uint8_t lowerDoor, uint8_t vaultDoor)
|
|
|
|
{
|
|
|
|
|
|
|
|
di_doorSwitch=0;
|
|
|
|
if (upperDoor) di_doorSwitch |=1;
|
|
|
|
if (lowerDoor) di_doorSwitch |=2;
|
|
|
|
if (vaultDoor) di_doorSwitch |=4;
|
|
|
|
|
|
|
|
// qDebug()<<"storeINdata: "<<upperDoor << lowerDoor << vaultDoor;
|
|
|
|
// qDebug()<<"storeINdata: "<<di_doorSwitch;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDI_doorSwitches(void)
|
|
|
|
{
|
|
|
|
// bit0: upper door 1: low door 2:vault door
|
|
|
|
return di_doorSwitch;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t di_vaultSwitch;
|
|
|
|
void gpi_storeDI_vaultSwitches(uint8_t CashBoxIn, uint8_t BillBoxIn)
|
|
|
|
{
|
|
|
|
di_vaultSwitch=0;
|
|
|
|
if (CashBoxIn) di_vaultSwitch |=1;
|
|
|
|
if (BillBoxIn) di_vaultSwitch |=2;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDI_vaultSwitches(void)
|
|
|
|
{
|
|
|
|
// bit0: cash box 1: bill box in
|
|
|
|
return di_vaultSwitch;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t di_lockSwitch;
|
|
|
|
void gpi_storeDI_lockSwitches(uint8_t indatUL, uint8_t indatLL)
|
|
|
|
{
|
|
|
|
// D5: bit 0: upper lockbar up bit1:down
|
|
|
|
// D6: bit 0: lower lockbar up bit1:down
|
|
|
|
di_lockSwitch=0;
|
|
|
|
if (indatUL & 1) di_lockSwitch |=1;
|
|
|
|
if (indatUL & 2) di_lockSwitch |=2;
|
|
|
|
if (indatLL & 1) di_lockSwitch |=4;
|
|
|
|
if (indatLL & 2) di_lockSwitch |=8;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDI_lockSwitches(void)
|
|
|
|
{
|
|
|
|
// retval: bit 0: upper lockbar up bit1: upper lockbar is down
|
|
|
|
// bit 2: lower lockbar up bit1: lower lockbar is down
|
|
|
|
|
|
|
|
return di_lockSwitch;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t di_opto;
|
|
|
|
void gpi_storeDI_optos(uint8_t indatOpto)
|
|
|
|
{
|
|
|
|
// OptoIn bit 0,1: optoin 1,2
|
|
|
|
di_opto=0;
|
|
|
|
if (indatOpto & 1) di_opto |=1;
|
|
|
|
if (indatOpto & 2) di_opto |=2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDI_optos(void)
|
|
|
|
{
|
|
|
|
// bit0: opto in 1 1: opto in 2
|
|
|
|
return di_opto;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t di_aux;
|
|
|
|
void gpi_storeDI_auxIn(uint8_t indatAuxIn)
|
|
|
|
{
|
|
|
|
// Aux0...5
|
|
|
|
di_aux=indatAuxIn;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDI_auxIn(void)
|
|
|
|
{
|
|
|
|
// bit0: auxin 1 ... 5: auxin 6
|
|
|
|
return di_aux;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool di_wakeFromPtu;
|
|
|
|
void gpi_storeDI_ptuWake(uint8_t indat)
|
|
|
|
{
|
|
|
|
if (indat)
|
|
|
|
di_wakeFromPtu=true;
|
|
|
|
else
|
|
|
|
di_wakeFromPtu=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_ptuWake(void)
|
|
|
|
{
|
|
|
|
return di_wakeFromPtu;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool di_wakeFromMdb;
|
|
|
|
void gpi_storeDI_mbdWake(uint8_t indat)
|
|
|
|
{
|
|
|
|
if (indat)
|
|
|
|
di_wakeFromMdb=true;
|
|
|
|
else
|
|
|
|
di_wakeFromMdb=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_mdbWake(void)
|
|
|
|
{
|
|
|
|
return di_wakeFromMdb;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool di_PrnReady;
|
|
|
|
void gpi_storeDI_prnReady(uint8_t indat)
|
|
|
|
{
|
|
|
|
if (indat)
|
|
|
|
di_PrnReady=true;
|
|
|
|
else
|
|
|
|
di_PrnReady=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_prnReady(void)
|
|
|
|
{
|
|
|
|
return di_PrnReady;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool di_CoinAttach;
|
|
|
|
void gpi_storeDI_CoinAttach(uint8_t indat)
|
|
|
|
{
|
|
|
|
if (indat)
|
|
|
|
di_CoinAttach=true;
|
|
|
|
else
|
|
|
|
di_CoinAttach=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_CoinAttach(void)
|
|
|
|
{
|
|
|
|
return di_CoinAttach;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_CoinEscrowOpen;
|
|
|
|
void gpi_storeDI_CoinEscrow(uint8_t indat)
|
|
|
|
{
|
|
|
|
if (indat)
|
|
|
|
di_CoinEscrowOpen=true;
|
|
|
|
else
|
|
|
|
di_CoinEscrowOpen=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_CoinEscrow(void)
|
|
|
|
{
|
|
|
|
return di_CoinEscrowOpen;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool di_mifCardTap;
|
|
|
|
void gpi_storeDI_mifareCardTapped(uint8_t indat)
|
|
|
|
{
|
|
|
|
if (indat)
|
|
|
|
di_mifCardTap=true;
|
|
|
|
else
|
|
|
|
di_mifCardTap=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_mifareCardTapped(void)
|
|
|
|
{
|
|
|
|
return di_mifCardTap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool di_wakeFromModem;
|
|
|
|
void gpi_storeDI_modemWake(uint8_t indat)
|
|
|
|
{
|
|
|
|
if (indat)
|
|
|
|
di_wakeFromModem=true;
|
|
|
|
else
|
|
|
|
di_wakeFromModem=false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_modemWake(void)
|
|
|
|
{
|
|
|
|
return di_wakeFromModem;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool di_contactPwrOn;
|
|
|
|
|
|
|
|
void gpi_storeDI_contactPowerIsOn(bool di_contact_PwrOn)
|
|
|
|
{
|
|
|
|
di_contactPwrOn=di_contact_PwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_contactPwr(void)
|
|
|
|
{
|
|
|
|
// invertiert!
|
|
|
|
if (di_contactPwrOn)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_mifarePwrOn;
|
|
|
|
|
|
|
|
void gpi_storeDI_MifarePowerIsOn(bool di_mifare_PwrOn)
|
|
|
|
{
|
|
|
|
di_mifarePwrOn=di_mifare_PwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_mifarePwr(void)
|
|
|
|
{
|
|
|
|
return di_mifarePwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_rdbk_mdbTxd;
|
|
|
|
|
|
|
|
void gpi_storeDI_readbackMdbTxD(bool di_rdbkMdbTxd)
|
|
|
|
{
|
|
|
|
di_rdbk_mdbTxd=di_rdbkMdbTxd;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_mdbTxd(void)
|
|
|
|
{
|
|
|
|
return di_rdbk_mdbTxd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_AuxPwrOn;
|
|
|
|
|
|
|
|
void gpi_storeDI_AuxPowerIsOn(bool di_Aux_PwrOn)
|
|
|
|
{
|
|
|
|
di_AuxPwrOn=di_Aux_PwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_auxPwr(void)
|
|
|
|
{
|
|
|
|
return di_AuxPwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_gsmPwrOn;
|
|
|
|
|
|
|
|
void gpi_storeDI_GsmPowerIsOn(bool di_gsm_PwrOn)
|
|
|
|
{
|
|
|
|
di_gsmPwrOn=di_gsm_PwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_gsmPwr(void)
|
|
|
|
{
|
|
|
|
return di_gsmPwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_creditPwrOn;
|
|
|
|
|
|
|
|
void gpi_storeDI_CreditPowerIsOn(bool di_credit_PwrOn)
|
|
|
|
{
|
|
|
|
// invertieren!!!
|
|
|
|
if (di_credit_PwrOn)
|
|
|
|
di_creditPwrOn=0;
|
|
|
|
else
|
|
|
|
di_creditPwrOn=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_creditPwr(void)
|
|
|
|
{
|
|
|
|
return di_creditPwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_printerPwrOn;
|
|
|
|
|
|
|
|
void gpi_storeDI_PrinterPowerIsOn(bool di_printer_PwrOn)
|
|
|
|
{
|
|
|
|
di_printerPwrOn=di_printer_PwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_printerPwr(void)
|
|
|
|
{
|
|
|
|
return di_printerPwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_mdbPwrOn;
|
|
|
|
|
|
|
|
void gpi_storeDI_MdbPowerIsOn(bool di_mdb_PwrOn)
|
|
|
|
{
|
|
|
|
di_mdbPwrOn=di_mdb_PwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_mdbPwr(void)
|
|
|
|
{
|
|
|
|
return di_mdbPwrOn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool di_rejMot_home;
|
|
|
|
|
|
|
|
void gpi_storeDI_rejMot_home(bool di)
|
|
|
|
{
|
|
|
|
di_rejMot_home=di;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDI_rejectMotor_homepos(void)
|
|
|
|
{
|
|
|
|
return di_rejMot_home;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t di_npe_sensor;
|
|
|
|
|
|
|
|
void gpi_storeDI_paperLow(uint8_t di)
|
|
|
|
{
|
|
|
|
// 0: Sensor sees paper 1: no paper 99: off
|
|
|
|
di_npe_sensor=di;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDI_npe_sensor(void)
|
|
|
|
{
|
|
|
|
return di_npe_sensor;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// readaback digital outputs
|
|
|
|
// ///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
D0 bit0: MDB devices 0=off 1=on
|
|
|
|
bit1: MDB bus power
|
|
|
|
bit2: MDB WakeOut
|
|
|
|
|
|
|
|
D1=Printer
|
|
|
|
D2=Credit
|
|
|
|
D3=Modem
|
|
|
|
|
|
|
|
D5: serial drv on/off, Serial mux1, Serial mux2
|
|
|
|
D6: Leds, Fan,
|
|
|
|
D7: Siren and relay
|
|
|
|
D8: PtuWakeOut
|
|
|
|
D9: Power Aux/Barcode
|
|
|
|
D10: AuxDir 1...6
|
|
|
|
D11: AuxOut 1...6
|
|
|
|
D12: Coin shutter output
|
|
|
|
D13: CoinEscrow Outputs
|
|
|
|
*/
|
|
|
|
|
|
|
|
static uint8_t do_mbdRxTst;
|
|
|
|
void gpi_storeDO_mdbRxTst(uint8_t mdbRxTst)
|
|
|
|
{
|
|
|
|
do_mbdRxTst=mdbRxTst;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_mdbRxTestOut(void)
|
|
|
|
{
|
|
|
|
if (do_mbdRxTst & 1)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t do_motorBits;
|
|
|
|
void gpi_storeDO_motorOutputs(uint8_t Pwr)
|
|
|
|
{
|
|
|
|
//D1: motor outputs bit0: upper lock forw bit 1 backw
|
|
|
|
// Bit2: lowLock forw bit3: LL backw
|
|
|
|
do_motorBits=Pwr;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDO_motorOuts(void)
|
|
|
|
{
|
|
|
|
// bit0: upper lock forward bit 1 backward
|
|
|
|
// bit2: lower lock forward bit 3 backward
|
|
|
|
return do_motorBits;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t do_serialSwitch; // serial drv on/off, Serial mux1, Serial mux2
|
|
|
|
void gpi_storeDO_serialSwitch(uint8_t state) // serial drv on/off, Serial mux1, Serial mux2
|
|
|
|
{
|
|
|
|
do_serialSwitch=state;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDO_serialSwitch(void)
|
|
|
|
{
|
|
|
|
// serial drv on/off, Serial mux1, Serial mux2
|
|
|
|
return do_serialSwitch;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_serialDriverIsOn(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( do_serialSwitch & 1)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_serialMux1isSetToPrinter(void)
|
|
|
|
{
|
|
|
|
// mux1 off: serial is switched to printer
|
|
|
|
if ((do_serialSwitch & 2)==0)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_serialMux1isSetToModem(void)
|
|
|
|
{
|
|
|
|
// mux1 on: serial is switched to modem
|
|
|
|
if ((do_serialSwitch & 2)>0)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_serialMux2isSetToCredit(void)
|
|
|
|
{
|
|
|
|
// mux2 off: serial is switched to credit card terminal
|
|
|
|
if ((do_serialSwitch & 4)==0)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_serialMux2isSetToMifare(void)
|
|
|
|
{
|
|
|
|
// mux2 on: serial is switched to mifare reader
|
|
|
|
if ((do_serialSwitch & 4)>0)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t do_ledsAndFan;
|
|
|
|
void gpi_storeDO_ledsAndFan(uint8_t ledState)
|
|
|
|
{
|
|
|
|
// bit0: coinled 1:front_illu 2: paper-led 3:pinpad-led 4:start-led 5:service-led 6:fan
|
|
|
|
do_ledsAndFan=ledState;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_led_coin(void)
|
|
|
|
{
|
|
|
|
if (do_ledsAndFan & 1)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_led_front(void)
|
|
|
|
{
|
|
|
|
if (do_ledsAndFan & 2)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_led_ticket(void)
|
|
|
|
{
|
|
|
|
if (do_ledsAndFan & 4)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_led_pin(void)
|
|
|
|
{
|
|
|
|
if (do_ledsAndFan & 8)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_led_start(void)
|
|
|
|
{
|
|
|
|
if (do_ledsAndFan & 16)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_led_inside(void)
|
|
|
|
{
|
|
|
|
if (do_ledsAndFan & 32)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_fan(void)
|
|
|
|
{
|
|
|
|
if (do_ledsAndFan & 64)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t do_laermUndRelay;
|
|
|
|
void gpi_storeDO_sirenAndRelay(uint8_t sirenRelay)
|
|
|
|
{
|
|
|
|
// bit0: siren 1:relay
|
|
|
|
do_laermUndRelay=sirenRelay;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_sirene(void)
|
|
|
|
{
|
|
|
|
if (do_laermUndRelay & 1)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_relay(void)
|
|
|
|
{
|
|
|
|
if (do_laermUndRelay & 2)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t do_ptuWake;
|
|
|
|
void gpi_storeDO_ptuWake(uint8_t state)
|
|
|
|
{
|
|
|
|
do_ptuWake=state;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_ptuWake(void)
|
|
|
|
{
|
|
|
|
if (do_ptuWake>0)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t do_auxPower;
|
|
|
|
void gpi_storeDO_auxPower(uint8_t pwr)
|
|
|
|
{
|
|
|
|
do_auxPower=pwr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_auxPower(void)
|
|
|
|
{
|
|
|
|
if (do_auxPower>0)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t do_coinShutter;
|
|
|
|
void gpi_storeDO_coinShutter(uint8_t state)
|
|
|
|
{
|
|
|
|
do_coinShutter=state;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_coinShutterOpen(void)
|
|
|
|
{
|
|
|
|
// bit0: Coin shutter output, bit1: input-test-output
|
|
|
|
if (do_coinShutter & 1)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_getDO_coinShutterTest(void)
|
|
|
|
{
|
|
|
|
// bit0: Coin shutter output, bit1: input-test-output
|
|
|
|
if (do_coinShutter & 2)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t do_coinEscrow;
|
|
|
|
|
|
|
|
void gpi_storeDO_coinEscrow(uint8_t state)
|
|
|
|
{
|
|
|
|
do_coinEscrow=state;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDO_coinEscrow(void)
|
|
|
|
{
|
|
|
|
// retval: 1:return flap is open 2:take flap is open 0:closed
|
|
|
|
if (do_coinEscrow &1)
|
|
|
|
return 1; // return flap is open
|
|
|
|
if (do_coinEscrow &2)
|
|
|
|
return 2; // take flap is open
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t do_printerPower;
|
|
|
|
|
|
|
|
void gpi_storeDO_printerPwrOn(uint8_t state)
|
|
|
|
{
|
|
|
|
do_printerPower=state;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_getDO_printerPwr(void)
|
|
|
|
{
|
|
|
|
return do_printerPower;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
//----------------------------- Mifare Card Reader -----------------------------------
|
|
|
|
|
|
|
|
#define NROFMIFSTATEBYTES 40
|
|
|
|
static uint8_t Sdata_MIF_STATE[NROFMIFSTATEBYTES];
|
|
|
|
|
|
|
|
uint8_t gpi_storeMifReaderStateAndCardType(uint8_t *buf)
|
|
|
|
{
|
|
|
|
// retval 0=OK 1=error host buffer too small
|
|
|
|
for (uint8_t nn=0; nn<NROFMIFSTATEBYTES; nn++)
|
|
|
|
Sdata_MIF_STATE[nn]=0;
|
|
|
|
for (uint8_t nn=0; nn<8; nn++)
|
|
|
|
Sdata_MIF_STATE[nn]=buf[nn];
|
|
|
|
return 0; // OK
|
|
|
|
}
|
|
|
|
|
|
|
|
/* data description:
|
|
|
|
|
|
|
|
new fast version:
|
|
|
|
byte 0= still the same: current read state:
|
|
|
|
0=power off 1=reader-fault 2=ready
|
|
|
|
3=just reading 4=read complete
|
|
|
|
5=read partial, removed too early
|
|
|
|
6=state unknown
|
|
|
|
|
|
|
|
byte 1: reader state 1=ok 0=nok
|
|
|
|
byte 2: card preent (0,1)
|
|
|
|
byte 3: card selected (0)
|
|
|
|
byte 4: card type: 0...5
|
|
|
|
byte 5: card allowed (0=no 1=MifareClassic 1k or 4k)
|
|
|
|
byte 6: CardSize: 1 or 4 (kB)
|
|
|
|
byte 7: length of UID 4 or 7 (byte)
|
|
|
|
|
|
|
|
|
|
|
|
old long version
|
|
|
|
byte 0: current read state: 0=power off 1=reader-fault 2=ready
|
|
|
|
3=just reading 4=read complete
|
|
|
|
5=read partial, removed too early
|
|
|
|
6=state unknown
|
|
|
|
byte 1,2: read data length from card
|
|
|
|
3: 1=reader is OK (reported serial nr is OK) 0=wrong or no reader
|
|
|
|
4...15: reader version, expected "SL025-1.8"
|
|
|
|
byte16: 1=card is present 0:not
|
|
|
|
17: 0
|
|
|
|
18: card type reported from reader
|
|
|
|
19: 1=allowed card type 0=not
|
|
|
|
20: card size: 1 or 4 (dec) = card size
|
|
|
|
21: LengthOfUID: 4 or 7 (dec) (byte)
|
|
|
|
22: UID 8 byte in hex
|
|
|
|
byte 30: sector logged: 0
|
|
|
|
byte 31: current sector: 0
|
|
|
|
byte 32: result, always 0
|
|
|
|
*/
|
|
|
|
|
|
|
|
uint8_t epi_restoreMifState(uint8_t *buf, uint8_t maxBufferSize)
|
|
|
|
{
|
|
|
|
// HWapi can read States from DC
|
|
|
|
if (maxBufferSize<8)
|
|
|
|
return 1; // error
|
|
|
|
|
|
|
|
for (uint8_t nn=0; nn<8; nn++)
|
|
|
|
buf[nn]=Sdata_MIF_STATE[nn];
|
|
|
|
return 0; // OK
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t Sdata_MIF_DATA[12][64];
|
|
|
|
// data come in blockwise, so safe them blockwise as well
|
|
|
|
void gpi_storeMifCardData(uint8_t blkNr, uint8_t *receivedData)
|
|
|
|
{
|
|
|
|
if (blkNr<12)
|
|
|
|
{
|
|
|
|
for (uint8_t nn=0; nn<64; nn++)
|
|
|
|
Sdata_MIF_DATA[blkNr][nn]=receivedData[nn];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_restoreMifData(uint8_t blkNr, uint8_t *buf, uint8_t maxBufferSize)
|
|
|
|
{
|
|
|
|
if (blkNr>11 || maxBufferSize<64)
|
|
|
|
return 1; // error
|
|
|
|
|
|
|
|
for (uint8_t nn=0; nn<64; nn++)
|
|
|
|
buf[nn]=Sdata_MIF_DATA[blkNr][nn];
|
|
|
|
|
|
|
|
return 0; // ois OK
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t Sdata_PRN_STATE[pi_prnStateArraySize];
|
|
|
|
|
|
|
|
void epi_restorePrinterState(uint8_t *buf)
|
|
|
|
{
|
|
|
|
uint8_t nn;
|
|
|
|
|
|
|
|
for (nn=0; nn<pi_prnStateArraySize; nn++)
|
|
|
|
buf[nn]=Sdata_PRN_STATE[nn];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void gpi_storePrinterState(uint8_t *buf)
|
|
|
|
{
|
|
|
|
uint8_t nn;
|
|
|
|
|
|
|
|
for (nn=0; nn<pi_prnStateArraySize; nn++)
|
|
|
|
Sdata_PRN_STATE[nn]=buf[nn];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint8_t Sdata_PRN_FONTS[pi_prnFontArraySize];
|
|
|
|
|
|
|
|
void epi_restorePrinterFonts(uint8_t *buf)
|
|
|
|
{
|
|
|
|
uint8_t nn;
|
|
|
|
|
|
|
|
for (nn=0; nn<pi_prnFontArraySize; nn++)
|
|
|
|
buf[nn]=Sdata_PRN_FONTS[nn];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void gpi_storePrinterFonts(uint8_t *buf)
|
|
|
|
{
|
|
|
|
uint8_t nn;
|
|
|
|
|
|
|
|
for (nn=0; nn<pi_prnFontArraySize; nn++)
|
|
|
|
Sdata_PRN_FONTS[nn]=buf[nn];
|
|
|
|
/*
|
|
|
|
qDebug()<<"printer fonts stored " <<Sdata_PRN_FONTS[0]<<" "<<Sdata_PRN_FONTS[1]<<" " \
|
|
|
|
<<Sdata_PRN_FONTS[2]<<" "<<Sdata_PRN_FONTS[3]<<" " \
|
|
|
|
<<Sdata_PRN_FONTS[4]<<" "<<Sdata_PRN_FONTS[5]<<" " \
|
|
|
|
<<Sdata_PRN_FONTS[6]<<" "<<Sdata_PRN_FONTS[7]<<" " \
|
|
|
|
<<Sdata_PRN_FONTS[8]<<" "<<Sdata_PRN_FONTS[9]<<" " \
|
|
|
|
<<Sdata_PRN_FONTS[10]<<" "<<Sdata_PRN_FONTS[11];
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool Sdata_mdb_busRdy;
|
|
|
|
static bool Sdata_mdb_V12on;
|
|
|
|
static bool Sdata_mdb_V5on;
|
|
|
|
|
|
|
|
// DB0: mdb_bus_ready (switched on)
|
|
|
|
// DB1: rdBackV12devicePower
|
|
|
|
// DB2: rdBackV5busPwr
|
|
|
|
void gpi_storeMdbState(uint8_t busReady, uint8_t V12on, uint8_t V5on )
|
|
|
|
{
|
|
|
|
Sdata_mdb_busRdy=bool(busReady);
|
|
|
|
Sdata_mdb_V12on=bool(V12on);
|
|
|
|
Sdata_mdb_V5on=bool(V5on);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_restoreMdbBusReady(void)
|
|
|
|
{
|
|
|
|
return Sdata_mdb_busRdy;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_restoreMdbV12Ready(void)
|
|
|
|
{
|
|
|
|
return Sdata_mdb_V12on;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_restoreMdbV5Ready(void)
|
|
|
|
{
|
|
|
|
return Sdata_mdb_V5on;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t Sdata_mdbNrOfRecData;
|
|
|
|
static uint8_t Sdata_RecBuff[40];
|
|
|
|
|
|
|
|
// last received mdb answer (from mdb device)
|
|
|
|
// only needed if a special command was sent directly
|
|
|
|
// DB0: mdb Device-Nr
|
|
|
|
// DB1: last sent mdb command
|
|
|
|
// DB2: nr of received (payload) data bytes (apart from ACK, can be 0....34)
|
|
|
|
// DB3...DB38: rec.data (payload)
|
|
|
|
void gpi_storeMdbResponse(uint8_t leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
|
|
|
|
tslib_strclr(Sdata_RecBuff,0,40);
|
|
|
|
Sdata_mdbNrOfRecData=leng;
|
|
|
|
tslib_strcpy(data, Sdata_RecBuff, uint16_t(Sdata_mdbNrOfRecData));
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_restoreMdbResponse(uint8_t *leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
*leng=Sdata_mdbNrOfRecData;
|
|
|
|
tslib_strcpy(Sdata_RecBuff, data, Sdata_mdbNrOfRecData);
|
|
|
|
*leng = Sdata_mdbNrOfRecData;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t Sdata_empNrOfsettings;
|
|
|
|
static uint8_t Sdata_emp_settingsBuff[66];
|
|
|
|
|
|
|
|
void gpi_storeEmpSettings(uint8_t leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
if (leng>64) leng=64;
|
|
|
|
Sdata_empNrOfsettings=leng;
|
|
|
|
tslib_strcpy(data, Sdata_emp_settingsBuff, leng);
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_restoreEmpSettings(uint8_t *leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
|
|
|
|
*leng=Sdata_empNrOfsettings;
|
|
|
|
tslib_strcpy(Sdata_emp_settingsBuff, data, Sdata_empNrOfsettings);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ......................................................................
|
|
|
|
// Münzbuffer[10]: Münze für Münze auslesen (LIFO)
|
|
|
|
// 4.5.21
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct T_coin
|
|
|
|
{
|
|
|
|
uint8_t valid;
|
|
|
|
uint8_t signal;
|
|
|
|
uint8_t error;
|
|
|
|
uint8_t pad;
|
|
|
|
uint16_t value;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct T_coin gotCoin[MEMDEPTH_GOTCOINS];
|
|
|
|
static uint8_t ctr_gotCoin;
|
|
|
|
|
|
|
|
|
|
|
|
void sub_enterData(uint8_t valid, uint8_t signal, uint8_t error, uint16_t value )
|
|
|
|
{
|
|
|
|
if (ctr_gotCoin<MEMDEPTH_GOTCOINS)
|
|
|
|
{
|
|
|
|
gotCoin[ctr_gotCoin].valid=valid;
|
|
|
|
gotCoin[ctr_gotCoin].signal=signal;
|
|
|
|
gotCoin[ctr_gotCoin].error=error;
|
|
|
|
gotCoin[ctr_gotCoin].value=value;
|
|
|
|
}
|
|
|
|
ctr_gotCoin++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void gpi_storeEmpCoinSignal(uint8_t leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
// leng is number of coin record with 5 bytes each
|
|
|
|
uint8_t LL=leng; // nr of coin records
|
|
|
|
uint16_t vv, pp=0;
|
|
|
|
|
|
|
|
//qDebug()<<"store emp data, len: "<<LL;
|
|
|
|
|
|
|
|
//while (LL>0) // with FastProtocol only one coin
|
|
|
|
{
|
|
|
|
vv=uchar2uint(data[pp+4], data[pp+3]);
|
|
|
|
sub_enterData(data[pp], data[pp+1], data[pp+2], vv );
|
|
|
|
|
|
|
|
//qDebug()<< "emp IN data: " << data[pp] << " " << data[pp+1]
|
|
|
|
// << " " <<data[pp+2] <<" " <<data[pp+3] <<" " <<data[pp+4] <<" ";
|
|
|
|
|
|
|
|
pp+=5;
|
|
|
|
LL--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t epi_isNewCoinLeft(void)
|
|
|
|
{
|
|
|
|
// retval: 0...16 coins left in FIFO
|
|
|
|
return ctr_gotCoin;
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_restoreEmpCoinSignal(uint8_t *valid, uint8_t *signal, uint8_t *error, uint16_t *value)
|
|
|
|
{
|
|
|
|
ctr_gotCoin--;
|
|
|
|
if (ctr_gotCoin<MEMDEPTH_GOTCOINS)
|
|
|
|
{
|
|
|
|
*valid=gotCoin[ctr_gotCoin].valid;
|
|
|
|
*signal=gotCoin[ctr_gotCoin].signal;
|
|
|
|
*error=gotCoin[ctr_gotCoin].error;
|
|
|
|
*value=gotCoin[ctr_gotCoin].value;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
qDebug()<<"read emp data, nr "<<ctr_gotCoin << "valid: " << *valid
|
|
|
|
<< "signal: " << *signal
|
|
|
|
<< "error: " << *error
|
|
|
|
<< "value: " << *value;
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t Sdata_NrOfDeviceSetting;
|
|
|
|
static uint8_t Sdata_DeviceSettingBuff[66];
|
|
|
|
|
2023-04-13 10:58:17 +02:00
|
|
|
void gpi_storeRbDeviceSettings(uint8_t leng, uint8_t *data) // getestet am 12.4.23TS
|
2023-04-11 14:04:38 +02:00
|
|
|
{
|
|
|
|
if (leng>64) leng=64;
|
|
|
|
Sdata_NrOfDeviceSetting=leng;
|
2023-04-13 10:58:17 +02:00
|
|
|
tslib_strcpy(data, Sdata_DeviceSettingBuff, leng); // getestet am 12.4.23TS
|
2023-04-11 14:04:38 +02:00
|
|
|
}
|
|
|
|
|
2023-04-13 10:58:17 +02:00
|
|
|
void epi_restoreRbDeviceSettings(uint8_t *leng, uint8_t *data) // getestet am 12.4.23TS
|
2023-04-11 14:04:38 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
*leng=Sdata_NrOfDeviceSetting;
|
|
|
|
tslib_strcpy(Sdata_DeviceSettingBuff, data, Sdata_NrOfDeviceSetting);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t Sdata_NrOfMachineIDSetting;
|
|
|
|
static uint8_t Sdata_NrOfMachineIDBuff[66];
|
|
|
|
|
|
|
|
void gpi_storeMachineIDsettings(uint8_t leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
if (leng>64) leng=64;
|
|
|
|
Sdata_NrOfMachineIDSetting=leng;
|
|
|
|
tslib_strcpy(data, Sdata_NrOfMachineIDBuff, leng);
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_restoreMachineIDsettings(uint8_t *leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
|
|
|
|
*leng=Sdata_NrOfMachineIDSetting;
|
|
|
|
tslib_strcpy(Sdata_NrOfMachineIDBuff, data, Sdata_NrOfMachineIDSetting);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-13 10:58:17 +02:00
|
|
|
static uint32_t store_insertedAmount;
|
|
|
|
static uint16_t store_lastCoinType[64];
|
|
|
|
static uint16_t store_lastCoinValue[64];
|
|
|
|
static uint8_t p_lastCoin;
|
|
|
|
|
|
|
|
void epi_clearCurrentPayment(void)
|
|
|
|
{
|
|
|
|
// call at beginning of coin collection
|
|
|
|
store_insertedAmount=0;
|
|
|
|
p_lastCoin=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gpi_storeCurrentPayment(uint32_t insertedAmount, uint16_t lastCoinType, uint16_t lastCoinValue)
|
|
|
|
{
|
|
|
|
store_insertedAmount=insertedAmount;
|
|
|
|
store_lastCoinType[p_lastCoin]=lastCoinType;
|
|
|
|
store_lastCoinValue[p_lastCoin]=lastCoinValue;
|
|
|
|
p_lastCoin++;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t epi_CurrentPaymentGetAmount(void)
|
|
|
|
{
|
|
|
|
return store_insertedAmount;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t epi_CurrentPaymentGetLastCoin(void)
|
|
|
|
{
|
|
|
|
uint8_t pp;
|
|
|
|
pp=p_lastCoin;
|
|
|
|
if (pp==0)
|
|
|
|
return 0; // noch keine Münze erhalten
|
|
|
|
if (pp>0) pp--;
|
|
|
|
return store_lastCoinValue[pp];
|
|
|
|
}
|
|
|
|
|
|
|
|
bool epi_CurrentPaymentGetAllCoins(uint16_t *types, uint16_t *values)
|
|
|
|
{
|
|
|
|
// alle bei diesem Verkauf eingeworfenen Münzen sind gespeichert falls die jmd. braucht
|
|
|
|
uint8_t nn;
|
|
|
|
if (p_lastCoin==0)
|
|
|
|
return false;
|
|
|
|
for (nn=0; nn<64; nn++)
|
|
|
|
{
|
|
|
|
types[nn]=store_lastCoinType[nn];
|
|
|
|
values[nn]=store_lastCoinValue[nn];
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t stor_wakSrc;
|
|
|
|
|
|
|
|
void gpi_storeWakeSources(uint8_t *receivedData)
|
|
|
|
{
|
|
|
|
uint8_t uctmp;
|
|
|
|
int nn;
|
|
|
|
stor_wakSrc=0;
|
|
|
|
for (nn=7; nn>=0; nn--)
|
|
|
|
{
|
|
|
|
uctmp=receivedData[nn];
|
|
|
|
stor_wakSrc |=uctmp;
|
|
|
|
stor_wakSrc<<=8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t epi_getWakeSources(void)
|
|
|
|
{
|
|
|
|
return stor_wakSrc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t store_rbDevParamLen;
|
|
|
|
static uint8_t store_rbDevParams[66];
|
|
|
|
|
|
|
|
void gpi_storeExtendedTime(uint8_t leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
if (leng>64) leng=64;
|
|
|
|
store_rbDevParamLen=leng;
|
|
|
|
tslib_strcpy(data, store_rbDevParams, leng);
|
|
|
|
}
|
2023-04-11 14:04:38 +02:00
|
|
|
|
2023-04-13 10:58:17 +02:00
|
|
|
void epi_restoreExtendedTime(uint8_t *leng, uint8_t *data)
|
|
|
|
{
|
2023-04-11 14:04:38 +02:00
|
|
|
|
2023-04-13 10:58:17 +02:00
|
|
|
*leng=store_rbDevParamLen;
|
|
|
|
tslib_strcpy(store_rbDevParams, data, store_rbDevParamLen);
|
|
|
|
}
|
2023-04-11 14:04:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-04-13 10:58:17 +02:00
|
|
|
// store device conditions
|
|
|
|
static uint8_t store_deviceCondLen;
|
|
|
|
static uint8_t store_deviceCond[66];
|
2023-04-11 14:04:38 +02:00
|
|
|
|
2023-04-13 10:58:17 +02:00
|
|
|
void gpi_storeDeviceConditions(uint8_t leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
if (leng>64) leng=64;
|
|
|
|
store_deviceCondLen=leng;
|
|
|
|
tslib_strcpy(data, store_deviceCond, leng);
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_restoreDeviceConditions(uint8_t *leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
|
|
|
|
*leng=store_deviceCondLen;
|
|
|
|
tslib_strcpy(store_deviceCond, data, store_deviceCondLen);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// store dynamic machine conditions
|
|
|
|
static uint8_t store_machCondLen;
|
|
|
|
static uint8_t store_machCond[66];
|
|
|
|
|
|
|
|
void gpi_storeDynMachineConditions(uint8_t leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
if (leng>64) leng=64;
|
|
|
|
store_machCondLen=leng;
|
|
|
|
tslib_strcpy(data, store_machCond, leng);
|
|
|
|
}
|
|
|
|
|
|
|
|
void epi_restoreDynMachineConditions(uint8_t *leng, uint8_t *data)
|
|
|
|
{
|
|
|
|
|
|
|
|
*leng=store_machCondLen;
|
|
|
|
tslib_strcpy(store_machCond, data, store_machCondLen);
|
|
|
|
}
|
2023-04-11 14:04:38 +02:00
|
|
|
|