24 Commits

Author SHA1 Message Date
a240711946 (R)sync files of customer repository (under ./etc in the repository)
with file-susyem /etc as very forst step of the update process, even
before executing the opkg commands.
2024-02-27 13:56:38 +01:00
75fdca95d9 set version to 1.4.1 2024-02-27 13:56:24 +01:00
44c2820130 Make sure to lookup only "apism", not the new "apism-tools" 2024-02-02 08:18:13 +01:00
123f22cd21 add .gitignore file 2024-01-29 09:03:16 +01:00
b60af1a4fc Flowchart for ATBUpdateTool 1.4.0 2024-01-26 14:19:50 +01:00
bb3ecc4b76 Use same interfaces.h as DCLibraries (master branch) 2024-01-26 11:39:21 +01:00
fa30fe045b Minor: added interfaces.h 2024-01-26 11:38:43 +01:00
bae014822d Fix: set version info several times to reflect real current git commit 2024-01-26 11:17:06 +01:00
6c472b542e Merge remote-tracking branch 'origin/korneuburg-improvements' 2024-01-26 08:55:50 +01:00
7578746d2f make it explicit that no device-controller is loaded down with this version 2024-01-25 15:46:46 +01:00
0b1ed62df1 Optimization: if customer repository does not exist, do noy check the
ISMAS trigger, but proceed with the update procedure.
2024-01-25 15:14:42 +01:00
76ec41c291 Minor: add some comment. 2024-01-25 15:13:56 +01:00
630cd36f13 Minor: removed typo 2024-01-25 11:54:13 +01:00
cbe8bb7aeb Minor: add comment 2024-01-25 09:01:04 +01:00
e04636e3f7 Minor: add debug output 2024-01-24 13:07:39 +01:00
728185ddb9 Set
m_lastFailedUpdateStep = UPDATE_STEP::NONE
as last step in case of a successful update.
2024-01-24 08:31:22 +01:00
aaa485e2fc Send messages to ISMAS for checking/repairing the customer repository 2024-01-23 16:09:15 +01:00
854c8b9706 Minor: add some additional debug output 2024-01-10 09:58:37 +01:00
d521fd977a Using interface.h, verion 4.4, from 20230802. set version to v.1.3._25_ 2023-12-21 13:02:12 +01:00
ebbdc2f864 Use interface file from 20230802, version 4.4 2023-12-21 13:00:00 +01:00
62496c5d95 Prepare special version for szeged. set version to 1.3._24_ 2023-12-20 12:27:29 +01:00
edd606fe78 Change for szeged (dc-version: 4.42): do not check if dc is alive.
Comment out some functions which are not available in old interface.h
2023-12-20 12:20:06 +01:00
1748c35c45 Add interfaces.h as given for 26.Sep 2023 (szeged) 2023-12-20 12:18:02 +01:00
4c46932a3c Specail version for szeged (dc-version: 4.42): use master lib. 2023-12-20 12:16:07 +01:00
9 changed files with 361 additions and 76 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
tags
*.tags

View File

@@ -6,7 +6,7 @@ plugin-directory="/usr/lib/"
working-directory="/opt/app/tools/atbupdate/" working-directory="/opt/app/tools/atbupdate/"
[PLUGINS] [PLUGINS]
plugin-name="libCAslave.so" plugin-name="libCAmaster.so"
[FLAGS] [FLAGS]
no-psa-hardware-update=false no-psa-hardware-update=false

View File

