-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 273e7a3
Showing
33 changed files
with
1,296 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding ="utf-8" ?> | ||
<Project xmlns="http:https://schemas.microsoft.com/developer/msbuild/2003" > | ||
<PropertyGroup Label="Globals" > | ||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
<HasSharedItems>true</HasSharedItems> | ||
<ItemsProjectGuid>{b54b5a74-b581-4c20-946d-2da479642537}</ItemsProjectGuid> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ProjectCapability Include="SourceItemsFromImports" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\ksApplication.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\ksComposable.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\ksConfig.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksConfigProvider.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksLed.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttConfigProvider.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttConnector.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttDebugResponder.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksTimer.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksWiFiConfigurator.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksWifiConnector.cpp" /> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\evt\ksEventHandle.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksIotFrameworkLib.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksApplication.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksComponent.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksComposable.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksConfig.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksConstants.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksConfigProvider.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksLed.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttConfigProvider.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttConnector.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttDebugResponder.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksTimer.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksWiFiConfigurator.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksWifiConnector.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\evt\ksEvent.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\evt\ksEventBase.h" /> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\evt\ksEventHandle.h" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Text Include="$(MSBuildThisFileDirectory)library.properties" /> | ||
<Text Include="$(MSBuildThisFileDirectory)readme.txt" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="$(MSBuildThisFileDirectory)ksIotFrameworkLib.vcxitems.filters" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" xmlns="http:https://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;s</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx</Extensions> | ||
</Filter> | ||
<Filter Include="Source Files\ksf"> | ||
<UniqueIdentifier>{834c4395-8703-436a-b64d-8dea5e124cbb}</UniqueIdentifier> | ||
</Filter> | ||
<Filter Include="Source Files\ksf\comp"> | ||
<UniqueIdentifier>{14dd739c-4a78-45a0-83cb-98804153bb63}</UniqueIdentifier> | ||
</Filter> | ||
<Filter Include="Source Files\ksf\evt"> | ||
<UniqueIdentifier>{8a449b01-5889-49fe-b86a-0a02ffedef54}</UniqueIdentifier> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Text Include="$(MSBuildThisFileDirectory)readme.txt" /> | ||
<Text Include="$(MSBuildThisFileDirectory)library.properties" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksConfigProvider.cpp"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksLed.cpp"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttConfigProvider.cpp"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttConnector.cpp"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttDebugResponder.cpp"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksTimer.cpp"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksWiFiConfigurator.cpp"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksWifiConnector.cpp"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\evt\ksEventHandle.cpp"> | ||
<Filter>Source Files\ksf\evt</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\ksApplication.cpp"> | ||
<Filter>Source Files\ksf</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\ksComposable.cpp"> | ||
<Filter>Source Files\ksf</Filter> | ||
</ClCompile> | ||
<ClCompile Include="$(MSBuildThisFileDirectory)src\ksf\ksConfig.cpp"> | ||
<Filter>Source Files\ksf</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksConfigProvider.h"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksLed.h"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttConfigProvider.h"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttConnector.h"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksMqttDebugResponder.h"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksTimer.h"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksWiFiConfigurator.h"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\comp\ksWifiConnector.h"> | ||
<Filter>Source Files\ksf\comp</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\evt\ksEvent.h"> | ||
<Filter>Source Files\ksf\evt</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\evt\ksEventBase.h"> | ||
<Filter>Source Files\ksf\evt</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\evt\ksEventHandle.h"> | ||
<Filter>Source Files\ksf\evt</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksApplication.h"> | ||
<Filter>Source Files\ksf</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksComponent.h"> | ||
<Filter>Source Files\ksf</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksComposable.h"> | ||
<Filter>Source Files\ksf</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksConfig.h"> | ||
<Filter>Source Files\ksf</Filter> | ||
</ClInclude> | ||
<ClInclude Include="$(MSBuildThisFileDirectory)src\ksf\ksConstants.h"> | ||
<Filter>Source Files\ksf</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name=ksIotFrameworkLib | ||
version=1.0.0 | ||
author=Krzysztof | ||
maintainer=Krzysztof | ||
sentence=ksIotFrameworkLib Library | ||
paragraph= | ||
category=Uncategorized | ||
url=https://github/cziter15/ksIotFrameworkLib | ||
architectures=* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Arduino Compatible Cross Platform C++ Library Project : For more information see http:https://www.visualmicro.com | ||
|
||
This project works exactly the same way as an Arduino library. Code should be in the src folder, code in sub folders below the \src folder are also supported. | ||
|
||
The \src folder, if it exists, will be added as a compiler -I include path, otherwise the library folder will be a compiler -I include path. | ||
|
||
Older Arduino libraries support code in the library folder and private code in the \utility sub folder. | ||
|
||
Add this project to any solution that contains an Arduino project and #include <headers.h> in code as you would any normal Arduino library headers. | ||
|
||
To enable intellisense and to support live build discovery outside of the "standard" Arduino library locations, ensure that the library is added as a shared project reference to the master Arduino project. To do this, right click the master project "References" node and then click "Add Reference". A window will open and the library will appear on the "Shared Projects" tab. Click the checkbox next to the library name to add the reference. If this library is moved the shared referencemust be removed and re-added. | ||
|
||
VS2017 has a bug, workround: After moving existing source code within a "library or shared project", close and re-open the solution. | ||
|
||
Visual Studio will display intellisense for libraries based on the platform/board that has been specified for the currently active "Startup Project" of the current solution. | ||
|
||
|
||
IMPORTANT: The arduino.cc Library Rules must be followed when adding code or restructing libraries. | ||
|
||
|
||
|
||
|
||
blog: http:https://www.visualmicro.com/post/2017/01/16/Arduino-Cross-Platform-Library-Development.aspx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
#include "ksf/ksApplication.h" | ||
#include "ksf/ksComponent.h" | ||
#include "ksf/ksComposable.h" | ||
#include "ksf/ksConfig.h" | ||
#include "ksf/ksConstants.h" | ||
#include "ksf/evt/ksEvent.h" | ||
#include "ksf/comp/ksConfigProvider.h" | ||
#include "ksf/comp/ksLed.h" | ||
#include "ksf/comp/ksMqttConfigProvider.h" | ||
#include "ksf/comp/ksMqttConnector.h" | ||
#include "ksf/comp/ksMqttDebugResponder.h" | ||
#include "ksf/comp/ksTimer.h" | ||
#include "ksf/comp/ksWiFiConfigurator.h" | ||
#include "ksf/comp/ksWifiConnector.h" | ||
#include <WiFiManager.h> | ||
#include "WString.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "ksConfigProvider.h" | ||
#include "../ksConfig.h" | ||
#include <WiFiManager.h> | ||
|
||
namespace ksf | ||
{ | ||
bool ksConfigProvider::init(ksComposable* owner) | ||
{ | ||
return true; | ||
} | ||
|
||
bool ksConfigProvider::loop() | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
#include "../ksComponent.h" | ||
#include <vector> | ||
|
||
class WiFiManager; | ||
|
||
namespace ksf | ||
{ | ||
class ksComposable; | ||
class ksConfigProvider : public ksComponent | ||
{ | ||
public: | ||
bool init(ksComposable* owner) override; | ||
virtual void injectManagerParameters(WiFiManager& manager) = 0; | ||
virtual void captureManagerParameters(WiFiManager& manager) = 0; | ||
bool loop() override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "../ksComposable.h" | ||
#include "ksLed.h" | ||
#include "Arduino.h" | ||
|
||
namespace ksf | ||
{ | ||
ksLed::ksLed(unsigned short pin) : ledPin(pin) | ||
{ | ||
} | ||
|
||
bool ksLed::init(ksComposable* owner) | ||
{ | ||
pinMode(ledPin, OUTPUT); | ||
digitalWrite(ledPin, LOW); | ||
return true; | ||
} | ||
|
||
bool ksLed::loop() | ||
{ | ||
if (blinkInterval > 0) | ||
{ | ||
if (millis() - lastBlinkTime > blinkInterval) | ||
{ | ||
setEnabled(!isEnabled()); | ||
lastBlinkTime = millis(); | ||
|
||
if (blinkLoops > 0 && --blinkLoops == 0) | ||
setBlinking(0); | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
bool ksLed::isEnabled() const | ||
{ | ||
return digitalRead(ledPin) == 1; | ||
} | ||
|
||
void ksLed::setBlinking(unsigned int interval, unsigned int loops) | ||
{ | ||
setEnabled(interval > 0); | ||
blinkInterval = interval; | ||
lastBlinkTime = millis(); | ||
blinkLoops = loops; | ||
} | ||
|
||
bool ksLed::isBlinking() const | ||
{ | ||
return blinkInterval > 0; | ||
} | ||
|
||
void ksLed::setEnabled(bool isEnabled) | ||
{ | ||
digitalWrite(ledPin, isEnabled ? 1 : 0); | ||
} | ||
|
||
ksLed::~ksLed() | ||
{ | ||
setEnabled(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
#include "../ksComponent.h" | ||
|
||
namespace ksf | ||
{ | ||
class ksLed : public ksComponent | ||
{ | ||
protected: | ||
unsigned short ledPin = 0; | ||
unsigned int lastBlinkTime = 0; | ||
unsigned int blinkInterval = 0; | ||
unsigned int blinkLoops = 0; | ||
|
||
public: | ||
ksLed(unsigned short pin); | ||
|
||
bool init(class ksComposable* owner) override; | ||
bool loop() override; | ||
|
||
virtual void setBlinking(unsigned int interval, unsigned int loops = 0); | ||
virtual bool isBlinking() const; | ||
|
||
virtual bool isEnabled() const; | ||
virtual void setEnabled(bool enabled); | ||
|
||
virtual ~ksLed(); | ||
}; | ||
} | ||
|
Oops, something went wrong.