bluerobotics / bluerobotics/BlueOS
Improvement on endpoints API
- Dominant language
- Vue
- Stars
- 453
- Forks
- 151
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 174
Description
### The context:
We had a class called `Endpoint`, that receives 3 arguments: `connection_type`, `place` and `argument`.
Right now, [with the new metadata](#166 ), this class receives 4 more arguments: `name`, `owner`, `persistent` and `protected`, with the last two having default `false` values.
### The problem:
Two many arguments to instantiate an endpoint, with some of those arguments being unrelated (some are metadata and some are connection data).
### The solution:
Separate the Endpoint class into 3 classes:
- ConnectionEndpoint
- MavlinkEndpoint
- CompanionEndpoint
The base `ConnectionEndpoint` class would be abstract, and represents what an `Endpoint` should do, but not how.
`MavlinkEndpoint` would inherits from `ConnectionEndpoint` and implement it (would have basically all the code that is in Endpoint today).
`CompanionEndpoint` would be a class that has the companion metadata we want to add (name, owner, persistent and protected) *and* receives also an `ConnectionEndpoint` instance.
In that way, we better separate the concerns (`ConnectionEndpoint` instance will store connection information while `CompanionEndpoint` instance stores the metadata), we make the calls smaller and more clear *and* we open the possibility for future implementations of new protocols.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.