@@ -95,12 +95,17 @@ DEFINES += QT_DEPRECATED_WARNINGS
# 1.4.0 : Start with version at 1.4.0 (mainly to see a difference with Szeged) # 1.4.0 : Start with version at 1.4.0 (mainly to see a difference with Szeged)
# Set hash-value in EVENT-objects. Set location (project), version # Set hash-value in EVENT-objects. Set location (project), version
# and info in send-last-version. # and info in send-last-version.
# Check the ISMAS update-trigger as very first step. # If the customer repository does not exist, then do not check the
# ISMAS trigger, but proceed with the update procedure. Otherwise,
# check the ISMAS update-trigger as first step.
# If the current time is between 0.00 - 4.00 o'clock, then a wrong # If the current time is between 0.00 - 4.00 o'clock, then a wrong
# trigger-value wil result in an UPDATE_STEP_NOT_NECESSARY. # trigger-value will result in an UPDATE_STEP_NOT_NECESSARY.
# Move final processing to subclass UpdateProcessRunning. # Move final processing to subclass UpdateProcessRunning.
VERSION="1.4.0" # Disable EXIT-button for the whole update-process, except for the
# checking of the ISMAS-trigger-button (aka WAIT-button).
# 1.4.1 : Sync files in the customer repository (under ./etc) as the very
# first step
VERSION="1.4.1"
# PLANNED TODOS: # PLANNED TODOS:
# 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT. # 1: Das Repository wird repariert bwz. neu geklont. Unabhaengig vom WAIT.
# 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu # 2: Wenn der WAIT-Button aktiv ist, dann wird ein Repository repariert (neu
@@ -114,7 +119,6 @@ VERSION="1.4.0"
# ISMAS eine entsprechende Meldung anzeigen als Teil von SEND-LAST-VERSION. # ISMAS eine entsprechende Meldung anzeigen als Teil von SEND-LAST-VERSION.
# Wenn der WAIT-button aktiv ist, dann werden zumindest die opkg-commands # Wenn der WAIT-button aktiv ist, dann werden zumindest die opkg-commands
# ausgefuehrt. # ausgefuehrt.
# 4: rsync: immer alle Dateien soiegeln (bis auf opkg-commands)
# 5: Falls das Tool mal abstuerzt, dann einen Signal-Handler (fuer TERM) # 5: Falls das Tool mal abstuerzt, dann einen Signal-Handler (fuer TERM)
# installieren, sodass zumnidest SEND-LAST-VERSION mit rausgeht. # installieren, sodass zumnidest SEND-LAST-VERSION mit rausgeht.
# 6: rsync: explizites Binary, nicht das in busybox enthaltene. # 6: rsync: explizites Binary, nicht das in busybox enthaltene.
@@ -130,9 +134,6 @@ VERSION="1.4.0"
# Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein # Stellung des WAIT-Button. Grund: es koennte sein, dass andernfalls ein
# PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher- # PSA weit hiter anderen steht, und dann ploetzlich einmal alle vorher-
# gehenden Aenderungen anzieht, die gar nicht fuer ihn gemeint waren. # gehenden Aenderungen anzieht, die gar nicht fuer ihn gemeint waren.
# 10: Bei einer Neuinstallation (Neuhauser) immer JSON files runterladen,
# Tariff-Files syncen (d.h. nur wenn noch kein Repo vorhanden ist), und
# zwar auch ohne WAIT-Button.
# 11: Das Edit-Fenster teilen um die Anzeige zu verbessern. # 11: Das Edit-Fenster teilen um die Anzeige zu verbessern.
# 12: Bei einem Update muss immer ersichtlich sein, warum es ueberhaupt # 12: Bei einem Update muss immer ersichtlich sein, warum es ueberhaupt
# angestossen wurde. Steht kein "WAIT" im ISMAS-Trigger, dann kann man # angestossen wurde. Steht kein "WAIT" im ISMAS-Trigger, dann kann man
@@ -246,6 +247,7 @@ HEADERS += \
process/command.h \ process/command.h \
message_handler.h \ message_handler.h \
worker.h \ worker.h \
interfaces.h \
commandline_parser.h \ commandline_parser.h \
plugins/interfaces.h plugins/interfaces.h

Binary file not shown.

101
interfaces.h Executable file → Normal file
View File

