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:
parent
657db355ec
commit
7b7b842477
2 changed files with 6 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ import {
|
||||||
import {
|
import {
|
||||||
IonicPage,
|
IonicPage,
|
||||||
Slides,
|
Slides,
|
||||||
|
NavController,
|
||||||
} from 'ionic-angular'
|
} from 'ionic-angular'
|
||||||
import { Network } from '@ionic-native/network'
|
import { Network } from '@ionic-native/network'
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
import { Subscription } from 'rxjs/Subscription';
|
||||||
|
|
@ -24,7 +25,6 @@ export class OtaWizardPage implements OnInit, OnDestroy {
|
||||||
offlineSub: Subscription
|
offlineSub: Subscription
|
||||||
|
|
||||||
filterSsids = false // TODO: add toggle to UI?
|
filterSsids = false // TODO: add toggle to UI?
|
||||||
filterSsids = true
|
|
||||||
availableSenseboxes: string[] = [] // list of SSIDs
|
availableSenseboxes: string[] = [] // list of SSIDs
|
||||||
compiledSketch = undefined
|
compiledSketch = undefined
|
||||||
errorMsg = ''
|
errorMsg = ''
|
||||||
|
|
@ -39,6 +39,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
|
||||||
constructor(
|
constructor(
|
||||||
private network: Network,
|
private network: Network,
|
||||||
private otaWifi: OtaWifiProvider,
|
private otaWifi: OtaWifiProvider,
|
||||||
|
private navCtrl: NavController,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,23 +56,20 @@ export class OtaWifiProvider {
|
||||||
if (this.strategy != WifiStrategy.Automatic)
|
if (this.strategy != WifiStrategy.Automatic)
|
||||||
throw new Error('can not connect to WiFi network on this platform')
|
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.iOSConnectNetwork(ssid)
|
||||||
: WifiWizard2.connect(ssid, true)
|
: 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> {
|
async uploadFirmware (binary: string): Promise<any> {
|
||||||
// TODO: send checksum?
|
// 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 {
|
export enum WifiStrategy {
|
||||||
Automatic = 'Automatic', // android, iOS 11+
|
Automatic = 'Automatic', // android, iOS 11+
|
||||||
Manual = 'Manual', // older iOS
|
Manual = 'Manual', // older iOS
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue