Skip to content

Commit 7ccc2a1

Browse files
committed
added files for v1
1 parent c38ad7c commit 7ccc2a1

File tree

141 files changed

+11031
-0
lines changed

Some content is hidden

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

141 files changed

+11031
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ThingsIoT Arduino Library
2+
3+
The ThingsIoT Arduino Client Library is an easy to use client library to connect your IoT devices to the
4+
[Things IoT](https://things-iot.siddhesh.me "ThingsIoT Cloud Platform") Cloud IoT platform. This is a library specifically designed for the Arduino IDE, so you can easily install it in your environment and start connecting your devices within minutes. It supports multiple network interfaces like Wifi. So you can use it in several devices like Any ESP8266 variant like NodeMCU, etc.
5+
6+
It requires modern Arduino IDE version, starting at 1.6.3.
7+
8+
## Documentation
9+
10+
Please, refer to the following pages for the full documentation of the Arduino Client Library & ThingsIoT Cloud Platform.
11+
12+
[Arduino Client Library Documentation](https://things-iot.siddhesh.me/arduino-docs)
13+
14+
[ThingsIoT Cloud Platform Documentation](https://things-iot.siddhesh.me/cloud-docs)
15+
16+
## License
17+
GNU GENERAL PUBLIC LICENSE v2
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include <ESP8266WiFi.h>
2+
#include <whesp8266.h>
3+
4+
WH_ESP8266 DeviceClient;
5+
6+
int LED = LED_BUILTIN;
7+
8+
void setup()
9+
{
10+
Serial.begin(115200);
11+
12+
pinMode(LED, OUTPUT);
13+
digitalWrite(LED, 1);
14+
15+
DeviceClient.SetDevice("username", "project_name", "credentials");
16+
17+
DeviceClient.SetWiFi("ssid", "pass");
18+
19+
DeviceClient.initDevice();
20+
21+
}
22+
23+
24+
25+
String HandleResponse(String query)
26+
{
27+
28+
if (query == "led on") {
29+
digitalWrite(LED, 0);
30+
return "Done: LED Turned ON";
31+
}
32+
33+
else if (query == "led off") {
34+
digitalWrite(LED, 1);
35+
return "Done: LED Turned OFF";
36+
}
37+
38+
else if (query == "led status")
39+
return digitalRead(LED) ? "LED is OFF" : "LED is ON";
40+
41+
42+
else return "Your query was invalid..";
43+
44+
}
45+
46+
47+
48+
49+
void loop()
50+
{
51+
52+
DeviceClient.Handle();
53+
54+
}

keywords.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#######################################
2+
# Syntax Coloring Map
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1) Classes
7+
#######################################
8+
9+
WH_ESP8266 KEYWORD1
10+
11+
#######################################
12+
# Datatypes (KEYWORD2) Methods
13+
#######################################
14+
15+
DeviceClient KEYWORD2
16+
17+
#######################################
18+
# Datatypes (KEYWORD3) Setup & Loop
19+
#######################################
20+
21+
SetDevice KEYWORD3
22+
SetWiFi KEYWORD3
23+
initDevice KEYWORD3
24+
Handle KEYWORD3
25+
HandleResponse KEYWORD3

library.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=ThingESP
2+
version=1.0.0
3+
author=SiddheshNan <hello@siddhesh.me>
4+
maintainer=SiddheshNan <hello@siddhesh.me>
5+
sentence=Arduino library for the ThingsESP Platform.
6+
paragraph=The ThingESP Arduino Client Library is an easy to use client library to connect your IoT devices to the ThingESP Cloud Platform. This is a library specifically designed for the Arduino IDE, so you can easily install it in your environment and start connecting your devices within minutes. It supports multiple network interfaces like Wifi. So you can use it in several devices like Any ESP8266 variant like NodeMCU, etc.
7+
category=Communication
8+
url=https://github.com/SiddheshNan/ThingESP-Arduino-Library
9+
architectures=*

src/ArduinoJson.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ArduinoJson - arduinojson.org
2+
// Copyright Benoit Blanchon 2014-2020
3+
// MIT License
4+
5+
#pragma once
6+
7+
#ifdef __cplusplus
8+
9+
#include "ArduinoJson.hpp"
10+
11+
using namespace ArduinoJson;
12+
13+
#else
14+
15+
#error ArduinoJson requires a C++ compiler, please change file extension to .cc or .cpp
16+
17+
#endif

src/ArduinoJson.hpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// ArduinoJson - arduinojson.org
2+
// Copyright Benoit Blanchon 2014-2020
3+
// MIT License
4+
5+
#pragma once
6+
7+
#include "ArduinoJson/Configuration.hpp"
8+
9+
#if !ARDUINOJSON_DEBUG
10+
#ifdef __clang__
11+
#pragma clang system_header
12+
#elif defined __GNUC__
13+
#pragma GCC system_header
14+
#endif
15+
#endif
16+
17+
#include "ArduinoJson/Array/ArrayRef.hpp"
18+
#include "ArduinoJson/Object/ObjectRef.hpp"
19+
#include "ArduinoJson/Variant/VariantRef.hpp"
20+
21+
#include "ArduinoJson/Document/DynamicJsonDocument.hpp"
22+
#include "ArduinoJson/Document/StaticJsonDocument.hpp"
23+
24+
#include "ArduinoJson/Array/ArrayImpl.hpp"
25+
#include "ArduinoJson/Array/ElementProxy.hpp"
26+
#include "ArduinoJson/Array/Utilities.hpp"
27+
#include "ArduinoJson/Collection/CollectionImpl.hpp"
28+
#include "ArduinoJson/Object/MemberProxy.hpp"
29+
#include "ArduinoJson/Object/ObjectImpl.hpp"
30+
#include "ArduinoJson/Variant/VariantAsImpl.hpp"
31+
#include "ArduinoJson/Variant/VariantImpl.hpp"
32+
33+
#include "ArduinoJson/Json/JsonDeserializer.hpp"
34+
#include "ArduinoJson/Json/JsonSerializer.hpp"
35+
#include "ArduinoJson/Json/PrettyJsonSerializer.hpp"
36+
#include "ArduinoJson/MsgPack/MsgPackDeserializer.hpp"
37+
#include "ArduinoJson/MsgPack/MsgPackSerializer.hpp"
38+
39+
#include "ArduinoJson/compatibility.hpp"
40+
41+
namespace ArduinoJson {
42+
typedef ARDUINOJSON_NAMESPACE::ArrayConstRef JsonArrayConst;
43+
typedef ARDUINOJSON_NAMESPACE::ArrayRef JsonArray;
44+
typedef ARDUINOJSON_NAMESPACE::Float JsonFloat;
45+
typedef ARDUINOJSON_NAMESPACE::Integer JsonInteger;
46+
typedef ARDUINOJSON_NAMESPACE::ObjectConstRef JsonObjectConst;
47+
typedef ARDUINOJSON_NAMESPACE::ObjectRef JsonObject;
48+
typedef ARDUINOJSON_NAMESPACE::Pair JsonPair;
49+
typedef ARDUINOJSON_NAMESPACE::PairConst JsonPairConst;
50+
typedef ARDUINOJSON_NAMESPACE::String JsonString;
51+
typedef ARDUINOJSON_NAMESPACE::UInt JsonUInt;
52+
typedef ARDUINOJSON_NAMESPACE::VariantConstRef JsonVariantConst;
53+
typedef ARDUINOJSON_NAMESPACE::VariantRef JsonVariant;
54+
using ARDUINOJSON_NAMESPACE::BasicJsonDocument;
55+
using ARDUINOJSON_NAMESPACE::copyArray;
56+
using ARDUINOJSON_NAMESPACE::DeserializationError;
57+
using ARDUINOJSON_NAMESPACE::deserializeJson;
58+
using ARDUINOJSON_NAMESPACE::deserializeMsgPack;
59+
using ARDUINOJSON_NAMESPACE::DynamicJsonDocument;
60+
using ARDUINOJSON_NAMESPACE::JsonDocument;
61+
using ARDUINOJSON_NAMESPACE::measureJson;
62+
using ARDUINOJSON_NAMESPACE::serialized;
63+
using ARDUINOJSON_NAMESPACE::serializeJson;
64+
using ARDUINOJSON_NAMESPACE::serializeJsonPretty;
65+
using ARDUINOJSON_NAMESPACE::serializeMsgPack;
66+
using ARDUINOJSON_NAMESPACE::StaticJsonDocument;
67+
68+
namespace DeserializationOption {
69+
using ARDUINOJSON_NAMESPACE::Filter;
70+
using ARDUINOJSON_NAMESPACE::NestingLimit;
71+
} // namespace DeserializationOption
72+
} // namespace ArduinoJson
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// ArduinoJson - arduinojson.org
2+
// Copyright Benoit Blanchon 2014-2020
3+
// MIT License
4+
5+
#pragma once
6+
7+
#include <ArduinoJson/Collection/CollectionData.hpp>
8+
9+
namespace ARDUINOJSON_NAMESPACE {
10+
11+
inline VariantData *arrayAdd(CollectionData *arr, MemoryPool *pool) {
12+
return arr ? arr->addElement(pool) : 0;
13+
}
14+
15+
template <typename Visitor>
16+
inline void arrayAccept(const CollectionData *arr, Visitor &visitor) {
17+
if (arr)
18+
visitor.visitArray(*arr);
19+
else
20+
visitor.visitNull();
21+
}
22+
23+
inline bool arrayEquals(const CollectionData *lhs, const CollectionData *rhs) {
24+
if (lhs == rhs)
25+
return true;
26+
if (!lhs || !rhs)
27+
return false;
28+
return lhs->equalsArray(*rhs);
29+
}
30+
} // namespace ARDUINOJSON_NAMESPACE

src/ArduinoJson/Array/ArrayImpl.hpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// ArduinoJson - arduinojson.org
2+
// Copyright Benoit Blanchon 2014-2020
3+
// MIT License
4+
5+
#pragma once
6+
7+
#include <ArduinoJson/Array/ArrayRef.hpp>
8+
#include <ArduinoJson/Object/ObjectRef.hpp>
9+
10+
namespace ARDUINOJSON_NAMESPACE {
11+
12+
template <typename TArray>
13+
inline ArrayRef ArrayShortcuts<TArray>::createNestedArray() const {
14+
return impl()->addElement().template to<ArrayRef>();
15+
}
16+
17+
template <typename TArray>
18+
inline ObjectRef ArrayShortcuts<TArray>::createNestedObject() const {
19+
return impl()->addElement().template to<ObjectRef>();
20+
}
21+
22+
template <typename TArray>
23+
inline ElementProxy<TArray> ArrayShortcuts<TArray>::operator[](
24+
size_t index) const {
25+
return ElementProxy<TArray>(*impl(), index);
26+
}
27+
28+
} // namespace ARDUINOJSON_NAMESPACE
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// ArduinoJson - arduinojson.org
2+
// Copyright Benoit Blanchon 2014-2020
3+
// MIT License
4+
5+
#pragma once
6+
7+
#include <ArduinoJson/Variant/SlotFunctions.hpp>
8+
#include <ArduinoJson/Variant/VariantRef.hpp>
9+
10+
namespace ARDUINOJSON_NAMESPACE {
11+
12+
class VariantPtr {
13+
public:
14+
VariantPtr(MemoryPool *pool, VariantData *data) : _variant(pool, data) {}
15+
16+
VariantRef *operator->() {
17+
return &_variant;
18+
}
19+
20+
VariantRef &operator*() {
21+
return _variant;
22+
}
23+
24+
private:
25+
VariantRef _variant;
26+
};
27+
28+
class ArrayIterator {
29+
public:
30+
ArrayIterator() : _slot(0) {}
31+
explicit ArrayIterator(MemoryPool *pool, VariantSlot *slot)
32+
: _pool(pool), _slot(slot) {}
33+
34+
VariantRef operator*() const {
35+
return VariantRef(_pool, _slot->data());
36+
}
37+
VariantPtr operator->() {
38+
return VariantPtr(_pool, _slot->data());
39+
}
40+
41+
bool operator==(const ArrayIterator &other) const {
42+
return _slot == other._slot;
43+
}
44+
45+
bool operator!=(const ArrayIterator &other) const {
46+
return _slot != other._slot;
47+
}
48+
49+
ArrayIterator &operator++() {
50+
_slot = _slot->next();
51+
return *this;
52+
}
53+
54+
ArrayIterator &operator+=(size_t distance) {
55+
_slot = _slot->next(distance);
56+
return *this;
57+
}
58+
59+
VariantSlot *internal() {
60+
return _slot;
61+
}
62+
63+
private:
64+
MemoryPool *_pool;
65+
VariantSlot *_slot;
66+
};
67+
68+
class VariantConstPtr {
69+
public:
70+
VariantConstPtr(const VariantData *data) : _variant(data) {}
71+
72+
VariantConstRef *operator->() {
73+
return &_variant;
74+
}
75+
76+
VariantConstRef &operator*() {
77+
return _variant;
78+
}
79+
80+
private:
81+
VariantConstRef _variant;
82+
};
83+
84+
class ArrayConstRefIterator {
85+
public:
86+
ArrayConstRefIterator() : _slot(0) {}
87+
explicit ArrayConstRefIterator(const VariantSlot *slot) : _slot(slot) {}
88+
89+
VariantConstRef operator*() const {
90+
return VariantConstRef(_slot->data());
91+
}
92+
VariantConstPtr operator->() {
93+
return VariantConstPtr(_slot->data());
94+
}
95+
96+
bool operator==(const ArrayConstRefIterator &other) const {
97+
return _slot == other._slot;
98+
}
99+
100+
bool operator!=(const ArrayConstRefIterator &other) const {
101+
return _slot != other._slot;
102+
}
103+
104+
ArrayConstRefIterator &operator++() {
105+
_slot = _slot->next();
106+
return *this;
107+
}
108+
109+
ArrayConstRefIterator &operator+=(size_t distance) {
110+
_slot = _slot->next(distance);
111+
return *this;
112+
}
113+
114+
const VariantSlot *internal() {
115+
return _slot;
116+
}
117+
118+
private:
119+
const VariantSlot *_slot;
120+
};
121+
} // namespace ARDUINOJSON_NAMESPACE

0 commit comments

Comments
 (0)