@@ -24,7 +24,8 @@ struct T_emp
// dynamic: // dynamic:
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine): uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
// 0=start command /*
// 0=start command
// 1=powered, do emp ini, send reset // 1=powered, do emp ini, send reset
// 2=delay // 2=delay
// 3=wait for response, requesting status after response // 3=wait for response, requesting status after response
@@ -39,7 +40,7 @@ struct T_emp
// 90: stop all, 1s delay // 90: stop all, 1s delay
// 99: off, all stopped // 99: off, all stopped
*/
uint8_t pollingRunning; uint8_t pollingRunning;
uint8_t paymentRunning; uint8_t paymentRunning;
@@ -238,6 +239,7 @@ struct T_dynamicCondition
uint8_t lastVDoorState; uint8_t lastVDoorState;
uint8_t lastCBstate; uint8_t lastCBstate;
char paymentInProgress; char paymentInProgress;
// Version Szeged: aug2023
// 0: stopped by timeout // 0: stopped by timeout
// 1: running 2: wait4lastCoin // 1: running 2: wait4lastCoin
// 3: payment stopped manually, coins in Escrow // 3: payment stopped manually, coins in Escrow
@@ -246,6 +248,21 @@ struct T_dynamicCondition
// 6: coins encashed 7:coins returned // 6: coins encashed 7:coins returned
// 8: CoinChecker or MDB on Error // 8: CoinChecker or MDB on Error
// since Schoenau with bill and changer, nov2023
//0 = no payment
//will be set to 1 by cash_startCollection()
//neu 1: wait for devices getting ready for payment
//2 = payment,
//3 = wait for last coin/bill
//4 = Bezahlvorgang manuell beendet
//5 = payment stopped autom, amount collected, coins in Escrow
//6 = Bezahlvorgang beendet weil ZK voll
//4,5,6: payment done, keep on polling, wait for cash or return command
//7 = encash collected money from coin escrow into cash box
//8 = return "amountToReturn", can be complete inserted amount or only overpayment
//9 = wait for changer result
//10= print refund receipt with "amountToReturn"
char res1; char res1;
uint16_t U_Batt; uint16_t U_Batt;
@@ -397,6 +414,7 @@ struct T_bna
}; };
class DownloadThread;
class hwinf class hwinf
{ {
@@ -2252,14 +2270,23 @@ public:
virtual void bna_requestCurrentNotes() const {} virtual void bna_requestCurrentNotes() const {}
// send command to DC in order to get transaction data // send command to DC in order to get transaction data
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const { virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const
{
Q_UNUSED(latestBill); Q_UNUSED(latestBill);
Q_UNUSED(currentNotes); Q_UNUSED(currentNotes);
return 0; return 0;
} }
// returns number of collected bank notes since start-command (current transaction) // returns number of collected bank notes since start-command (current transaction)
// latestBill: last accepted bank note, value in cent // return value: numbers of bills or 99 in case of error
// currentNotes an array with up to 16 (further) notes collected // latestBill: not used
// in case of error: currentNotes[0,1,2,3] = 1..4 error number(s)
// in normal case:
// currentNotes[0]: last bill in cent (e.g. 1000 = 10€)
// currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked
// note: by now (dec2023) escrow is not used, bills always go to stacker (box)
// currentNotes[2]: total sum of bills in cent, low word (16bit)
// currentNotes[3]: total sum of bills in cent, high word (16bit)
virtual void bna_requestStackerLevel() const {} virtual void bna_requestStackerLevel() const {}
@@ -2273,9 +2300,73 @@ public:
// countOfBills[1] for 10€ and so on // countOfBills[1] for 10€ and so on
// download device controller
virtual bool dcDownloadRequest(QString const &fileToDownload) const {
Q_UNUSED(fileToDownload);
return false;
}
virtual bool dcDownloadRequested() const { return false; }
virtual bool dcDownloadResetRequest() const { return false; }
virtual bool dcDownloadRequestAck() const { return false; }
virtual bool dcDownloadRunning() const { return false; }
virtual bool dcDownloadFinished() { return false; }
virtual bool dcDownloadReportStart() const { return false; }
virtual bool dcDownloadReportRunning() const { return true; }
virtual bool dcDownloadReportFinished() { return true; }
virtual bool dcDownloadThreadStart() { return false; }
virtual bool dcDownloadThreadRunning() const { return true; }
virtual void dcDownloadThreadFinalize(DownloadThread *) {}
virtual bool dcDownloadThreadFinished() const { return true; }
virtual bool dcDownloadReportThreadStart() { return false; }
virtual bool dcDownloadReportThreadRunning() const { return true; }
virtual void dcDownloadReportThreadFinalize() {}
virtual void dcDownloadReportThreadQuit() {}
virtual bool dcDownloadReportThreadFinished() const { return true; }
virtual QString dcDownloadFileName() const { return ""; }
virtual bool dcDownloadSetRequested(bool requested) {
Q_UNUSED(requested); return false;
}
virtual bool dcDownloadSetRunning(bool running) {
Q_UNUSED(running); return false;
}
virtual bool dcDownloadSetFinished(bool finished) {
Q_UNUSED(finished); return false;
}
virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
Q_UNUSED(totalBlockNumber);
}
virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) {
Q_UNUSED(currentBlockNumber);
}
virtual bool dcDownloadGetRequested() const { return false; }
virtual bool dcDownloadGetRunning() const { return false; }
virtual bool dcDownloadGetFinished() const { return false; }
virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; }
virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; }
virtual QObject const *getAPI() { return nullptr; }
signals: signals:
/*
NOTE: the difference between a virtual Qt signal and a normal Qt signal:
A Qt virtual signal is a connection that is established using a pointer
or reference and is not connected to an object or data. It is therefore
not bound to a particular object, but to a specific class (object type).
Qt virtual signals are useful because they allow you to create
connections without worrying about whether an object or a specific data
element has been destroyed.
https://www.youtube.com/watch?v=HTH3VFfqsXw
*/
virtual void hwapi_reportDCDownloadStatus(QString const&) const {}
virtual void hwapi_reportDCDownloadSuccess(QString const&) const {}
virtual void hwapi_reportDCDownloadFailure(QString const&) const {}
virtual void hwapi_templatePrintFinished_OK(void) const=0; virtual void hwapi_templatePrintFinished_OK(void) const=0;
virtual void hwapi_templatePrintFinished_Err(void) const=0; virtual void hwapi_templatePrintFinished_Err(void) const=0;

View File

