Setup NetworkProtocol architecture for more easily adding a network protocol.
Create NetworkProtocol class. This class will hold business logic shared by all NetworkProtocols.
Create LoraOpenSource class, which extends NetworkProtocol. This holds business logic shared by all versions of Lora Server.
Create LoraOpenSourceV1 and LoraOpenSourcev2, which extend LoraOpenSource.
Create LoraOpenSourceClient class, an HTTP client.
Create LoraOpneSourceClientV1 and LoraOpenSourceClientV2, which extend LoraOpenSourceClient. These classes generally normalize request and response payloads. Normalizing the payloads here allows for sharing all of the business logic between the two versions.
Keep TTN NetworkProtocol as is, except put it into a JavaScript class. Will refactor in the future to resemble LoraOpenSource.
Put handlers in folder inside of networkProtocols folder, to differentiate them from the networkProtocol architecture/utility files.
Separate NetworkProtocol metadata into separate files.
Do you have any concerns with this PR?
It's a large refactor, but all tests are passing. The NetworkProtocol class is mostly a shell. I expect a lot of the business logic in the LoraOpenSource class will move up into NetworkProtocol as it becomes apparent from adding Loriot what should go there. Adding Cat-M1 and NB-IoT might cause there to be classes at the NetworkType level as well.
I plan to keep this issue open, but I wanted to get this refactor in.
How can the reviewer verify this PR?
Read code and run tests.
Any background context you want to provide?
Issue #256 contains comments on some small changes and bug fixes.
Screenshots or logs (if appropriate)
Questions:
Have you connected this PR to the issue it resolves? #256
Does the documentation need an update? Yes, the lpwanserver site page for extending network protocols will need to be updated.
Does this add new dependencies? Increased min node.js version to 8.3 to support Object spread (...)
Have you added unit or functional tests for this PR? Updated tests
What does this PR do?
Setup NetworkProtocol architecture for more easily adding a network protocol.
Do you have any concerns with this PR?
It's a large refactor, but all tests are passing. The NetworkProtocol class is mostly a shell. I expect a lot of the business logic in the LoraOpenSource class will move up into NetworkProtocol as it becomes apparent from adding Loriot what should go there. Adding Cat-M1 and NB-IoT might cause there to be classes at the NetworkType level as well.
I plan to keep this issue open, but I wanted to get this refactor in.
How can the reviewer verify this PR?
Read code and run tests.
Any background context you want to provide?
Issue #256 contains comments on some small changes and bug fixes.
Screenshots or logs (if appropriate)
Questions: