Skip to content
Snippets Groups Projects
Commit 527b323e authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Still working on the newDevice API.

This stuff sucks
parent 93ee66bf
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ func setupDevice(dev *xaal.Device, bDevice *BridgeDevice) {
dev.Info = "z2m: " + bDevice.FriendlyName
}
func newDevices(bDevice *BridgeDevice) {
func newDevices(gw *gateway, bDevice *BridgeDevice) {
// TODO: Handle errors
baseAddr := GetGW().baseAddr
ieeeAddr, _ := hexStringToInteger(bDevice.IeeeAddress)
......@@ -46,7 +46,7 @@ func newDevices(bDevice *BridgeDevice) {
setupDevice(dev, bDevice)
dev.Dump()
bDevice.XAALDevice = append(bDevice.XAALDevice, dev)
GetGW().engine.AddDevice(dev)
gw.engine.AddDevice(dev)
}
}
}
......@@ -101,7 +101,7 @@ func parseDeviceJSON(jsonData []byte) {
}
fmt.Printf("------------------\n\n")
// spew.Dump(device)
newDevices(&device)
newDevices(gw, &device)
// TODO: filter if device already exists
gw.devices = append(gw.devices, &device)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment