summaryrefslogtreecommitdiff
path: root/daemon/bankmanager.cpp
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2015-11-28 23:49:17 +0100
committerAndrew Branson <andrew.branson@cern.ch>2015-11-28 23:49:17 +0100
commit05011ecce5da659f36a0abea79f1a96d24703801 (patch)
treefe1d26aa5b4be45d13b2db5259d52ad590cfaa6b /daemon/bankmanager.cpp
parent625962e90a0646f48e13fff5e2f88f781c5dd9b5 (diff)
Support Pebble apps with workers
Separate upload for 'worker' binaries. Split binary upload type into firmware, application and worker, as the 'type' field states 'worker' for applications with worker binaries. Fixes #34
Diffstat (limited to 'daemon/bankmanager.cpp')
-rw-r--r--daemon/bankmanager.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/daemon/bankmanager.cpp b/daemon/bankmanager.cpp
index ef74ef6..797d7e3 100644
--- a/daemon/bankmanager.cpp
+++ b/daemon/bankmanager.cpp
@@ -80,7 +80,7 @@ bool BankManager::uploadApp(const QUuid &uuid, int slot)
qCDebug(l) << "about to install app" << info.shortName() << "into slot" << slot;
- QSharedPointer<QIODevice> binaryFile(info.openFile(AppInfo::BINARY));
+ QSharedPointer<QIODevice> binaryFile(info.openFile(AppInfo::APPLICATION));
if (!binaryFile) {
qCWarning(l) << "failed to open" << info.shortName() << "AppInfo::BINARY";
return false;
@@ -93,11 +93,26 @@ bool BankManager::uploadApp(const QUuid &uuid, int slot)
_slots[slot].name.clear();
_slots[slot].uuid = QUuid();
- upload->uploadAppBinary(slot, binaryFile.data(), info.crcFile(AppInfo::BINARY),
+ upload->uploadAppBinary(slot, binaryFile.data(), info.crcFile(AppInfo::APPLICATION),
[this, info, binaryFile, slot]() {
qCDebug(l) << "app binary upload succesful";
binaryFile->close();
+ // Upload worker if present
+ if (info.type() == "worker") {
+ QSharedPointer<QIODevice> workerFile(info.openFile(AppInfo::WORKER));
+ if (workerFile) {
+ upload->uploadAppWorker(slot, workerFile.data(), info.crcFile(AppInfo::WORKER),
+ [this, workerFile, slot]() {
+ qCDebug(l) << "app worker upload succesful";
+ workerFile->close();
+ }, [this, workerFile](int code) {
+ workerFile->close();
+ qCWarning(l) << "app worker upload failed" << code;
+ });
+ }
+ }
+
// Proceed to upload the resource file
QSharedPointer<QIODevice> resourceFile(info.openFile(AppInfo::RESOURCES));
if (resourceFile) {