in content/device.js [80:102]
async provision() {
window.localStorage.setItem('connectionInfo',
JSON.stringify({
scopeId: this.connectionInfo.scopeId,
hubName: this.connectionInfo.hubName,
deviceId: this.connectionInfo.deviceId,
deviceKey: this.connectionInfo.deviceKey,
masterKey: this.connectionInfo.masterKey,
modelId: this.connectionInfo.modelId
}))
const dpsClient = new AzDpsClient(this.connectionInfo.scopeId, this.connectionInfo.deviceId, this.connectionInfo.deviceKey, this.connectionInfo.modelId)
this.runningProvision = true
const result = await dpsClient.registerDevice()
this.runningProvision = false
if (result.status === 'assigned') {
this.connectionInfo.hubName = result.registrationState.assignedHub
this.connect()
} else {
console.log(result)
this.connectionInfo.hubName = result.status
}
this.viewDpsForm = false
},