0.6.6 Arroyo Toad
Fixed some bugs
This commit is contained in:
parent
21081cc7ce
commit
4ffee0ec63
@ -37,16 +37,16 @@ private func jsonConfigurationParser(_ json: [String: Any]) async throws {
|
|||||||
|
|
||||||
for environmentJSON in environments {
|
for environmentJSON in environments {
|
||||||
|
|
||||||
let env = try json2env(environmentJSON)
|
let env = try await json2env(environmentJSON)
|
||||||
|
|
||||||
IoTSimulatorCore.addEnv(environment: env)
|
await IoTSimulatorCore.addEnv(environment: env)
|
||||||
|
|
||||||
if let devices = environmentJSON["devices"] as? [[String: Any]] {
|
if let devices = environmentJSON["devices"] as? [[String: Any]] {
|
||||||
for deviceJSON in devices {
|
for deviceJSON in devices {
|
||||||
let devices = try await json2edge_dev(deviceJSON)
|
let devices = try await json2edge_dev(deviceJSON)
|
||||||
|
|
||||||
for dev in devices {
|
for dev in devices {
|
||||||
try IoTSimulatorCore.addDevice(location: env.location, device: dev) { msg in
|
await try IoTSimulatorCore.addDevice(location: env.location, device: dev) { msg in
|
||||||
// UGLY: But fast
|
// UGLY: But fast
|
||||||
// TODO: add sending code here
|
// TODO: add sending code here
|
||||||
let backendURL = ProcessInfo.processInfo.environment["BACKEND_URL"]!
|
let backendURL = ProcessInfo.processInfo.environment["BACKEND_URL"]!
|
||||||
@ -69,7 +69,7 @@ private func jsonConfigurationParser(_ json: [String: Any]) async throws {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func json2env(_ json: [String: Any]) throws -> PhysicalEnvironment {
|
private func json2env(_ json: [String: Any]) async throws -> PhysicalEnvironment {
|
||||||
|
|
||||||
guard
|
guard
|
||||||
let envName = json["name"] as? String
|
let envName = json["name"] as? String
|
||||||
@ -91,7 +91,7 @@ private func json2env(_ json: [String: Any]) throws -> PhysicalEnvironment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let datum = PhysicalData(dataType, Float(value))
|
let datum = PhysicalData(dataType, Float(value))
|
||||||
environment.setPhysicalData(datum.type, datum)
|
await environment.setPhysicalData(datum.type, datum)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user