This is an initial refactor to move some of the management that is currently in the dongle code, into the main API.
As discussed elsewhere, I think there's too much code still in the dongle interface. This initially moves the command listener handler from the dongle into the API. This changes the dongle interface slightly so that there's now just a sendCommand() method (same as before), but on the receive side there's a callback into the API. This means the dongle code now only needs to process packets. I've not optimised the code in the 2531 implementation - just moved the handler.
My thought is that the ZigBeeNetworkManager class handles 'all' of the network management, so I plan to move some of what is in the API class into here. The ZigBeeApi can then remain as a simple API, or more complex implementations can use the network manager directly.
This is in no way optimised and I'm providing this PR for visibility and any thoughts you might have :)
This is an initial refactor to move some of the management that is currently in the dongle code, into the main API.
As discussed elsewhere, I think there's too much code still in the dongle interface. This initially moves the command listener handler from the dongle into the API. This changes the dongle interface slightly so that there's now just a sendCommand() method (same as before), but on the receive side there's a callback into the API. This means the dongle code now only needs to process packets. I've not optimised the code in the 2531 implementation - just moved the handler.
My thought is that the ZigBeeNetworkManager class handles 'all' of the network management, so I plan to move some of what is in the API class into here. The ZigBeeApi can then remain as a simple API, or more complex implementations can use the network manager directly.
This is in no way optimised and I'm providing this PR for visibility and any thoughts you might have :)
Signed-off-by: Chris Jackson chris@cd-jackson.com
Edit: Migrated to https://github.com/zsmartsystems/com.zsmartsystems.zigbee