1
0
Fork 0
mirror of https://github.com/sensebox/blockly-app synced 2026-01-05 13:31:27 +01:00

fix compilation errors in ota-wizard

This commit is contained in:
Norwin 2018-11-19 12:45:59 +01:00
parent 657db355ec
commit 7b7b842477
2 changed files with 6 additions and 8 deletions

View file

@ -7,6 +7,7 @@ import {
import {
IonicPage,
Slides,
NavController,
} from 'ionic-angular'
import { Network } from '@ionic-native/network'
import { Subscription } from 'rxjs/Subscription';
@ -24,7 +25,6 @@ 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 = ''
@ -39,6 +39,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
constructor(
private network: Network,
private otaWifi: OtaWifiProvider,
private navCtrl: NavController,
) {
}

View file

@ -56,23 +56,20 @@ export class OtaWifiProvider {
if (this.strategy != WifiStrategy.Automatic)
throw new Error('can not connect to WiFi network on this platform')
await this.platform.is('ios')
return this.platform.is('ios')
? WifiWizard2.iOSConnectNetwork(ssid)
: WifiWizard2.connect(ssid, true)
// validate that the MCU server is available
return this.http.get(`${SENSEBOX_API}/version`).toPromise()
}
async uploadFirmware (binary: string): Promise<any> {
// TODO: send checksum?
return this.http.post(`${SENSEBOX_API}/flash`, binary).toPromise()
return this.http.post(`${SENSEBOX_API}/flash`, binary, {
responseType: 'text',
}).toPromise()
}
}
// TODO: replace with "WifiCapabilities".
// makes it easier to check in each functions if required functionality is available
export enum WifiStrategy {
Automatic = 'Automatic', // android, iOS 11+
Manual = 'Manual', // older iOS