diff --git a/Docker/Dockerfile b/Docker/Dockerfile index d94b1cc..637fdbb 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -14,14 +14,10 @@ RUN cd ~/arduino* && \ RUN git clone --recurse-submodules https://github.com/technyon/Arduino-CMake-Toolchain.git ~/Arduino-CMake-Toolchain -COPY icon /usr/src/nuki_hub/icon -COPY include /usr/src/nuki_hub/include +COPY src /usr/src/nuki_hub/src COPY lib /usr/src/nuki_hub/lib -COPY networkDevices /usr/src/nuki_hub/networkDevices +COPY include /usr/src/nuki_hub/include COPY CMakeLists.txt /usr/src/nuki_hub -COPY index.html /usr/src/nuki_hub -COPY *.h /usr/src/nuki_hub/ -COPY *.cpp /usr/src/nuki_hub/ RUN mkdir -p /usr/src/nuki_hub/build diff --git a/include/README b/include/README new file mode 100644 index 0000000..194dcd4 --- /dev/null +++ b/include/README @@ -0,0 +1,39 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the usual convention is to give header files names that end with `.h'. +It is most portable to use only letters, digits, dashes, and underscores in +header file names, and at most one dot. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/lib/README b/lib/README new file mode 100644 index 0000000..2593a33 --- /dev/null +++ b/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into executable file. + +The source code of each library should be placed in an own separate directory +("lib/your_library_name/[here are source files]"). + +For example, see a structure of the following two libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +and a contents of `src/main.c`: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +PlatformIO Library Dependency Finder will find automatically dependent +libraries scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/CharBuffer.cpp b/src/CharBuffer.cpp similarity index 100% rename from CharBuffer.cpp rename to src/CharBuffer.cpp diff --git a/CharBuffer.h b/src/CharBuffer.h similarity index 100% rename from CharBuffer.h rename to src/CharBuffer.h diff --git a/Config.h b/src/Config.h similarity index 100% rename from Config.h rename to src/Config.h diff --git a/Gpio.cpp b/src/Gpio.cpp similarity index 100% rename from Gpio.cpp rename to src/Gpio.cpp diff --git a/Gpio.h b/src/Gpio.h similarity index 100% rename from Gpio.h rename to src/Gpio.h diff --git a/LockActionResult.h b/src/LockActionResult.h similarity index 100% rename from LockActionResult.h rename to src/LockActionResult.h diff --git a/Logger.cpp b/src/Logger.cpp similarity index 100% rename from Logger.cpp rename to src/Logger.cpp diff --git a/Logger.h b/src/Logger.h similarity index 100% rename from Logger.h rename to src/Logger.h diff --git a/MqttReceiver.h b/src/MqttReceiver.h similarity index 100% rename from MqttReceiver.h rename to src/MqttReceiver.h diff --git a/MqttTopics.h b/src/MqttTopics.h similarity index 100% rename from MqttTopics.h rename to src/MqttTopics.h diff --git a/Network.cpp b/src/Network.cpp similarity index 100% rename from Network.cpp rename to src/Network.cpp diff --git a/Network.h b/src/Network.h similarity index 100% rename from Network.h rename to src/Network.h diff --git a/NetworkLock.cpp b/src/NetworkLock.cpp similarity index 100% rename from NetworkLock.cpp rename to src/NetworkLock.cpp diff --git a/NetworkLock.h b/src/NetworkLock.h similarity index 100% rename from NetworkLock.h rename to src/NetworkLock.h diff --git a/NetworkOpener.cpp b/src/NetworkOpener.cpp similarity index 100% rename from NetworkOpener.cpp rename to src/NetworkOpener.cpp diff --git a/NetworkOpener.h b/src/NetworkOpener.h similarity index 100% rename from NetworkOpener.h rename to src/NetworkOpener.h diff --git a/NukiDeviceId.cpp b/src/NukiDeviceId.cpp similarity index 100% rename from NukiDeviceId.cpp rename to src/NukiDeviceId.cpp diff --git a/NukiDeviceId.h b/src/NukiDeviceId.h similarity index 100% rename from NukiDeviceId.h rename to src/NukiDeviceId.h diff --git a/NukiOpenerWrapper.cpp b/src/NukiOpenerWrapper.cpp similarity index 100% rename from NukiOpenerWrapper.cpp rename to src/NukiOpenerWrapper.cpp diff --git a/NukiOpenerWrapper.h b/src/NukiOpenerWrapper.h similarity index 100% rename from NukiOpenerWrapper.h rename to src/NukiOpenerWrapper.h diff --git a/NukiWrapper.cpp b/src/NukiWrapper.cpp similarity index 100% rename from NukiWrapper.cpp rename to src/NukiWrapper.cpp diff --git a/NukiWrapper.h b/src/NukiWrapper.h similarity index 100% rename from NukiWrapper.h rename to src/NukiWrapper.h diff --git a/Ota.cpp b/src/Ota.cpp similarity index 100% rename from Ota.cpp rename to src/Ota.cpp diff --git a/Ota.h b/src/Ota.h similarity index 100% rename from Ota.h rename to src/Ota.h diff --git a/PreferencesKeys.h b/src/PreferencesKeys.h similarity index 100% rename from PreferencesKeys.h rename to src/PreferencesKeys.h diff --git a/PresenceDetection.cpp b/src/PresenceDetection.cpp similarity index 100% rename from PresenceDetection.cpp rename to src/PresenceDetection.cpp diff --git a/PresenceDetection.h b/src/PresenceDetection.h similarity index 100% rename from PresenceDetection.h rename to src/PresenceDetection.h diff --git a/QueryCommand.h b/src/QueryCommand.h similarity index 100% rename from QueryCommand.h rename to src/QueryCommand.h diff --git a/RestartReason.h b/src/RestartReason.h similarity index 100% rename from RestartReason.h rename to src/RestartReason.h diff --git a/WebCfgServer.cpp b/src/WebCfgServer.cpp similarity index 100% rename from WebCfgServer.cpp rename to src/WebCfgServer.cpp diff --git a/WebCfgServer.h b/src/WebCfgServer.h similarity index 100% rename from WebCfgServer.h rename to src/WebCfgServer.h diff --git a/WebCfgServerConstants.h b/src/WebCfgServerConstants.h similarity index 100% rename from WebCfgServerConstants.h rename to src/WebCfgServerConstants.h diff --git a/main.cpp b/src/main.cpp similarity index 100% rename from main.cpp rename to src/main.cpp diff --git a/networkDevices/ClientSyncW5500.cpp b/src/networkDevices/ClientSyncW5500.cpp similarity index 100% rename from networkDevices/ClientSyncW5500.cpp rename to src/networkDevices/ClientSyncW5500.cpp diff --git a/networkDevices/ClientSyncW5500.h b/src/networkDevices/ClientSyncW5500.h similarity index 100% rename from networkDevices/ClientSyncW5500.h rename to src/networkDevices/ClientSyncW5500.h diff --git a/networkDevices/EthLan8720Device.cpp b/src/networkDevices/EthLan8720Device.cpp similarity index 100% rename from networkDevices/EthLan8720Device.cpp rename to src/networkDevices/EthLan8720Device.cpp diff --git a/networkDevices/EthLan8720Device.h b/src/networkDevices/EthLan8720Device.h similarity index 100% rename from networkDevices/EthLan8720Device.h rename to src/networkDevices/EthLan8720Device.h diff --git a/networkDevices/IPConfiguration.cpp b/src/networkDevices/IPConfiguration.cpp similarity index 100% rename from networkDevices/IPConfiguration.cpp rename to src/networkDevices/IPConfiguration.cpp diff --git a/networkDevices/IPConfiguration.h b/src/networkDevices/IPConfiguration.h similarity index 100% rename from networkDevices/IPConfiguration.h rename to src/networkDevices/IPConfiguration.h diff --git a/networkDevices/NetworkDevice.cpp b/src/networkDevices/NetworkDevice.cpp similarity index 100% rename from networkDevices/NetworkDevice.cpp rename to src/networkDevices/NetworkDevice.cpp diff --git a/networkDevices/NetworkDevice.h b/src/networkDevices/NetworkDevice.h similarity index 100% rename from networkDevices/NetworkDevice.h rename to src/networkDevices/NetworkDevice.h diff --git a/networkDevices/W5500Device.cpp b/src/networkDevices/W5500Device.cpp similarity index 100% rename from networkDevices/W5500Device.cpp rename to src/networkDevices/W5500Device.cpp diff --git a/networkDevices/W5500Device.h b/src/networkDevices/W5500Device.h similarity index 100% rename from networkDevices/W5500Device.h rename to src/networkDevices/W5500Device.h diff --git a/networkDevices/WifiDevice.cpp b/src/networkDevices/WifiDevice.cpp similarity index 100% rename from networkDevices/WifiDevice.cpp rename to src/networkDevices/WifiDevice.cpp diff --git a/networkDevices/WifiDevice.h b/src/networkDevices/WifiDevice.h similarity index 100% rename from networkDevices/WifiDevice.h rename to src/networkDevices/WifiDevice.h diff --git a/networkDevices/espMqttClientW5500.cpp b/src/networkDevices/espMqttClientW5500.cpp similarity index 100% rename from networkDevices/espMqttClientW5500.cpp rename to src/networkDevices/espMqttClientW5500.cpp diff --git a/networkDevices/espMqttClientW5500.h b/src/networkDevices/espMqttClientW5500.h similarity index 100% rename from networkDevices/espMqttClientW5500.h rename to src/networkDevices/espMqttClientW5500.h diff --git a/test/README b/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html