Skip to content

Commit eb2a39f

Browse files
Merge pull request #37 from SUPLA/develop
Farewell to the old library
2 parents 840bcf0 + 5214981 commit eb2a39f

File tree

218 files changed

+23622
-4621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+23622
-4621
lines changed

.drone.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
kind: pipeline
2+
name: default
3+
4+
steps:
5+
- name: compilation
6+
image: rikorose/gcc-cmake
7+
commands:
8+
- mkdir extras/test/build
9+
- cd extras/test/build
10+
- cmake ..
11+
- make -j32
12+
13+
- name: test
14+
image: rikorose/gcc-cmake
15+
commands:
16+
- cd extras/test/build
17+
- ./supladevicetests --gtest_repeat=50 --gtest_shuffle
18+
19+
- name: slack
20+
image: plugins/slack
21+
settings:
22+
webhook:
23+
from_secret: slack_webhook
24+
channel: github
25+
username: drone
26+
27+
# here's the template :)
28+
# notice that the repo endpoint is hardcoded to `https://github.com/`.
29+
# you may adjust it accordingly.
30+
template: >
31+
{{#if build.pull }}
32+
*{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}*: <https://github.com/{{ repo.owner }}/{{ repo.name }}/pull/{{ build.pull }}|Pull Request #{{ build.pull }}> in {{since build.created}}
33+
{{else}}
34+
*{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}: Build #{{ build.number }}* (type: `{{ build.event }}`) in {{since build.created}}
35+
{{/if}}
36+
37+
Commit: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}> at: <https://github.com/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{repo.owner}}/{{repo.name}}/{{ build.branch }}> by: {{ build.author }}
38+
39+
<{{ build.link }}|Visit build page ↗>
40+
when:
41+
status: [success, failure]
42+
event:
43+
exclude:
44+
- pull_request
45+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extras/test/build/

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
os: linux
2+
dist: xenial
3+
sudo: false
4+
language: cpp
5+
6+
addons:
7+
apt:
8+
sources:
9+
- ubuntu-toolchain-r-test
10+
packages:
11+
- g++-6
12+
13+
script:
14+
- mkdir extras/test/build
15+
- cd extras/test/build
16+
- CXX=/usr/bin/g++-6 CC=/usr/bin/gcc-6 cmake ..
17+
- make
18+
- ./supladevicetests

_clang-format

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignConsecutiveMacros: true
9+
AlignEscapedNewlinesLeft: true
10+
AlignOperands: true
11+
AlignTrailingComments: true
12+
AllowAllParametersOfDeclarationOnNextLine: true
13+
AllowShortBlocksOnASingleLine: Never
14+
AllowShortCaseLabelsOnASingleLine: false
15+
AllowShortFunctionsOnASingleLine: None
16+
AllowShortIfStatementsOnASingleLine: true
17+
AllowShortLoopsOnASingleLine: true
18+
AlwaysBreakAfterDefinitionReturnType: None
19+
AlwaysBreakAfterReturnType: None
20+
AlwaysBreakBeforeMultilineStrings: true
21+
AlwaysBreakTemplateDeclarations: true
22+
BinPackArguments: false
23+
BinPackParameters: false
24+
BraceWrapping:
25+
AfterClass: false
26+
AfterControlStatement: false
27+
AfterEnum: false
28+
AfterFunction: false
29+
AfterNamespace: false
30+
AfterObjCDeclaration: false
31+
AfterStruct: false
32+
AfterUnion: false
33+
BeforeCatch: false
34+
BeforeElse: false
35+
IndentBraces: false
36+
BreakBeforeBinaryOperators: None
37+
BreakBeforeBraces: Attach
38+
BreakBeforeTernaryOperators: true
39+
BreakConstructorInitializersBeforeComma: false
40+
ColumnLimit: 80
41+
CommentPragmas: '^ IWYU pragma:'
42+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
43+
ConstructorInitializerIndentWidth: 4
44+
ContinuationIndentWidth: 4
45+
Cpp11BracedListStyle: true
46+
DerivePointerAlignment: true
47+
DisableFormat: false
48+
ExperimentalAutoDetectBinPacking: false
49+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
50+
IncludeCategories:
51+
- Regex: '^<.*\.h>'
52+
Priority: 1
53+
- Regex: '^<.*'
54+
Priority: 2
55+
- Regex: '.*'
56+
Priority: 3
57+
IndentCaseLabels: true
58+
IndentWidth: 2
59+
IndentWrappedFunctionNames: false
60+
KeepEmptyLinesAtTheStartOfBlocks: false
61+
MacroBlockBegin: ''
62+
MacroBlockEnd: ''
63+
MaxEmptyLinesToKeep: 1
64+
NamespaceIndentation: None
65+
ObjCBlockIndentWidth: 2
66+
ObjCSpaceAfterProperty: false
67+
ObjCSpaceBeforeProtocolList: false
68+
PenaltyBreakBeforeFirstCallParameter: 1
69+
PenaltyBreakComment: 300
70+
PenaltyBreakFirstLessLess: 120
71+
PenaltyBreakString: 1000
72+
PenaltyExcessCharacter: 1000000
73+
PenaltyReturnTypeOnItsOwnLine: 200
74+
PointerAlignment: Left
75+
ReflowComments: true
76+
SortIncludes: true
77+
SpaceAfterCStyleCast: false
78+
SpaceBeforeAssignmentOperators: true
79+
SpaceBeforeParens: ControlStatements
80+
SpaceInEmptyParentheses: false
81+
SpacesBeforeTrailingComments: 2
82+
SpacesInAngles: false
83+
SpacesInContainerLiterals: true
84+
SpacesInCStyleCastParentheses: false
85+
SpacesInParentheses: false
86+
SpacesInSquareBrackets: false
87+
Standard: Auto
88+
TabWidth: 8
89+
UseTab: Never
90+
...
91+

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-cayman

examples/Afore/Afore.ino

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
Copyright (C) AC SOFTWARE SP. Z O.O.
3+
4+
This program is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU General Public License
6+
as published by the Free Software Foundation; either version 2
7+
of the License, or (at your option) any later version.
8+
This program is distributed in the hope that it will be useful,
9+
but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
GNU General Public License for more details.
12+
You should have received a copy of the GNU General Public License
13+
along with this program; if not, write to the Free Software
14+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15+
*/
16+
17+
#include <SuplaDevice.h>
18+
#include <supla/pv/afore.h>
19+
20+
// Choose proper network interface for your card:
21+
#ifdef ARDUINO_ARCH_AVR
22+
// Arduino Mega with EthernetShield W5100:
23+
#include <supla/network/ethernet_shield.h>
24+
// Ethernet MAC address
25+
uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
26+
Supla::EthernetShield ethernet(mac);
27+
28+
// Arduino Mega with ENC28J60:
29+
// #include <supla/network/ENC28J60.h>
30+
// Supla::ENC28J60 ethernet(mac);
31+
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
32+
// ESP8266 and ESP32 based board:
33+
#include <supla/network/esp_wifi.h>
34+
Supla::ESPWifi wifi("your_wifi_ssid", "your_wifi_password");
35+
#endif
36+
37+
void setup() {
38+
39+
Serial.begin(115200);
40+
41+
// Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
42+
char GUID[SUPLA_GUID_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
43+
44+
// Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
45+
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
46+
47+
/*
48+
* Having your device already registered at cloud.supla.org,
49+
* you want to change CHANNEL sequence or remove any of them,
50+
* then you must also remove the device itself from cloud.supla.org.
51+
* Otherwise you will get "Channel conflict!" error.
52+
*/
53+
54+
// CHANNEL0
55+
// Put IP address of your Afore inverter, then port, and last parametere is base64 encoded "login:password"
56+
// You can use any online base64 encoder to convert your login and password, i.e. https://www.base64encode.org/
57+
new Supla::PV::Afore(IPAddress(192, 168, 0, 59), 80, "bG9naW46cGFzc3dvcmQ=");
58+
59+
/*
60+
* Server address is available at https://cloud.supla.org
61+
* If you do not have an account, you can create it at https://cloud.supla.org/account/create
62+
* SUPLA and SUPLA CLOUD are free of charge
63+
*/
64+
65+
SuplaDevice.begin(GUID, // Global Unique Identifier
66+
"svr1.supla.org", // SUPLA server address
67+
"email@address", // Email address used to login to Supla Cloud
68+
AUTHKEY); // Authorization key
69+
}
70+
71+
void loop() {
72+
SuplaDevice.iterate();
73+
}
74+

examples/DHT/DHT.ino

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
Copyright (C) AC SOFTWARE SP. Z O.O.
3+
4+
This program is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU General Public License
6+
as published by the Free Software Foundation; either version 2
7+
of the License, or (at your option) any later version.
8+
This program is distributed in the hope that it will be useful,
9+
but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
GNU General Public License for more details.
12+
You should have received a copy of the GNU General Public License
13+
along with this program; if not, write to the Free Software
14+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15+
*/
16+
17+
#include <SuplaDevice.h>
18+
#include <supla/sensor/DHT.h>
19+
20+
// Choose proper network interface for your card:
21+
#ifdef ARDUINO_ARCH_AVR
22+
// Arduino Mega with EthernetShield W5100:
23+
#include <supla/network/ethernet_shield.h>
24+
// Ethernet MAC address
25+
uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
26+
Supla::EthernetShield ethernet(mac);
27+
28+
// Arduino Mega with ENC28J60:
29+
// #include <supla/network/ENC28J60.h>
30+
// Supla::ENC28J60 ethernet(mac);
31+
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
32+
// ESP8266 and ESP32 based board:
33+
#include <supla/network/esp_wifi.h>
34+
Supla::ESPWifi wifi("your_wifi_ssid", "your_wifi_password");
35+
#endif
36+
37+
/*
38+
* This example requires DHT sensor library installed.
39+
* https://github.com/adafruit/DHT-sensor-library
40+
*/
41+
42+
#define DHT1PIN 24
43+
#define DHT1TYPE DHT22
44+
#define DHT2PIN 25
45+
#define DHT2TYPE DHT22
46+
47+
void setup() {
48+
49+
Serial.begin(115200);
50+
51+
// Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
52+
char GUID[SUPLA_GUID_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
53+
54+
// Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
55+
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
56+
57+
/*
58+
* Having your device already registered at cloud.supla.org,
59+
* you want to change CHANNEL sequence or remove any of them,
60+
* then you must also remove the device itself from cloud.supla.org.
61+
* Otherwise you will get "Channel conflict!" error.
62+
*/
63+
64+
// This example adds two DHT22 sensors.
65+
66+
// CHANNEL0 - DHT22 Sensor
67+
new Supla::Sensor::DHT(DHT1PIN, DHT1TYPE);
68+
69+
// CHANNEL1 - DHT22 Sensor
70+
new Supla::Sensor::DHT(DHT2PIN, DHT2TYPE);
71+
72+
/*
73+
* SuplaDevice Initialization.
74+
* Server address is available at https://cloud.supla.org
75+
* If you do not have an account, you can create it at https://cloud.supla.org/account/create
76+
* SUPLA and SUPLA CLOUD are free of charge
77+
*
78+
*/
79+
80+
SuplaDevice.begin(GUID, // Global Unique Identifier
81+
"svr1.supla.org", // SUPLA server address
82+
"email@address", // Email address used to login to Supla Cloud
83+
AUTHKEY); // Authorization key
84+
85+
}
86+
87+
void loop() {
88+
SuplaDevice.iterate();
89+
}

0 commit comments

Comments
 (0)