@@ -24,7 +24,8 @@ struct T_emp
// dynamic: // dynamic:
uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine): uint8_t state; // step counter of EMP (electronic coin checker) FSM (finite state machine):
// 0=start command /*
// 0=start command
// 1=powered, do emp ini, send reset // 1=powered, do emp ini, send reset
// 2=delay // 2=delay
// 3=wait for response, requesting status after response // 3=wait for response, requesting status after response
@@ -39,7 +40,7 @@ struct T_emp
// 90: stop all, 1s delay // 90: stop all, 1s delay
// 99: off, all stopped // 99: off, all stopped
*/
uint8_t pollingRunning; uint8_t pollingRunning;
uint8_t paymentRunning; uint8_t paymentRunning;
@@ -238,6 +239,7 @@ struct T_dynamicCondition
uint8_t lastVDoorState; uint8_t lastVDoorState;
uint8_t lastCBstate; uint8_t lastCBstate;
char paymentInProgress; char paymentInProgress;
// Version Szeged: aug2023
// 0: stopped by timeout // 0: stopped by timeout
// 1: running 2: wait4lastCoin // 1: running 2: wait4lastCoin
// 3: payment stopped manually, coins in Escrow // 3: payment stopped manually, coins in Escrow
@@ -246,6 +248,21 @@ struct T_dynamicCondition
// 6: coins encashed 7:coins returned // 6: coins encashed 7:coins returned
// 8: CoinChecker or MDB on Error // 8: CoinChecker or MDB on Error
// since Schoenau with bill and changer, nov2023
//0 = no payment
//will be set to 1 by cash_startCollection()
//neu 1: wait for devices getting ready for payment
//2 = payment,
//3 = wait for last coin/bill
//4 = Bezahlvorgang manuell beendet
//5 = payment stopped autom, amount collected, coins in Escrow
//6 = Bezahlvorgang beendet weil ZK voll
//4,5,6: payment done, keep on polling, wait for cash or return command
//7 = encash collected money from coin escrow into cash box
//8 = return "amountToReturn", can be complete inserted amount or only overpayment
//9 = wait for changer result
//10= print refund receipt with "amountToReturn"
char res1; char res1;
uint16_t U_Batt; uint16_t U_Batt;
@@ -397,6 +414,7 @@ struct T_bna
}; };
class DownloadThread;
class hwinf class hwinf
{ {
@@ -1834,6 +1852,9 @@ public:
virtual uint8_t prn_getPrintResult() const { virtual uint8_t prn_getPrintResult() const {
return 0; return 0;
} }
// return: 0: just printing, wait
// 1: OK - last print was succesful
// 2: error - not printed
@@ -2249,14 +2270,23 @@ public:
virtual void bna_requestCurrentNotes() const {} virtual void bna_requestCurrentNotes() const {}
// send command to DC in order to get transaction data // send command to DC in order to get transaction data
virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const { virtual uint8_t bna_getCurrentNotes(uint16_t latestBill, uint16_t *currentNotes) const
{
Q_UNUSED(latestBill); Q_UNUSED(latestBill);
Q_UNUSED(currentNotes); Q_UNUSED(currentNotes);
return 0; return 0;
} }
// returns number of collected bank notes since start-command (current transaction) // returns number of collected bank notes since start-command (current transaction)
// latestBill: last accepted bank note, value in cent // return value: numbers of bills or 99 in case of error
// currentNotes an array with up to 16 (further) notes collected // latestBill: not used
// in case of error: currentNotes[0,1,2,3] = 1..4 error number(s)
// in normal case:
// currentNotes[0]: last bill in cent (e.g. 1000 = 10€)
// currentNotes[1]: bin 1 = bill is still in escrow else bill is stacked
// note: by now (dec2023) escrow is not used, bills always go to stacker (box)
// currentNotes[2]: total sum of bills in cent, low word (16bit)
// currentNotes[3]: total sum of bills in cent, high word (16bit)
virtual void bna_requestStackerLevel() const {} virtual void bna_requestStackerLevel() const {}
@@ -2270,10 +2300,99 @@ public:
// countOfBills[1] for 10€ and so on // countOfBills[1] for 10€ and so on
// download device controller
virtual bool dcDownloadRequest(QString const &fileToDownload) const {
Q_UNUSED(fileToDownload);
return false;
}
virtual bool dcDownloadRequested() const { return false; }
virtual bool dcDownloadResetRequest() const { return false; }
virtual bool dcDownloadRequestAck() const { return false; }
virtual bool dcDownloadRunning() const { return false; }
virtual bool dcDownloadFinished() { return false; }
virtual bool dcDownloadReportStart() const { return false; }
virtual bool dcDownloadReportRunning() const { return true; }
virtual bool dcDownloadReportFinished() { return true; }
virtual bool dcDownloadThreadStart() { return false; }
virtual bool dcDownloadThreadRunning() const { return true; }
virtual void dcDownloadThreadFinalize(DownloadThread *) {}
virtual bool dcDownloadThreadFinished() const { return true; }
virtual bool dcDownloadReportThreadStart() { return false; }
virtual bool dcDownloadReportThreadRunning() const { return true; }
virtual void dcDownloadReportThreadFinalize() {}
virtual void dcDownloadReportThreadQuit() {}
virtual bool dcDownloadReportThreadFinished() const { return true; }
virtual QString dcDownloadFileName() const { return ""; }
virtual bool dcDownloadSetRequested(bool requested) {
Q_UNUSED(requested); return false;
}
virtual bool dcDownloadSetRunning(bool running) {
Q_UNUSED(running); return false;
}
virtual bool dcDownloadSetFinished(bool finished) {
Q_UNUSED(finished); return false;
}
virtual void dcDownloadSetTotalBlockNumber(uint16_t totalBlockNumber) {
Q_UNUSED(totalBlockNumber);
}
virtual void dcDownloadSetCurrentBlockNumber(uint16_t currentBlockNumber) {
Q_UNUSED(currentBlockNumber);
}
virtual bool dcDownloadGetRequested() const { return false; }
virtual bool dcDownloadGetRunning() const { return false; }
virtual bool dcDownloadGetFinished() const { return false; }
virtual uint16_t dcDownloadGetTotalBlockNumber() const { return 0; }
virtual uint16_t dcDownloadGetCurrentBlockNumber() const { return 0; }
virtual QObject const *getAPI() { return nullptr; }
signals: signals:
/*
NOTE: the difference between a virtual Qt signal and a normal Qt signal:
A Qt virtual signal is a connection that is established using a pointer
or reference and is not connected to an object or data. It is therefore
not bound to a particular object, but to a specific class (object type).
Qt virtual signals are useful because they allow you to create
connections without worrying about whether an object or a specific data
element has been destroyed.
https://www.youtube.com/watch?v=HTH3VFfqsXw
*/
virtual void hwapi_reportDCDownloadStatus(QString const&) const {}
virtual void hwapi_reportDCDownloadSuccess(QString const&) const {}
virtual void hwapi_reportDCDownloadFailure(QString const&) const {}
virtual void hwapi_templatePrintFinished_OK(void) const=0;
virtual void hwapi_templatePrintFinished_Err(void) const=0;
virtual void hwapi_coinCollectionJustStarted(void) const=0;
virtual void hwapi_coinCollectionAborted(void) const=0;
virtual void hwapi_gotNewCoin(void) const=0;
virtual void hwapi_payStopByMax(void) const=0;
virtual void hwapi_payStopByPushbutton(void) const=0;
virtual void hwapi_payStopByEscrow(void) const=0;
virtual void hwapi_payStopByError(void) const=0;
virtual void hwapi_payStopByTimeout(void) const=0;
virtual void hwapi_payCancelled(void) const=0;
virtual void hwapi_coinProcessJustStopped(void) const=0;
virtual void hwapi_doorServiceDoorOpened(void) const=0;
virtual void hwapi_doorVaultDoorOpened(void) const=0;
virtual void hwapi_doorCoinBoxRemoved(void) const=0;
virtual void hwapi_doorCoinBoxInserted(void) const=0;
virtual void hwapi_doorCBinAndAllDoorsClosed(void) const=0;
virtual void hwapi_doorAllDoorsClosed(void) const=0;
// NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid. // NOTE: declaring a "pure virtual" "signal" should be an error and thus not valid.
/* GH Version, bringt Fehler
void hwapi_templatePrintFinished_OK() const; void hwapi_templatePrintFinished_OK() const;
void hwapi_templatePrintFinished_Err() const; void hwapi_templatePrintFinished_Err() const;
@@ -2296,6 +2415,7 @@ signals:
void hwapi_doorCoinBoxInserted() const; void hwapi_doorCoinBoxInserted() const;
void hwapi_doorCBinAndAllDoorsClosed() const; void hwapi_doorCBinAndAllDoorsClosed() const;
void hwapi_doorAllDoorsClosed() const; void hwapi_doorAllDoorsClosed() const;
*/
}; };

