Skip to content

Commit 6e115ef

Browse files
Merge pull request #11 from arduino-libraries/release1.2
Release 1.2.0
2 parents d195897 + 9386207 commit 6e115ef

File tree

77 files changed

+1698
-87
lines changed

Some content is hidden

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

77 files changed

+1698
-87
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ paragraph=Use this library to connect your Arduino or Genuino board to Temboo, m
66
category=Communication
77
url=http://www.temboo.com/arduino
88
architectures=*
9-
version=1.1.8
9+
version=1.2.0
1010
core-dependencies=arduino (>=1.5.0)

src/Temboo.cpp

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Temboo Arduino library
55
#
6-
# Copyright 2015, Temboo Inc.
6+
# Copyright 2017, Temboo Inc.
77
#
88
# Licensed under the Apache License, Version 2.0 (the "License");
99
# you may not use this file except in compliance with the License.
@@ -121,6 +121,21 @@ void TembooChoreo::setProfile(const char* profileName) {
121121
m_preset.put(profileName);
122122
}
123123

124+
void TembooChoreo::setDeviceType(const String& deviceType) {
125+
m_deviceType.put(deviceType.c_str());
126+
}
127+
128+
void TembooChoreo::setDeviceType(const char* deviceType) {
129+
m_deviceType.put(deviceType);
130+
}
131+
132+
void TembooChoreo::setDeviceName(const String& deviceName) {
133+
m_deviceName.put(deviceName.c_str());
134+
}
135+
136+
void TembooChoreo::setDeviceName(const char* deviceName) {
137+
m_deviceName.put(deviceName);
138+
}
124139

