Open LukasWoodtli opened 3 months ago
The images are created with PlantUML:
@startditaa (--no-shadows)
+------------------------------------------------+
| Add Ons (optional) |
| +=----+ +=---------+ |
| | CLI | | Registry | ... |
| +-----+ +----------+ |
+------------------------------------------------+
| Base |
| +------+ +------+ +------+ +------+ |
| | Core | | Data | | CoAP | | Util | |
| +------+ +------+ +------+ +------+ |
+------------------------------------------------+
| Support |
| +----------+ +-----------+ +------------+ |
| | Platform | | Transport | | Event Loop | ... |
| +----------+ +-----------+ +------------+ |
+------------------------------------------------+
@endditaa
@startsalt
{
{T
+ eclipse-wakaama
++ base
+++ core
+++ data
+++ coap
+++ util
++ support
+++ platform
+++ transport
+++ event_loop
+++ ...
++ addon
+++ cli
+++ registry
+++ ...
}
}
@endsalt
This is a proposal of a cleaner architecture for Wakaama. This ensures that the library is modular and easier to maintain and extend.
Layered Architecture
Each layer is allowed to access code from itself and all layers below it (the layers are open). But it is not allowed to access code from higher layers.
Support Layer
This forms the basis for the library and supports an abstraction to the environment. They are necessary for the functionality of the library, but cannot be implemented in a generic way.
Abstractions in this layer include:
select
,epoll
, ...)Customization in this layer is mainly achieved by link-time polymorphism: For example, a POSIX platform module implements the set of functions declared in
platform.h
and is linked to the library. Another module for and embedded system would implement the same functions. But only one of these modules are linked to the final library.Base Layer
This layer contains the core LwM2M functionality.
Customization in this layer is done with conditional compilation (
#ifdef
s).Add On's Layer
This layer includes additional functionality, that might be useful for some application, but that can be omitted for others. This might include modules for:
Modules from this layer can be added with the build system (CMake).
Folder Structure
The folder structure should reflect the architecture layers.
With a nice folder structure and a correct build system, some architectual rules can be enfored (i.e. no circular dependencies, accessing only lower layers).