Added helper functions.
This commit is contained in:
		
							
								
								
									
										24
									
								
								update.h
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								update.h
									
									
									
									
									
								
							@@ -9,6 +9,7 @@
 | 
			
		||||
#include <QProcess>
 | 
			
		||||
 | 
			
		||||
#include "plugins/interfaces.h"
 | 
			
		||||
#include "apism/apism_client.h"
 | 
			
		||||
 | 
			
		||||
#ifdef PTU5
 | 
			
		||||
#define SERIAL_PORT "ttymxc2"
 | 
			
		||||
@@ -29,15 +30,20 @@ class Update : public QObject {
 | 
			
		||||
    char const *m_baudrate;
 | 
			
		||||
    QFile m_update_ctrl_file;
 | 
			
		||||
    QFile m_update_ctrl_file_copy;
 | 
			
		||||
    QString m_repositoryPath;
 | 
			
		||||
    QString m_customerId;   // customer_281
 | 
			
		||||
    QString m_branchName;
 | 
			
		||||
    QString m_workingDir;
 | 
			
		||||
    bool m_maintenanceMode;
 | 
			
		||||
    bool m_testMode;
 | 
			
		||||
    bool m_executeScriptOnly;
 | 
			
		||||
    bool m_dryRun;
 | 
			
		||||
    //ApismClient m_apismClient;
 | 
			
		||||
 | 
			
		||||
    bool m_init;
 | 
			
		||||
 | 
			
		||||
    bool finishUpdate(bool finish);
 | 
			
		||||
    QStringList getLinesToWorkOn();
 | 
			
		||||
    QStringList split(QString line, QChar sep = ',');
 | 
			
		||||
 | 
			
		||||
    bool execUpdateScript();
 | 
			
		||||
 | 
			
		||||
@@ -51,15 +57,29 @@ public:
 | 
			
		||||
 | 
			
		||||
    explicit Update(hwinf *hw,
 | 
			
		||||
                    QString update_ctrl_file,
 | 
			
		||||
                    QString repositoryPath,
 | 
			
		||||
                    QString customerId,
 | 
			
		||||
                    QString branchName,
 | 
			
		||||
                    QString workingDir = ".",
 | 
			
		||||
                    bool maintenanceMode = false,
 | 
			
		||||
                    bool testMode = false,
 | 
			
		||||
                    bool executeScriptOnly = false,
 | 
			
		||||
                    bool dryRun = false,
 | 
			
		||||
                    QObject *parent = nullptr,
 | 
			
		||||
                    char const *serialInterface = SERIAL_PORT,
 | 
			
		||||
                    char const *baudrate = "115200");
 | 
			
		||||
    virtual ~Update() override;
 | 
			
		||||
    bool doUpdate();
 | 
			
		||||
 | 
			
		||||
    QString customerId() { return m_customerId; }
 | 
			
		||||
    QString const customerId() const { return m_customerId; }
 | 
			
		||||
 | 
			
		||||
    QString branchName() { return m_branchName; }
 | 
			
		||||
    QString const branchName() const { return m_branchName; }
 | 
			
		||||
 | 
			
		||||
    QString repositoryPath() { return m_repositoryPath; }
 | 
			
		||||
    QString const repositoryPath() const { return m_repositoryPath; }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    static QString jsonType(enum FileTypeJson type);
 | 
			
		||||
 | 
			
		||||
@@ -85,6 +105,8 @@ private:
 | 
			
		||||
    bool downloadJson(enum FileTypeJson type, int templateIdx,
 | 
			
		||||
                      QString jsFileToSendToDC) const;
 | 
			
		||||
 | 
			
		||||
    bool executeProcess(QString const &cmd);
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void readyReadStandardOutput();
 | 
			
		||||
    void readyReadStandardError();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user