125140
void TembooChoreo::addInput(const String& inputName, const String& inputValue) {
126141
m_inputs.put(inputName.c_str(), inputValue.c_str());
@@ -141,6 +156,33 @@ void TembooChoreo::addInput(const String& inputName, const char* inputValue) {
141156
m_inputs.put(inputName.c_str(), inputValue);
142157
}
143158

159+
void TembooChoreo::addInputExpression(const String& inputName, const String& inputValue) {
160+
m_expressions.put(inputName.c_str(), inputValue.c_str());
161+
}
162+
163+
void TembooChoreo::addInputExpression(const char* inputName, const String& inputValue) {
164+
m_expressions.put(inputName, inputValue.c_str());
165+
}
166+
167+
void TembooChoreo::addInputExpression(const char* inputName, const char* inputValue) {
168+
m_expressions.put(inputName, inputValue);
169+
}
170+
171+
void TembooChoreo::addSensorInput(const char* sensorName, int sensorValue, const char* conversion) {
172+
m_sensors.put(sensorName, sensorValue, conversion, NULL, NULL, NULL, NULL, NULL);
173+
}
174+
175+
void TembooChoreo::addSensorInput(const char* sensorName, int sensorValue) {
176+
m_sensors.put(sensorName, sensorValue, NULL, NULL, NULL, NULL, NULL, NULL);
177+
}
178+
179+
void TembooChoreo::addSensorInput(const char* sensorName, int sensorValue, const char* conversion, const char* calibrationValue) {
180+
m_sensors.put(sensorName, sensorValue, conversion, NULL, NULL, NULL, NULL, calibrationValue);
181+
}
182+
183+
void TembooChoreo::addSensorInput(const char* sensorName, int sensorValue, const char* rawLow, const char* rawHigh, const char* scaleLow, const char* scaleHigh) {
184+
m_sensors.put(sensorName, sensorValue, NULL, rawLow, rawHigh, scaleLow, scaleHigh, NULL);
185+
}
144186

145187
void TembooChoreo::addOutputFilter(const char* outputName, const char* filterPath, const char* variableName) {
146188
m_outputs.put(outputName, filterPath, variableName);
@@ -219,7 +261,7 @@ int TembooChoreo::run(IPAddress addr, uint16_t port, uint16_t timeoutSecs) {
219261

220262
for (int i = 0; i < 2; i++) {
221263
unsigned long timeoutBeginSecs = session.getTime();
222-
if (0 != session.executeChoreo(m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_outputs, m_preset)) {
264+
if (0 != session.executeChoreo(m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_expressions, m_sensors, m_outputs, m_preset, m_deviceType, m_deviceName)) {
223265
httpCode = 0;
224266
break;
225267
}

src/Temboo.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Temboo Arduino library
55
#
6-
# Copyright 2015, Temboo Inc.
6+
# Copyright 2017, Temboo Inc.
77
#
88
# Licensed under the Apache License, Version 2.0 (the "License");
99
# you may not use this file except in compliance with the License.
@@ -23,6 +23,10 @@
2323
#ifndef TEMBOO_H_
2424
#define TEMBOO_H_
2525

26+
#ifndef TEMBOO_LIBRARY_VERSION
27+
#define TEMBOO_LIBRARY_VERSION 2
28+
#endif
29+
2630
#include <Arduino.h>
2731

2832
#if defined (ARDUINO_AVR_YUN) || defined (ARDUINO_AVR_TRE)
@@ -67,8 +71,11 @@ class TembooChoreo : public Process {
6771
#include <Client.h>
6872
#include <IPAddress.h>
6973
#include "utility/ChoreoInputSet.h"
74+
#include "utility/ChoreoInputExpressionSet.h"
75+
#include "utility/ChoreoSensorInputSet.h"
7076
#include "utility/ChoreoOutputSet.h"
7177
#include "utility/ChoreoPreset.h"
78+
#include "utility/ChoreoDevice.h"
7279

7380
#define TEMBOO_ERROR_OK (0)
7481
#define TEMBOO_ERROR_ACCOUNT_MISSING (201)
@@ -121,12 +128,29 @@ class TembooChoreo : public Stream {
121128
void setProfile(const String& profileName);
122129
void setProfile(const char* profileName);
123130

131+
void setDeviceType(const String& deviceType);
132+
void setDeviceType(const char* deviceType);
133+
134+
void setDeviceName(const String& deviceName);
135+
void setDeviceName(const char* deviceName);
136+
124137
// sets an input to be used when executing a choreo.
125138
// (optional or required, depending on the choreo being executed.)
126139
void addInput(const String& inputName, const String& inputValue);
127140
void addInput(const char* inputName, const char* inputValue);
128141
void addInput(const char* inputName, const String& inputValue);
129142
void addInput(const String& inputName, const char* inputValue);
143+
144+
void addInputExpression(const String& inputName, const String& inputValue);
145+
void addInputExpression(const char* inputName, const String& inputValue);
146+
void addInputExpression(const char* inputName, const char* inputValue);
147+
148+
// sets in input that is using a sensor value. Different parameters are needed depending
149+
// on the type of sensor being used.
150+
void addSensorInput(const char* sensorName, int sensorValue, const char* conversion);
151+
void addSensorInput(const char* sensorName, int sensorValue);
152+
void addSensorInput(const char* sensorName, int sensorValue, const char* conversion, const char* calibrationValue);
153+
void addSensorInput(const char* sensorName, int sensorValue, const char* rawLow, const char* rawHigh, const char* scaleLow, const char* scaleHigh);
130154

131155
// sets an output filter to be used to process the choreo output
132156
// (optional)
@@ -162,8 +186,12 @@ class TembooChoreo : public Stream {
162186

163187
protected:
164188
ChoreoInputSet m_inputs;
189+
ChoreoInputExpressionSet m_expressions;
190+
ChoreoSensorInputSet m_sensors;
165191
ChoreoOutputSet m_outputs;
166192
ChoreoPreset m_preset;
193+
ChoreoDevice m_deviceType;
194+
ChoreoDevice m_deviceName;
167195

168196
const char* m_accountName;
169197
const char* m_appKeyValue;

src/TembooCoAPEdgeDevice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Temboo CoAP Edge Device library
55
#
6-
# Copyright (C) 2015, Temboo Inc.
6+
# Copyright (C) 2017, Temboo Inc.
77
#
88
# Licensed under the Apache License, Version 2.0 (the "License");
99
# you may not use this file except in compliance with the License.
@@ -789,7 +789,7 @@ int TembooCoAPChoreo::run(uint16_t timeoutSecs) {
789789
m_client.getNextMessageID();
790790
TEMBOO_TRACE("DBG: ");
791791
TEMBOO_TRACELN("Sending request");
792-
rc = session.executeChoreo(m_requestId, m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_outputs, m_preset);
792+
rc = session.executeChoreo(m_requestId, m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_expressions, m_sensors, m_outputs, m_preset, m_deviceType, m_deviceName);
793793
if (SUCCESS != rc) {
794794
goto ErrorExit;
795795
}

src/TembooCoAPEdgeDevice.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Temboo CoAP Edge Device library
55
#
6-
# Copyright (C) 2015, Temboo Inc.
6+
# Copyright (C) 2017, Temboo Inc.
77
#
88
# Licensed under the Apache License, Version 2.0 (the "License");
99
# you may not use this file except in compliance with the License.
@@ -23,6 +23,9 @@
2323
#ifndef TEMBOOCOAP_H_
2424
#define TEMBOOCOAP_H_
2525

26+
#ifndef TEMBOO_LIBRARY_VERSION
27+
#define TEMBOO_LIBRARY_VERSION 2
28+
#endif
2629

2730
///////////////////////////////////////////////////////
2831
// BEGIN ARDUINO NON-YUN SUPPORT
@@ -34,8 +37,11 @@
3437

3538
#include "utility/TembooCoAPIPStack.h"
3639
#include "utility/ChoreoInputSet.h"
40+
#include "utility/ChoreoInputExpressionSet.h"
41+
#include "utility/ChoreoSensorInputSet.h"
3742
#include "utility/ChoreoOutputSet.h"
3843
#include "utility/ChoreoPreset.h"
44+
#include "utility/ChoreoDevice.h"
3945
#include "utility/CoapMsg.h"
4046
#include "utility/CoapMessageLayer.h"
4147
#include "utility/CoapRRLayer.h"
@@ -278,8 +284,12 @@ class TembooCoAPChoreo : public Stream {
278284
const char* m_path;
279285

280286
ChoreoInputSet m_inputs;
287+
ChoreoInputExpressionSet m_expressions;
288+
ChoreoSensorInputSet m_sensors;
281289
ChoreoOutputSet m_outputs;
282290
ChoreoPreset m_preset;
291+
ChoreoDevice m_deviceType;
292+
ChoreoDevice m_deviceName;
283293

284294
char m_httpCodeStr[4];
285295
char* m_respData;

src/TembooMQTTEdgeDevice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Temboo MQTT Edge Device library
55
#
6-
# Copyright (C) 2015, Temboo Inc.
6+
# Copyright (C) 2017, Temboo Inc.
77
#
88
# Licensed under the Apache License, Version 2.0 (the "License");
99
# you may not use this file except in compliance with the License.
@@ -714,7 +714,7 @@ int TembooMQTTChoreo::run(uint16_t timeoutSecs) {
714714

715715
ArduinoTimer timer(timeoutSecs * 1000L);
716716

717-
int rc = session.executeChoreo( m_requestId, m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_outputs, m_preset);
717+
int rc = session.executeChoreo( m_requestId, m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_expressions, m_sensors, m_outputs, m_preset, m_deviceType, m_deviceName);
718718
if (TEMBOO_ERROR_OK != rc) {
719719
goto ErrorExit;
720720
}

src/TembooMQTTEdgeDevice.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Temboo MQTT edge device library
55
#
6-
# Copyright (C) 2015, Temboo Inc.
6+
# Copyright (C) 2017, Temboo Inc.
77
#
88
# Licensed under the Apache License, Version 2.0 (the "License");
99
# you may not use this file except in compliance with the License.
@@ -23,6 +23,10 @@
2323
#ifndef TEMBOOMQTT_H_
2424
#define TEMBOOMQTT_H_
2525

26+
#ifndef TEMBOO_LIBRARY_VERSION
27+
#define TEMBOO_LIBRARY_VERSION 2
28+
#endif
29+
2630
#include <Arduino.h>
2731

2832

@@ -37,8 +41,11 @@
3741

3842
#include "utility/TembooMQTTIPStack.h"
3943
#include "utility/ChoreoInputSet.h"
44+
#include "utility/ChoreoInputExpressionSet.h"
45+
#include "utility/ChoreoSensorInputSet.h"
4046
#include "utility/ChoreoOutputSet.h"
4147
#include "utility/ChoreoPreset.h"
48+
#include "utility/ChoreoDevice.h"
4249

4350
#define IS_EMPTY(s) (NULL == s || '\0' == *s)
4451

@@ -197,8 +204,12 @@ class TembooMQTTChoreo : public Stream {
197204
const char* m_path;
198205

199206
ChoreoInputSet m_inputs;
207+
ChoreoInputExpressionSet m_expressions;
208+
ChoreoSensorInputSet m_sensors;
200209
ChoreoOutputSet m_outputs;
201210
ChoreoPreset m_preset;
211+
ChoreoDevice m_deviceType;
212+
ChoreoDevice m_deviceName;
202213

203214
char m_httpCodeStr[4];
204215
volatile bool m_haveHttpCode;

src/TembooMonitoring.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Temboo Arduino library
55
#
6-
# Copyright 2016, Temboo Inc.
6+
# Copyright 2017, Temboo Inc.
77
#
88
# Licensed under the Apache License, Version 2.0 (the "License");
99
# you may not use this file except in compliance with the License.

src/TembooMonitoring.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Temboo Arduino library
55
#
6-
# Copyright 2016, Temboo Inc.
6+
# Copyright 2017, Temboo Inc.
77
#
88
# Licensed under the Apache License, Version 2.0 (the "License");
99
# you may not use this file except in compliance with the License.
@@ -23,6 +23,10 @@
2323
#ifndef TEMBOOMESSAGING_H_
2424
#define TEMBOOMESSAGING_H_
2525

26+
#ifndef TEMBOO_LIBRARY_VERSION
27+
#define TEMBOO_LIBRARY_VERSION 2
28+
#endif
29+
2630
#include <Arduino.h>
2731
#include <Process.h>
2832

src/TembooSSL.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
###############################################################################
3+
#
4+
# Temboo Arduino library
5+
#
6+
# Copyright 2017, Temboo Inc.
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing,
15+
# software distributed under the License is distributed on an
16+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17+
# either express or implied. See the License for the specific
18+
# language governing permissions and limitations under the License.
19+
#
20+
###############################################################################
21+
*/
22+
23+
#if defined (ARDUINO_AVR_YUN) || defined (ARDUINO_AVR_TRE)
24+
25+
#else
26+
27+
#include <string.h>
28+
#include <Client.h>
29+
#include <avr/pgmspace.h>
30+
#include <TembooSSL.h>
31+
#include "utility/TembooGlobal.h"
32+
#include "utility/TembooSession.h"
33+
34+
TembooChoreoSSL::TembooChoreoSSL(Client& client) : TembooChoreo(client) {
35+
m_accountName = NULL;
36+
m_appKeyName = NULL;
37+
m_appKeyValue = NULL;
38+
m_path = NULL;
39+
m_nextChar = NULL;
40+
m_nextState = END;
41+
}
42+
43+
int TembooChoreoSSL::run() {
44+
return TembooChoreo::run(INADDR_NONE, 443, TEMBOO_CHOREO_DEFAULT_TIMEOUT_SECS);
45+
}
46+
47+
int TembooChoreoSSL::run(uint16_t timeoutSecs) {
48+
return TembooChoreo::run(INADDR_NONE, 443, timeoutSecs);
49+
}
50+
51+
#endif

0 commit comments

Comments
 (0)