View File

@@ -266,6 +266,7 @@ bool Update::updateBinary(QString const &fileToSendToDC) {
return false; return false;
#if 0
QFile fn(fileToSendToDC); QFile fn(fileToSendToDC);
if (!fn.exists()) { if (!fn.exists()) {
// output via CONSOLE() etc // output via CONSOLE() etc
@@ -334,6 +335,7 @@ bool Update::updateBinary(QString const &fileToSendToDC) {
} }
return true; return true;
#endif
} }
QString Update::jsonType(enum FileTypeJson type) { QString Update::jsonType(enum FileTypeJson type) {
@@ -561,7 +563,7 @@ bool Update::checkDownloadedJsonVersions(QStringList const& jsonFileNames) {
} }
if (jsonNr != 0) { if (jsonNr != 0) {
#if 0
m_hw->sys_requestJsonVersions(jsonNr); m_hw->sys_requestJsonVersions(jsonNr);
QThread::msleep(500); QThread::msleep(500);
@@ -579,6 +581,8 @@ bool Update::checkDownloadedJsonVersions(QStringList const& jsonFileNames) {
if (installedVersion == fileVersion) { if (installedVersion == fileVersion) {
} }
#endif
} else { } else {
qCritical() << "CANNOT FIND JSON-NR FOR" << jsonFileNames[i]; qCritical() << "CANNOT FIND JSON-NR FOR" << jsonFileNames[i];
} }
@@ -605,19 +609,19 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
// CONSOLE() // CONSOLE()
m_hw->dc_autoRequest(false);// default: turn auto-request setting off // m_hw->dc_autoRequest(false);// default: turn auto-request setting off
QThread::sleep(1); // wait to be sure that there are no more // QThread::sleep(1); // wait to be sure that there are no more
// commands sent to dc-hardware // // commands sent to dc-hardware
if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
// if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
//
// qCritical() << "downloaded binary" << fToWorkOn; // qCritical() << "downloaded binary" << fToWorkOn;
++displayIndex; // ++displayIndex;
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")") // emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(), // + QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
Worker::UPDATE_STEP_DONE); // Worker::UPDATE_STEP_DONE);
} //}
m_hw->dc_autoRequest(true); // turn auto-request setting on m_hw->dc_autoRequest(true); // turn auto-request setting on

View File

