Connect to your senseBox
@@ -85,41 +85,41 @@
Select your senseBox
In the list, all running senseBoxes with OTA available are shown.
- If you don't see yours, please make sure that it
+ If you don't see yours, please make sure that GPS is enabled.
-
- has the WiFi shield plugged in
- has the initial OTA sketch installed
- is running
-
Available senseBox WiFis
-
+
+
+
+
+
+
+
+ searching...
+
+
+
+
+ connecting...
+
+
{{ ssid }}
-
-
- searching...
-
-
+
no senseboxes available :(
-
- Show only senseBox WiFis
-
-
-
-
-
- connecting...
-
+
+ Show only senseBox WiFis
+
+
Error!
@@ -133,14 +133,30 @@
- Uploading your sketch
-
+
+ Uploading your sketch
+
+
-
+
+
+ Done!
+
+ Close
+
+
+
+
+ Error!
+
+
+
+ Back
+
+
+ Close
+
+
diff --git a/src/pages/ota-wizard/ota-wizard.scss b/src/pages/ota-wizard/ota-wizard.scss
index 0e7ffd2..e5cfbe7 100644
--- a/src/pages/ota-wizard/ota-wizard.scss
+++ b/src/pages/ota-wizard/ota-wizard.scss
@@ -37,4 +37,21 @@ page-ota-wizard {
list-style-type: disc;
}
}
+
+ #wifi-slide {
+ h4, button {
+ display: inline-block;
+ }
+
+ // for the ion-list height limitation to work..
+ &, div.slide-zoom, ion-grid, ion-row, ion-col:last-child {
+ height: 100%;
+ }
+
+ #wifi-list {
+ max-height: 55%;
+ overflow-y: scroll;
+ }
+
+ }
}
diff --git a/src/pages/ota-wizard/ota-wizard.ts b/src/pages/ota-wizard/ota-wizard.ts
index fb19ef4..837c4fd 100644
--- a/src/pages/ota-wizard/ota-wizard.ts
+++ b/src/pages/ota-wizard/ota-wizard.ts
@@ -24,6 +24,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
offlineSub: Subscription
filterSsids = false // TODO: add toggle to UI?
+ filterSsids = true
availableSenseboxes: string[] = [] // list of SSIDs
compiledSketch = undefined
errorMsg = ''
@@ -32,6 +33,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
isOnline: false,
compilation: 'compiling',
wifiSelection: 'scanning',
+ upload: 'uploading',
}
constructor(
@@ -62,6 +64,19 @@ export class OtaWizardPage implements OnInit, OnDestroy {
this.offlineSub.unsubscribe()
}
+ onWifiRefresh () {
+ this.handleWifiSelection()
+ }
+
+ onFilterToggle (newVal) {
+ this.filterSsids = newVal
+ this.handleWifiSelection()
+ }
+
+ onClose () {
+ this.navCtrl.pop()
+ }
+
// call logic for each slide
onSlideChange () {
switch (this.slides.getActiveIndex()) {
@@ -78,7 +93,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
break
case OtaSlides.Upload:
- this.slides.lockSwipeToNext(true)
+ this.handleUpload()
break
default:
@@ -131,14 +146,30 @@ export class OtaWizardPage implements OnInit, OnDestroy {
}
}
- private compileSketch () {
- // TODO: mock
+ private async handleUpload () {
+ this.state.upload = 'uploading'
+ try {
+ const res = await this.otaWifi.uploadFirmware(this.sketch)
+ console.log(JSON.stringify(res, null, 2))
+
+ this.state.upload = 'done'
+ this.slides.lockSwipeToNext(false)
+ } catch (err) {
+ this.state.upload = 'error'
+ this.errorMsg = err.message
+ }
+
+ }
+
+ private async compileSketch () {
+ // TODO: implement. use this.sketch
+
this.state.compilation = 'compiling'
setTimeout(() => {
this.compiledSketch = 'firmware binary here..'
this.state.compilation = 'done'
this.slides.lockSwipeToNext(false)
- }, 4000)
+ }, 1000)
}
}
@@ -146,6 +177,7 @@ type OtaState = {
isOnline: boolean,
compilation: 'compiling' | 'go-online' | 'done' | 'error',
wifiSelection: 'scanning' | 'connecting' | 'select' | 'manual' | 'error',
+ upload: 'uploading' | 'done' | 'error',
}
// names for the slide indices for easier access