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
Branches
Tags
No related merge requests found
...@@ -14,7 +14,7 @@ func setupDevice(dev *xaal.Device, bDevice *BridgeDevice) { ...@@ -14,7 +14,7 @@ func setupDevice(dev *xaal.Device, bDevice *BridgeDevice) {
dev.Info = "z2m: " + bDevice.FriendlyName dev.Info = "z2m: " + bDevice.FriendlyName
} }
func newDevices(bDevice *BridgeDevice) { func newDevices(gw *gateway, bDevice *BridgeDevice) {
// TODO: Handle errors // TODO: Handle errors
baseAddr := GetGW().baseAddr baseAddr := GetGW().baseAddr
ieeeAddr, _ := hexStringToInteger(bDevice.IeeeAddress) ieeeAddr, _ := hexStringToInteger(bDevice.IeeeAddress)
...@@ -46,7 +46,7 @@ func newDevices(bDevice *BridgeDevice) { ...@@ -46,7 +46,7 @@ func newDevices(bDevice *BridgeDevice) {
setupDevice(dev, bDevice) setupDevice(dev, bDevice)
dev.Dump() dev.Dump()
bDevice.XAALDevice = append(bDevice.XAALDevice, dev) bDevice.XAALDevice = append(bDevice.XAALDevice, dev)
GetGW().engine.AddDevice(dev) gw.engine.AddDevice(dev)
} }
} }
} }
...@@ -101,7 +101,7 @@ func parseDeviceJSON(jsonData []byte) { ...@@ -101,7 +101,7 @@ func parseDeviceJSON(jsonData []byte) {
} }
fmt.Printf("------------------\n\n") fmt.Printf("------------------\n\n")
// spew.Dump(device) // spew.Dump(device)
newDevices(&device) newDevices(gw, &device)
// TODO: filter if device already exists // TODO: filter if device already exists
gw.devices = append(gw.devices, &device) 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