@@ -272,22 +272,41 @@ void Worker::privateUpdate() {
m_ismasTriggerActive = false; m_ismasTriggerActive = false;
m_updateNotNecessary = false; m_updateNotNecessary = false;
QDateTime const &current = QDateTime::currentDateTime(); if (QDir(m_customerRepository).exists()) { // ignore a possibly corrupted repository
m_automaticUpdate = (current.time().hour() < 4); m_ismasTriggerActive = updateTriggerSet();
if (m_ismasTriggerActive == false) {
m_ismasTriggerActive = updateTriggerSet(); QDateTime const &current = QDateTime::currentDateTime();
if (m_ismasTriggerActive == false) { m_automaticUpdate = (current.time().hour() < 4);
if (QDir(m_customerRepository).exists()) { // ignore a possibly corrupted repository
m_versionInfo = m_gc.gitShowReason(m_branchName); m_versionInfo = m_gc.gitShowReason(m_branchName);
qCritical() << "***";
qCritical() << "privateUpdate ............. m_versionInfo:" << m_versionInfo;
qCritical() << "privateUpdate ......... m_automaticUpdate:" << m_automaticUpdate;
if (m_automaticUpdate) { // update has been triggered within [00:00:00, 00:03:59] if (m_automaticUpdate) { // update has been triggered within [00:00:00, 00:03:59]
m_updateNotNecessary = true; m_updateNotNecessary = true;
m_ismasTriggerStatusMessage = QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate))); m_ismasTriggerStatusMessage = QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate)));
qCritical() << "privateUpdate m_ismasTriggerStatusMessage:" << QStringList(QString("NO UPDATE NECESSARY (%1)").arg(current.toString(Qt::ISODate)));
qCritical() << "***";
// the customer-repository does exist, but the ISMAS-trigger is
// *NOT* "WAIT", but from 00:00:00 - 00:03:59 this counts as an
// automatic update
m_lastFailedUpdateStep = UPDATE_STEP::NONE; m_lastFailedUpdateStep = UPDATE_STEP::NONE;
return;
} }
qCritical() << "***";
// the customer-repository does exist, but the ISMAS-trigger is // the customer-repository does exist, but the ISMAS-trigger is
// *NOT* "WAIT", so STOP the update procedure // *NOT* "WAIT", so STOP the update procedure
return; return;
} }
// the customer-repository does exist, and the ISMAS-trigger is "WAIT",
// so continue the update procedure
} else {
// the customer-repository does not exist, so PROCEED with the // the customer-repository does not exist, so PROCEED with the
// update procedure, even if ISMAS-trigger is not correctly set ("WAIT") // update procedure, even if ISMAS-trigger is not correctly set ("WAIT")
} }
@@ -339,9 +358,7 @@ void Worker::privateUpdate() {
setProgress(i); // and switch to branch setProgress(i); // and switch to branch
if (m_gc.gitCloneAndCheckoutBranch()) { if (m_gc.gitCloneAndCheckoutBranch()) {
if (!isRepositoryCorrupted()) { if (!isRepositoryCorrupted()) {
if (m_versionInfo.size() == 0) { m_versionInfo = m_gc.gitShowReason(m_branchName);
m_versionInfo = m_gc.gitShowReason(m_branchName);
}
GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_SUCCESS)); GUI() << (ISMAS() << (CONSOLE() << UPDATE_STEP::CLONE_REPOSITORY_SUCCESS));
continueUpdate = true; continueUpdate = true;
m_clone = true; m_clone = true;
@@ -371,10 +388,7 @@ void Worker::privateUpdate() {
} }
} }
} }
m_versionInfo = m_gc.gitShowReason(m_branchName);
if (m_versionInfo.size() == 0) {
m_versionInfo = m_gc.gitShowReason(m_branchName);
}
CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_SUCCESS; CONSOLE() << UPDATE_STEP::CHECK_REPOSITORY_SUCCESS;
setProgress(_CHECKOUT_REPOSITORY_SUCCESS); setProgress(_CHECKOUT_REPOSITORY_SUCCESS);
@@ -392,9 +406,6 @@ void Worker::privateUpdate() {
} }
} }
qCritical() << "**** m_ismasTriggerActive:" << m_ismasTriggerActive;
qCritical() << "**** m_clone:" << m_clone;
if (m_ismasTriggerActive == false) {// make it explicit again: only if the if (m_ismasTriggerActive == false) {// make it explicit again: only if the
// ismas trigger is active ('WAIT'), // ismas trigger is active ('WAIT'),
// then proceed // then proceed
@@ -413,10 +424,22 @@ void Worker::privateUpdate() {
if ((continueUpdate = customerEnvironment()) == false) { if ((continueUpdate = customerEnvironment()) == false) {
return; return;
} }
m_versionInfo = m_gc.gitShowReason(m_branchName);
lst = QStringList(QString(smap[UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS])); lst = QStringList(QString(smap[UPDATE_STEP::CHECKOUT_BRANCH_SUCCESS]));
ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH); ISMAS(lst) << (CONSOLE(lst) << UPDATE_STEP::CHECKOUT_BRANCH);
setProgress(_CHECKOUT_BRANCH_SUCCESS); setProgress(_CHECKOUT_BRANCH_SUCCESS);
////////////////////////////////////////////////////////////////////////////
//
// (R)SYNC THE REPOSITORY WITH THE LOCAL FILEYSTEM
//
////////////////////////////////////////////////////////////////////////////
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
return;
}
lst = QStringList(QString(smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS]));
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
@@ -426,6 +449,7 @@ void Worker::privateUpdate() {
if ((continueUpdate = filesToUpdate()) == false) { if ((continueUpdate = filesToUpdate()) == false) {
return; return;
} }
m_versionInfo = m_gc.gitShowReason(m_branchName);
lst = QStringList(QString(smap[UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS])); lst = QStringList(QString(smap[UPDATE_STEP::UPDATE_REPOSITORY_SUCCESS]));
ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY)); ISMAS() << (GUI() << (CONSOLE() << UPDATE_STEP::UPDATE_REPOSITORY));
setProgress(_UPDATE_REPOSITORY_SUCCESS); setProgress(_UPDATE_REPOSITORY_SUCCESS);
@@ -456,19 +480,6 @@ void Worker::privateUpdate() {
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE)); ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::DOWNLOAD_FILES_TO_PSA_HARDWARE));
setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS); setProgress(_DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS);
////////////////////////////////////////////////////////////////////////////
//
// (R)SYNC THE REPOSITORY WITH THE LOCAL FILEYSTEM
//
////////////////////////////////////////////////////////////////////////////
if ((continueUpdate = syncCustomerRepositoryAndFS()) == false) {
return;
}
lst = QStringList(QString(smap[UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS]));
ISMAS(lst) << (GUI(lst) << (CONSOLE(lst) << UPDATE_STEP::SYNC_CUSTOMER_REPOSITORY_SUCCESS));
setProgress(_SYNC_CUSTOMER_REPOSITORY_SUCCESS);
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// //
// FUTURE: SAVE LOG FILES // FUTURE: SAVE LOG FILES
@@ -481,6 +492,7 @@ void Worker::privateUpdate() {
setProgress(_SAVE_LOGS_SUCCESS); setProgress(_SAVE_LOGS_SUCCESS);
// final messages: see destructor of UpdateProcessRunning subclass // final messages: see destructor of UpdateProcessRunning subclass
m_lastFailedUpdateStep = UPDATE_STEP::NONE;
} }
bool Worker::updateTriggerSet() { bool Worker::updateTriggerSet() {
@@ -1017,7 +1029,7 @@ QString Worker::getATBUpdateToolYoctoVersion() {
QString Worker::getAPISMYoctoVersion() { QString Worker::getAPISMYoctoVersion() {
if (QFile::exists("/var/lib/opkg/status")) { if (QFile::exists("/var/lib/opkg/status")) {
QString const cmd = QString("echo -n $(cat /var/lib/opkg/status | grep -A1 apism | tail -n 1 | cut -d':' -f2 | cut -d' ' -f2)"); QString const cmd = QString("echo -n $(cat /var/lib/opkg/status | grep -A1 -e apism[[:space:]]*$ | tail -n 1 | cut -d':' -f2 | cut -d' ' -f2)");
Command c("bash"); Command c("bash");
if (c.execute("/tmp", QStringList() << "-c" << cmd)) { if (c.execute("/tmp", QStringList() << "-c" << cmd)) {
return c.getCommandResult(); // 1.4.1.0-r4 return c.getCommandResult(); // 1.4.1.0-r4
@@ -1170,6 +1182,8 @@ PSAInstalled Worker::getPSAInstalled() {
psaInstalled.versionInfo.created = "N/A"; psaInstalled.versionInfo.created = "N/A";
if (m_versionInfo.size() == 3) { if (m_versionInfo.size() == 3) {
qCritical() << QString("***** %1:%2").arg(__func__).arg(__LINE__)
<< "m_versionInfo" << m_versionInfo << "*****";
psaInstalled.versionInfo.lastCommit = m_versionInfo.at(0); psaInstalled.versionInfo.lastCommit = m_versionInfo.at(0);
psaInstalled.versionInfo.reason = m_versionInfo.at(1); psaInstalled.versionInfo.reason = m_versionInfo.at(1);
psaInstalled.versionInfo.created = m_versionInfo.at(2); psaInstalled.versionInfo.created = m_versionInfo.at(2);

View File

@@ -61,9 +61,12 @@
#define _UPDATE_REPOSITORY_SUCCESS (27) #define _UPDATE_REPOSITORY_SUCCESS (27)
#define _CHECK_FOR_REPOSITORY_CHANGES (28) #define _CHECK_FOR_REPOSITORY_CHANGES (28)
#define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (29) #define _CHECK_FOR_REPOSITORY_CHANGES_SUCCESS (29)
#define _FILES_TO_UPDATE (30) #define _SYNC_CUSTOMER_REPOSITORY (30)
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (31) #define _SYNC_CUSTOMER_REPOSITORY_FAILURE (31)
#define _FILES_TO_DOWNLOAD (32) #define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (32)
#define _FILES_TO_UPDATE (33)
#define _CHECK_FOR_REPOSITORY_CHANGES_FAILURE (34)
#define _FILES_TO_DOWNLOAD (35)
#define _EXEC_OPKG_COMMANDS (41) #define _EXEC_OPKG_COMMANDS (41)
#define _EXEC_OPKG_COMMAND_1 (42) #define _EXEC_OPKG_COMMAND_1 (42)
#define _EXEC_OPKG_COMMAND_2 (43) #define _EXEC_OPKG_COMMAND_2 (43)
@@ -86,9 +89,6 @@
#define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (86) #define _DOWNLOAD_DEVICE_CONTROLLER_FAILURE (86)
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (87) #define _DOWNLOAD_FILES_TO_PSA_HARDWARE_FAILURE (87)
#define _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS (88) #define _DOWNLOAD_FILES_TO_PSA_HARDWARE_SUCCESS (88)
#define _SYNC_CUSTOMER_REPOSITORY (89)
#define _SYNC_CUSTOMER_REPOSITORY_FAILURE (90)
#define _SYNC_CUSTOMER_REPOSITORY_SUCCESS (91)
#define _SAVE_LOGS (92) #define _SAVE_LOGS (92)
#define _SAVE_LOGS_FAILURE (93) #define _SAVE_LOGS_FAILURE (93)
#define _SAVE_LOGS_SUCCESS (94) #define _SAVE_LOGS_SUCCESS (94)
@@ -714,21 +714,73 @@ private:
case UPDATE_STEP::CHECK_REPOSITORY: case UPDATE_STEP::CHECK_REPOSITORY:
ismasClient.setProgressInPercent(_CHECK_REPOSITORY); ismasClient.setProgressInPercent(_CHECK_REPOSITORY);
break; break;
case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS: case UPDATE_STEP::CHECK_REPOSITORY_SUCCESS: {
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_SUCCESS); ismasClient.setProgressInPercent(_CHECK_REPOSITORY_SUCCESS);
break; QString const &ismasUpdateNews =
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE: QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
"U0010",
_CHECKOUT_REPOSITORY_SUCCESS,
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::CHECK_REPOSITORY],
QString("REPOSITORY %1 AND BRANCH %2 OK")
.arg(instance->m_customerRepository)
.arg(instance->m_gc.branchName()).toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::CHECK_REPOSITORY_FAILURE: {
ismasClient.setProgressInPercent(_CHECK_REPOSITORY_FAILURE); ismasClient.setProgressInPercent(_CHECK_REPOSITORY_FAILURE);
break; QString const &ismasUpdateNews =
case UPDATE_STEP::CHECK_SANITY: QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
"U0010",
_CHECKOUT_REPOSITORY_FAILURE,
IsmasClient::RESULT_CODE::INSTALL_ERROR,
smap[UPDATE_STEP::CHECKOUT_REPOSITORY],
QString("REPOSITORY %1 and BRANCH %2 ***NOT OK***")
.arg(instance->m_customerRepository)
.arg(instance->m_gc.branchName()).toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::CHECK_SANITY: {
ismasClient.setProgressInPercent(_CHECK_SANITY); ismasClient.setProgressInPercent(_CHECK_SANITY);
break; } break;
case UPDATE_STEP::CHECK_SANITY_SUCCESS: case UPDATE_STEP::CHECK_SANITY_SUCCESS: {
ismasClient.setProgressInPercent(_CHECK_SANITY_SUCCESS); ismasClient.setProgressInPercent(_CHECK_SANITY_SUCCESS);
break; QString const &ismasUpdateNews =
case UPDATE_STEP::CHECK_SANITY_FAILURE: QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
"U0010",
_CHECK_SANITY_SUCCESS,
IsmasClient::RESULT_CODE::SUCCESS,
smap[UPDATE_STEP::CHECK_SANITY],
QString("SANITY OF %1 (BRANCH %2) OK")
.arg(instance->m_customerRepository)
.arg(instance->m_gc.branchName()).toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::CHECK_SANITY_FAILURE: {
ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE); ismasClient.setProgressInPercent(_CHECK_SANITY_FAILURE);
break; QString const &ismasUpdateNews =
QString("#M=APISM#C=CMD_EVENT#J=") +
ismasClient.updateNewsToIsmas(
"U0010",
_CHECK_SANITY_FAILURE,
IsmasClient::RESULT_CODE::INSTALL_ERROR,
smap[UPDATE_STEP::CHECK_SANITY],
QString("SANITY OF %1 and BRANCH %2 ***NOT*** OK")
.arg(instance->m_customerRepository)
.arg(instance->m_gc.branchName()).toStdString().c_str(),
instance->m_versionInfo.size() >= 1 ? instance->m_versionInfo.at(0).toUtf8().constData() : "N/A");
ismasClient.sendRequestReceiveResponse(
IsmasClient::APISM::DB_PORT, ismasUpdateNews);
} break;
case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS: case UPDATE_STEP::REPOSITORY_RECOVERED_SUCCESS:
ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_SUCCESS); ismasClient.setProgressInPercent(_REPOSITORY_RECOVERED_SUCCESS);
break; break;