Loading...
Searching...
No Matches
firmwareUpdate.cpp
#include "AisInstrumentHandler.h"
#include "AisDeviceTracker.h"
#include <QCoreApplication>
#include <QThread>
#include <QDebug>
#define COMPORT "COM1"
int main()
{
int args;
QCoreApplication a(args, nullptr);
auto tracker = AisDeviceTracker::Instance();
QObject::connect(tracker, &AisDeviceTracker::firmwareUpdateNotification, [=](const QString& message) {
qDebug() << message;
if (message.contains("firmware is updated.")) {
// Now instrument is ready to go
}
});
// Attempt to connect to the device
auto error = tracker->connectToDeviceOnComPort(COMPORT);
error = tracker->updateFirmwareOnComPort(COMPORT);
// Some other error occured
if (error != AisErrorCode::Success) {
qDebug() << "Error: " << error.message();
}
} else if (error != AisErrorCode::Success) {
qDebug() << "Error: " << error.message();
} else {
qDebug() << "Device firmware is up to date";
}
return a.exec();
}
void firmwareUpdateNotification(const QString &message)
a signal which is emitted regularaly during a firmware update, providing information about the progre...
static AisDeviceTracker * Instance()
get the instance of the device tracker.
@ Success
Definition AisErrorCode.h:26
@ FirmwareNotSupported
Definition AisErrorCode.h:28