From 9386207bec29ad0ba1d8d665ad8837fc33053dff Mon Sep 17 00:00:00 2001 From: kevinbuck-temboo Date: Wed, 18 Jan 2017 15:10:40 -0500 Subject: [PATCH] Release 1.2.0 --- library.properties | 2 +- src/Temboo.cpp | 46 ++- src/Temboo.h | 30 +- src/TembooCoAPEdgeDevice.cpp | 4 +- src/TembooCoAPEdgeDevice.h | 12 +- src/TembooMQTTEdgeDevice.cpp | 4 +- src/TembooMQTTEdgeDevice.h | 13 +- src/TembooMonitoring.cpp | 2 +- src/TembooMonitoring.h | 6 +- src/TembooSSL.cpp | 51 +++ src/TembooSSL.h | 70 ++++ src/TembooYunShield.h | 6 +- src/utility/ArduinoTimer.h | 2 +- src/utility/BaseFormatter.cpp | 2 +- src/utility/BaseFormatter.h | 2 +- src/utility/ChoreoDevice.cpp | 23 ++ src/utility/ChoreoDevice.h | 42 +++ src/utility/ChoreoDeviceFormatter.cpp | 90 +++++ src/utility/ChoreoDeviceFormatter.h | 55 +++ src/utility/ChoreoInput.cpp | 2 +- src/utility/ChoreoInput.h | 2 +- src/utility/ChoreoInputExpression.cpp | 34 ++ src/utility/ChoreoInputExpression.h | 41 +++ .../ChoreoInputExpressionFormatter.cpp | 125 +++++++ src/utility/ChoreoInputExpressionFormatter.h | 59 ++++ src/utility/ChoreoInputExpressionSet.cpp | 80 +++++ src/utility/ChoreoInputExpressionSet.h | 44 +++ src/utility/ChoreoInputFormatter.cpp | 2 +- src/utility/ChoreoInputFormatter.h | 2 +- src/utility/ChoreoInputSet.cpp | 2 +- src/utility/ChoreoInputSet.h | 2 +- src/utility/ChoreoOutput.cpp | 2 +- src/utility/ChoreoOutput.h | 2 +- src/utility/ChoreoOutputFormatter.cpp | 2 +- src/utility/ChoreoOutputFormatter.h | 2 +- src/utility/ChoreoOutputSet.cpp | 2 +- src/utility/ChoreoOutputSet.h | 2 +- src/utility/ChoreoPreset.cpp | 2 +- src/utility/ChoreoPreset.h | 2 +- src/utility/ChoreoPresetFormatter.cpp | 2 +- src/utility/ChoreoPresetFormatter.h | 2 +- src/utility/ChoreoSensorInput.cpp | 41 +++ src/utility/ChoreoSensorInput.h | 63 ++++ src/utility/ChoreoSensorInputFormatter.cpp | 316 ++++++++++++++++++ src/utility/ChoreoSensorInputFormatter.h | 86 +++++ src/utility/ChoreoSensorInputSet.cpp | 86 +++++ src/utility/ChoreoSensorInputSet.h | 44 +++ src/utility/CoapMessageLayer.cpp | 2 +- src/utility/CoapMessageLayer.h | 2 +- src/utility/CoapMsg.cpp | 2 +- src/utility/CoapMsg.h | 2 +- src/utility/CoapRRLayer.cpp | 2 +- src/utility/CoapRRLayer.h | 2 +- src/utility/DataFormatter.cpp | 130 ++++++- src/utility/DataFormatter.h | 21 +- src/utility/TembooCoAPIPStack.h | 2 +- src/utility/TembooCoAPSession.cpp | 16 +- src/utility/TembooCoAPSession.h | 14 +- src/utility/TembooDS18B20.cpp | 2 +- src/utility/TembooDS18B20.h | 2 +- src/utility/TembooGPIO.c | 2 +- src/utility/TembooGPIO.h | 2 +- src/utility/TembooGlobal.c | 2 +- src/utility/TembooGlobal.h | 2 +- src/utility/TembooMQTTIPStack.h | 2 +- src/utility/TembooMQTTSession.cpp | 10 +- src/utility/TembooMQTTSession.h | 8 +- src/utility/TembooSession.cpp | 18 +- src/utility/TembooSession.h | 11 +- src/utility/TembooTags.h | 2 +- src/utility/TembooTimer.h | 2 +- src/utility/TembooWebSocketRequestHandles.c | 2 +- src/utility/TembooWebSocketRequestHandles.h | 2 +- src/utility/tmbhmac.cpp | 2 +- src/utility/tmbhmac.h | 2 +- src/utility/tmbmd5.cpp | 2 +- src/utility/tmbmd5.h | 2 +- 77 files changed, 1698 insertions(+), 87 deletions(-) create mode 100644 src/TembooSSL.cpp create mode 100644 src/TembooSSL.h create mode 100644 src/utility/ChoreoDevice.cpp create mode 100644 src/utility/ChoreoDevice.h create mode 100644 src/utility/ChoreoDeviceFormatter.cpp create mode 100644 src/utility/ChoreoDeviceFormatter.h create mode 100644 src/utility/ChoreoInputExpression.cpp create mode 100644 src/utility/ChoreoInputExpression.h create mode 100644 src/utility/ChoreoInputExpressionFormatter.cpp create mode 100644 src/utility/ChoreoInputExpressionFormatter.h create mode 100644 src/utility/ChoreoInputExpressionSet.cpp create mode 100644 src/utility/ChoreoInputExpressionSet.h create mode 100644 src/utility/ChoreoSensorInput.cpp create mode 100644 src/utility/ChoreoSensorInput.h create mode 100644 src/utility/ChoreoSensorInputFormatter.cpp create mode 100644 src/utility/ChoreoSensorInputFormatter.h create mode 100644 src/utility/ChoreoSensorInputSet.cpp create mode 100644 src/utility/ChoreoSensorInputSet.h diff --git a/library.properties b/library.properties index c7e9617..44486fc 100644 --- a/library.properties +++ b/library.properties @@ -6,5 +6,5 @@ paragraph=Use this library to connect your Arduino or Genuino board to Temboo, m category=Communication url=http://www.temboo.com/arduino architectures=* -version=1.1.8 +version=1.2.0 core-dependencies=arduino (>=1.5.0) \ No newline at end of file diff --git a/src/Temboo.cpp b/src/Temboo.cpp index 35a384a..4df1950 100644 --- a/src/Temboo.cpp +++ b/src/Temboo.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -121,6 +121,21 @@ void TembooChoreo::setProfile(const char* profileName) { m_preset.put(profileName); } +void TembooChoreo::setDeviceType(const String& deviceType) { + m_deviceType.put(deviceType.c_str()); +} + +void TembooChoreo::setDeviceType(const char* deviceType) { + m_deviceType.put(deviceType); +} + +void TembooChoreo::setDeviceName(const String& deviceName) { + m_deviceName.put(deviceName.c_str()); +} + +void TembooChoreo::setDeviceName(const char* deviceName) { + m_deviceName.put(deviceName); +} void TembooChoreo::addInput(const String& inputName, const String& inputValue) { m_inputs.put(inputName.c_str(), inputValue.c_str()); @@ -141,6 +156,33 @@ void TembooChoreo::addInput(const String& inputName, const char* inputValue) { m_inputs.put(inputName.c_str(), inputValue); } +void TembooChoreo::addInputExpression(const String& inputName, const String& inputValue) { + m_expressions.put(inputName.c_str(), inputValue.c_str()); +} + +void TembooChoreo::addInputExpression(const char* inputName, const String& inputValue) { + m_expressions.put(inputName, inputValue.c_str()); +} + +void TembooChoreo::addInputExpression(const char* inputName, const char* inputValue) { + m_expressions.put(inputName, inputValue); +} + +void TembooChoreo::addSensorInput(const char* sensorName, int sensorValue, const char* conversion) { + m_sensors.put(sensorName, sensorValue, conversion, NULL, NULL, NULL, NULL, NULL); +} + +void TembooChoreo::addSensorInput(const char* sensorName, int sensorValue) { + m_sensors.put(sensorName, sensorValue, NULL, NULL, NULL, NULL, NULL, NULL); +} + +void TembooChoreo::addSensorInput(const char* sensorName, int sensorValue, const char* conversion, const char* calibrationValue) { + m_sensors.put(sensorName, sensorValue, conversion, NULL, NULL, NULL, NULL, calibrationValue); +} + +void TembooChoreo::addSensorInput(const char* sensorName, int sensorValue, const char* rawLow, const char* rawHigh, const char* scaleLow, const char* scaleHigh) { + m_sensors.put(sensorName, sensorValue, NULL, rawLow, rawHigh, scaleLow, scaleHigh, NULL); +} void TembooChoreo::addOutputFilter(const char* outputName, const char* filterPath, const char* variableName) { m_outputs.put(outputName, filterPath, variableName); @@ -219,7 +261,7 @@ int TembooChoreo::run(IPAddress addr, uint16_t port, uint16_t timeoutSecs) { for (int i = 0; i < 2; i++) { unsigned long timeoutBeginSecs = session.getTime(); - if (0 != session.executeChoreo(m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_outputs, m_preset)) { + 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)) { httpCode = 0; break; } diff --git a/src/Temboo.h b/src/Temboo.h index e74d69a..62a1fff 100644 --- a/src/Temboo.h +++ b/src/Temboo.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,6 +23,10 @@ #ifndef TEMBOO_H_ #define TEMBOO_H_ +#ifndef TEMBOO_LIBRARY_VERSION +#define TEMBOO_LIBRARY_VERSION 2 +#endif + #include #if defined (ARDUINO_AVR_YUN) || defined (ARDUINO_AVR_TRE) @@ -67,8 +71,11 @@ class TembooChoreo : public Process { #include #include #include "utility/ChoreoInputSet.h" +#include "utility/ChoreoInputExpressionSet.h" +#include "utility/ChoreoSensorInputSet.h" #include "utility/ChoreoOutputSet.h" #include "utility/ChoreoPreset.h" +#include "utility/ChoreoDevice.h" #define TEMBOO_ERROR_OK (0) #define TEMBOO_ERROR_ACCOUNT_MISSING (201) @@ -121,12 +128,29 @@ class TembooChoreo : public Stream { void setProfile(const String& profileName); void setProfile(const char* profileName); + void setDeviceType(const String& deviceType); + void setDeviceType(const char* deviceType); + + void setDeviceName(const String& deviceName); + void setDeviceName(const char* deviceName); + // sets an input to be used when executing a choreo. // (optional or required, depending on the choreo being executed.) void addInput(const String& inputName, const String& inputValue); void addInput(const char* inputName, const char* inputValue); void addInput(const char* inputName, const String& inputValue); void addInput(const String& inputName, const char* inputValue); + + void addInputExpression(const String& inputName, const String& inputValue); + void addInputExpression(const char* inputName, const String& inputValue); + void addInputExpression(const char* inputName, const char* inputValue); + + // sets in input that is using a sensor value. Different parameters are needed depending + // on the type of sensor being used. + void addSensorInput(const char* sensorName, int sensorValue, const char* conversion); + void addSensorInput(const char* sensorName, int sensorValue); + void addSensorInput(const char* sensorName, int sensorValue, const char* conversion, const char* calibrationValue); + void addSensorInput(const char* sensorName, int sensorValue, const char* rawLow, const char* rawHigh, const char* scaleLow, const char* scaleHigh); // sets an output filter to be used to process the choreo output // (optional) @@ -162,8 +186,12 @@ class TembooChoreo : public Stream { protected: ChoreoInputSet m_inputs; + ChoreoInputExpressionSet m_expressions; + ChoreoSensorInputSet m_sensors; ChoreoOutputSet m_outputs; ChoreoPreset m_preset; + ChoreoDevice m_deviceType; + ChoreoDevice m_deviceName; const char* m_accountName; const char* m_appKeyValue; diff --git a/src/TembooCoAPEdgeDevice.cpp b/src/TembooCoAPEdgeDevice.cpp index d323597..ff6dc98 100644 --- a/src/TembooCoAPEdgeDevice.cpp +++ b/src/TembooCoAPEdgeDevice.cpp @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -789,7 +789,7 @@ int TembooCoAPChoreo::run(uint16_t timeoutSecs) { m_client.getNextMessageID(); TEMBOO_TRACE("DBG: "); TEMBOO_TRACELN("Sending request"); - rc = session.executeChoreo(m_requestId, m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_outputs, m_preset); + 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); if (SUCCESS != rc) { goto ErrorExit; } diff --git a/src/TembooCoAPEdgeDevice.h b/src/TembooCoAPEdgeDevice.h index 603ecc6..8a35ebe 100644 --- a/src/TembooCoAPEdgeDevice.h +++ b/src/TembooCoAPEdgeDevice.h @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,6 +23,9 @@ #ifndef TEMBOOCOAP_H_ #define TEMBOOCOAP_H_ +#ifndef TEMBOO_LIBRARY_VERSION +#define TEMBOO_LIBRARY_VERSION 2 +#endif /////////////////////////////////////////////////////// // BEGIN ARDUINO NON-YUN SUPPORT @@ -34,8 +37,11 @@ #include "utility/TembooCoAPIPStack.h" #include "utility/ChoreoInputSet.h" +#include "utility/ChoreoInputExpressionSet.h" +#include "utility/ChoreoSensorInputSet.h" #include "utility/ChoreoOutputSet.h" #include "utility/ChoreoPreset.h" +#include "utility/ChoreoDevice.h" #include "utility/CoapMsg.h" #include "utility/CoapMessageLayer.h" #include "utility/CoapRRLayer.h" @@ -278,8 +284,12 @@ class TembooCoAPChoreo : public Stream { const char* m_path; ChoreoInputSet m_inputs; + ChoreoInputExpressionSet m_expressions; + ChoreoSensorInputSet m_sensors; ChoreoOutputSet m_outputs; ChoreoPreset m_preset; + ChoreoDevice m_deviceType; + ChoreoDevice m_deviceName; char m_httpCodeStr[4]; char* m_respData; diff --git a/src/TembooMQTTEdgeDevice.cpp b/src/TembooMQTTEdgeDevice.cpp index d94fff7..e423097 100644 --- a/src/TembooMQTTEdgeDevice.cpp +++ b/src/TembooMQTTEdgeDevice.cpp @@ -3,7 +3,7 @@ # # Temboo MQTT Edge Device library # -# Copyright (C) 2015, Temboo Inc. +# Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -714,7 +714,7 @@ int TembooMQTTChoreo::run(uint16_t timeoutSecs) { ArduinoTimer timer(timeoutSecs * 1000L); - int rc = session.executeChoreo( m_requestId, m_accountName, m_appKeyName, m_appKeyValue, m_path, m_inputs, m_outputs, m_preset); + 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); if (TEMBOO_ERROR_OK != rc) { goto ErrorExit; } diff --git a/src/TembooMQTTEdgeDevice.h b/src/TembooMQTTEdgeDevice.h index c667547..06976ed 100644 --- a/src/TembooMQTTEdgeDevice.h +++ b/src/TembooMQTTEdgeDevice.h @@ -3,7 +3,7 @@ # # Temboo MQTT edge device library # -# Copyright (C) 2015, Temboo Inc. +# Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,6 +23,10 @@ #ifndef TEMBOOMQTT_H_ #define TEMBOOMQTT_H_ +#ifndef TEMBOO_LIBRARY_VERSION +#define TEMBOO_LIBRARY_VERSION 2 +#endif + #include @@ -37,8 +41,11 @@ #include "utility/TembooMQTTIPStack.h" #include "utility/ChoreoInputSet.h" +#include "utility/ChoreoInputExpressionSet.h" +#include "utility/ChoreoSensorInputSet.h" #include "utility/ChoreoOutputSet.h" #include "utility/ChoreoPreset.h" +#include "utility/ChoreoDevice.h" #define IS_EMPTY(s) (NULL == s || '\0' == *s) @@ -197,8 +204,12 @@ class TembooMQTTChoreo : public Stream { const char* m_path; ChoreoInputSet m_inputs; + ChoreoInputExpressionSet m_expressions; + ChoreoSensorInputSet m_sensors; ChoreoOutputSet m_outputs; ChoreoPreset m_preset; + ChoreoDevice m_deviceType; + ChoreoDevice m_deviceName; char m_httpCodeStr[4]; volatile bool m_haveHttpCode; diff --git a/src/TembooMonitoring.cpp b/src/TembooMonitoring.cpp index f703daf..7bc820c 100644 --- a/src/TembooMonitoring.cpp +++ b/src/TembooMonitoring.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2016, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/TembooMonitoring.h b/src/TembooMonitoring.h index 962cac2..dd8cc83 100644 --- a/src/TembooMonitoring.h +++ b/src/TembooMonitoring.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2016, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,6 +23,10 @@ #ifndef TEMBOOMESSAGING_H_ #define TEMBOOMESSAGING_H_ +#ifndef TEMBOO_LIBRARY_VERSION +#define TEMBOO_LIBRARY_VERSION 2 +#endif + #include #include diff --git a/src/TembooSSL.cpp b/src/TembooSSL.cpp new file mode 100644 index 0000000..3198401 --- /dev/null +++ b/src/TembooSSL.cpp @@ -0,0 +1,51 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#if defined (ARDUINO_AVR_YUN) || defined (ARDUINO_AVR_TRE) + +#else + +#include +#include +#include +#include +#include "utility/TembooGlobal.h" +#include "utility/TembooSession.h" + +TembooChoreoSSL::TembooChoreoSSL(Client& client) : TembooChoreo(client) { + m_accountName = NULL; + m_appKeyName = NULL; + m_appKeyValue = NULL; + m_path = NULL; + m_nextChar = NULL; + m_nextState = END; +} + +int TembooChoreoSSL::run() { + return TembooChoreo::run(INADDR_NONE, 443, TEMBOO_CHOREO_DEFAULT_TIMEOUT_SECS); +} + +int TembooChoreoSSL::run(uint16_t timeoutSecs) { + return TembooChoreo::run(INADDR_NONE, 443, timeoutSecs); +} + +#endif diff --git a/src/TembooSSL.h b/src/TembooSSL.h new file mode 100644 index 0000000..1d83593 --- /dev/null +++ b/src/TembooSSL.h @@ -0,0 +1,70 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef TEMBOOSSL_H_ +#define TEMBOOSSL_H_ + +#ifndef TEMBOO_LIBRARY_VERSION +#define TEMBOO_LIBRARY_VERSION 2 +#endif + +#include + +#if defined (ARDUINO_AVR_YUN) || defined (ARDUINO_AVR_TRE) + +#include + +class TembooChoreoSSL : public TembooChoreo {}; + +#else + +/////////////////////////////////////////////////////// +// BEGIN ARDUINO NON-YUN SUPPORT FOR SSL +/////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include "utility/ChoreoInputSet.h" +#include "utility/ChoreoOutputSet.h" +#include "utility/ChoreoPreset.h" + +class TembooChoreoSSL : public TembooChoreo { + public: + + // Constructor. + // client - an instance of an Arduino Client that + // allows HTTPS conntections, usually WiFiSSL + TembooChoreoSSL(Client& client); + + // run the choreo using the current input info + // uses port 443 + int run(); + // run the choreo with a user specified timeout + // uses port 443 + int run(uint16_t timeoutSecs); +}; + +#endif //ARDUINO_AVR_YUN + +#endif //TEMBOO_H_ diff --git a/src/TembooYunShield.h b/src/TembooYunShield.h index b56d50d..4ce3993 100644 --- a/src/TembooYunShield.h +++ b/src/TembooYunShield.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,6 +23,10 @@ #ifndef TEMBOOYUNSHIELD_H_ #define TEMBOOYUNSHIELD_H_ +#ifndef TEMBOO_LIBRARY_VERSION +#define TEMBOO_LIBRARY_VERSION 2 +#endif + #include /////////////////////////////////////////////////////// diff --git a/src/utility/ArduinoTimer.h b/src/utility/ArduinoTimer.h index 48f26e2..4abd776 100644 --- a/src/utility/ArduinoTimer.h +++ b/src/utility/ArduinoTimer.h @@ -3,7 +3,7 @@ # # Temboo MQTT edge device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/BaseFormatter.cpp b/src/utility/BaseFormatter.cpp index 1e575e2..6948266 100644 --- a/src/utility/BaseFormatter.cpp +++ b/src/utility/BaseFormatter.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/BaseFormatter.h b/src/utility/BaseFormatter.h index 3d44431..87d1af2 100644 --- a/src/utility/BaseFormatter.h +++ b/src/utility/BaseFormatter.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoDevice.cpp b/src/utility/ChoreoDevice.cpp new file mode 100644 index 0000000..b98226e --- /dev/null +++ b/src/utility/ChoreoDevice.cpp @@ -0,0 +1,23 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#include "ChoreoDevice.h" diff --git a/src/utility/ChoreoDevice.h b/src/utility/ChoreoDevice.h new file mode 100644 index 0000000..a4e8391 --- /dev/null +++ b/src/utility/ChoreoDevice.h @@ -0,0 +1,42 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef CHOREODEVICE_H_ +#define CHOREODEVICE_H_ +#include +#include "TembooGlobal.h" + +// Can be used for device type or device name +class ChoreoDevice { + public: + ChoreoDevice() {m_name = NULL;} + ChoreoDevice(const char* name) {put(name);} + const char* getName() const {return m_name;} + void put(const char* name) {m_name = name;} + bool isEmpty() const {return m_name == NULL || *m_name == '\0';} + + private: + const char* m_name; + +}; + +#endif diff --git a/src/utility/ChoreoDeviceFormatter.cpp b/src/utility/ChoreoDeviceFormatter.cpp new file mode 100644 index 0000000..5dad028 --- /dev/null +++ b/src/utility/ChoreoDeviceFormatter.cpp @@ -0,0 +1,90 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#include +#include +#include "ChoreoDeviceFormatter.h" +#include "ChoreoDevice.h" + +static const char TAG_DEVICE[] PROGMEM = "\"deviceType\":"; +static const char TAG_DEVICE_NAME[] PROGMEM = "\"device\":"; + +ChoreoDeviceFormatter::ChoreoDeviceFormatter(const ChoreoDevice* device, Type type) { + m_device = device; + m_type = type; + reset(); +} + +void ChoreoDeviceFormatter::reset() { + m_nextChar = NULL; + if (m_device == NULL || m_device->isEmpty()) { + m_nextState = END; + } else { + m_nextState = START; + } +} + +bool ChoreoDeviceFormatter::hasNext() { + return m_nextState != END; +} + +char ChoreoDeviceFormatter::next() { + char c = '\0'; + switch(m_nextState) { + case START: + if (m_type == DEVICE_TYPE) { + c = readStartTagChar(TAG_DEVICE, DEVICE_TAG); + } else { + c = readStartTagChar(TAG_DEVICE_NAME, DEVICE_TAG); + } + break; + + case DEVICE_TAG: + c = readTagChar(NAME_START); + break; + + case NAME_START: + c = '"'; + m_nextChar = m_device->getName(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = NAME_END; + } else { + m_nextState = NAME; + } + break; + + case NAME: + c = readValueChar(NAME_END); + break; + + case NAME_END: + c = '"'; + m_nextState = END; + break; + + case END: + default: + c = '\0'; + } + return c; +} + diff --git a/src/utility/ChoreoDeviceFormatter.h b/src/utility/ChoreoDeviceFormatter.h new file mode 100644 index 0000000..fe7d867 --- /dev/null +++ b/src/utility/ChoreoDeviceFormatter.h @@ -0,0 +1,55 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef CHOREODEVICEFORMATTER_H_ +#define CHOREODEVICEFORMATTER_H_ +#include "TembooGlobal.h" +#include "BaseFormatter.h" +#include "ChoreoDevice.h" + +class ChoreoDeviceFormatter : public BaseFormatter { + public: + enum Type { + DEVICE_TYPE, + DEVICE_NAME + }; + + ChoreoDeviceFormatter(const ChoreoDevice* device, Type type); + bool hasNext(); + char next(); + void reset(); + + protected: + enum State { + START, + DEVICE_TAG, + NAME_START, + NAME, + NAME_END, + END + }; + + const ChoreoDevice* m_device; + Type m_type; +}; + +#endif diff --git a/src/utility/ChoreoInput.cpp b/src/utility/ChoreoInput.cpp index faf921d..8f75859 100644 --- a/src/utility/ChoreoInput.cpp +++ b/src/utility/ChoreoInput.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoInput.h b/src/utility/ChoreoInput.h index a23ca70..b20a48e 100644 --- a/src/utility/ChoreoInput.h +++ b/src/utility/ChoreoInput.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoInputExpression.cpp b/src/utility/ChoreoInputExpression.cpp new file mode 100644 index 0000000..47c8a56 --- /dev/null +++ b/src/utility/ChoreoInputExpression.cpp @@ -0,0 +1,34 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#include +#include "ChoreoInputExpression.h" + +ChoreoInputExpression::ChoreoInputExpression(ChoreoInputExpression* prev, const char* name, const char* value) { + if (prev != NULL) { + prev->m_next = this; + } + m_next = NULL; + m_name = name; + m_value = value; +} + diff --git a/src/utility/ChoreoInputExpression.h b/src/utility/ChoreoInputExpression.h new file mode 100644 index 0000000..435b5cb --- /dev/null +++ b/src/utility/ChoreoInputExpression.h @@ -0,0 +1,41 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef CHOREOINPUTEXPRESSION_H_ +#define CHOREOINPUTEXPRESSION_H_ + +#include "TembooGlobal.h" +class ChoreoInputExpression { + public: + ChoreoInputExpression(ChoreoInputExpression* prev, const char* name, const char* value); + const char* getName() const {return m_name;} + const char* getValue() const {return m_value;} + void setValue(const char* value) {m_value = value;} + ChoreoInputExpression* getNext() const {return m_next;} + + private: + ChoreoInputExpression* m_next; + const char* m_name; + const char* m_value; +}; + +#endif //CHOREOINPUTEXPRESSION_H_ \ No newline at end of file diff --git a/src/utility/ChoreoInputExpressionFormatter.cpp b/src/utility/ChoreoInputExpressionFormatter.cpp new file mode 100644 index 0000000..37d103d --- /dev/null +++ b/src/utility/ChoreoInputExpressionFormatter.cpp @@ -0,0 +1,125 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#include +#include +#include "ChoreoInputExpressionFormatter.h" +#include "ChoreoInputExpressionSet.h" + +static const char TAG_INPUTS_START[] PROGMEM = "\"inputExpressions\":{"; + +ChoreoInputExpressionFormatter::ChoreoInputExpressionFormatter(const ChoreoInputExpressionSet* inputSet) { + m_inputSet = inputSet; + reset(); +} + +void ChoreoInputExpressionFormatter::reset() { + m_currentInput = NULL; + m_nextChar = NULL; + if (m_inputSet == NULL || m_inputSet->isEmpty()) { + m_nextState = END; + } else { + m_nextState = START; + } +} + +bool ChoreoInputExpressionFormatter::hasNext() { + return m_nextState != END; +} + +char ChoreoInputExpressionFormatter::next() { + char c; + switch(m_nextState) { + case START: + c = readStartTagChar(TAG_INPUTS_START, INPUTS_TAG); + break; + + case INPUTS_TAG: + c = readTagChar(NAME_START); + if (m_nextState == NAME_START) { + m_currentInput= m_inputSet->getFirstInput(); + } + break; + + case NAME_START: + c = '"'; + m_nextChar = m_currentInput->getName(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = NAME_END; + } else { + m_nextState = NAME; + } + break; + + case NAME: + c = readValueChar(NAME_END); + break; + + case NAME_END: + c = '"'; + m_nextState = NAME_VALUE_SEPARATOR; + break; + + case NAME_VALUE_SEPARATOR: + c = ':'; + m_nextState = VALUE_START; + break; + + case VALUE_START: + c = '"'; + m_nextChar = m_currentInput->getValue(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = VALUE_END; + } else { + m_nextState = VALUE; + } + break; + + case VALUE: + c = readValueChar(VALUE_END); + break; + + case VALUE_END: + c = '"'; + m_currentInput = m_currentInput->getNext(); + if (m_currentInput != NULL) { + m_nextState = NEXT_INPUT; + } else { + m_nextState = INPUTS_END; + } + break; + case NEXT_INPUT: + c = ','; + m_nextChar = m_currentInput->getName(); + m_nextState = NAME_START; + break; + + case INPUTS_END: + c = '}'; + m_nextState = END; + break; + case END: + default: + c = '\0'; + } + return c; +} diff --git a/src/utility/ChoreoInputExpressionFormatter.h b/src/utility/ChoreoInputExpressionFormatter.h new file mode 100644 index 0000000..eb43787 --- /dev/null +++ b/src/utility/ChoreoInputExpressionFormatter.h @@ -0,0 +1,59 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef CHOREOINPUTEXPRESSIONFORMATTER_H_ +#define CHOREOINPUTEXPRESSIONFORMATTER_H_ + +#include "TembooGlobal.h" +#include "BaseFormatter.h" +#include "ChoreoInputExpressionSet.h" + +class ChoreoInputExpressionFormatter : public BaseFormatter { + + public: + ChoreoInputExpressionFormatter(const ChoreoInputExpressionSet* inputSet); + bool hasNext(); + char next(); + void reset(); + + protected: + const ChoreoInputExpressionSet* m_inputSet; + const ChoreoInputExpression* m_currentInput; + + + enum State { + START, + INPUTS_TAG, + NAME_START, + NAME, + NAME_END, + NAME_VALUE_SEPARATOR, + VALUE_START, + VALUE, + VALUE_END, + NEXT_INPUT, + INPUTS_END, + END + }; +}; + +#endif //CHOREOINPUTEXPRESSIONFORMATTER_H_ \ No newline at end of file diff --git a/src/utility/ChoreoInputExpressionSet.cpp b/src/utility/ChoreoInputExpressionSet.cpp new file mode 100644 index 0000000..b483de4 --- /dev/null +++ b/src/utility/ChoreoInputExpressionSet.cpp @@ -0,0 +1,80 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#include +#include "ChoreoInputExpressionSet.h" + +ChoreoInputExpressionSet::ChoreoInputExpressionSet() { + m_first = NULL; +} + +ChoreoInputExpressionSet::~ChoreoInputExpressionSet() { + ChoreoInputExpression* i = m_first; + ChoreoInputExpression* next = NULL; + while (i != NULL) { + next = i->getNext(); + delete i; + i = next; + } +} + +void ChoreoInputExpressionSet::put(const char* name, const char* value) { + + // Haven't set ANY inputs yet? + // Just create a new one. + if (m_first == NULL) { + m_first = new ChoreoInputExpression(NULL, name, value); + } else { + // Some inputs already set. + // See if we already have this input. + ChoreoInputExpression* last = NULL; + ChoreoInputExpression* i = m_first; + while(i != NULL) { + if (strcmp(i->getName(), name) == 0) { + // We already have an input with this name. + // Just update the value. + i->setValue(value); + break; + } + last = i; + i = i->getNext(); + } + + // We don't have an input with this name + // So we need to create a new one. + if (i == NULL) { + new ChoreoInputExpression(last, name, value); + } + } +} + +const char* ChoreoInputExpressionSet::get(const char* name) const { + ChoreoInputExpression* i = m_first; + while(i != NULL) { + if (strcmp(i->getName(), name) == 0) { + return i->getValue(); + } + i = i->getNext(); + } + return NULL; +} + diff --git a/src/utility/ChoreoInputExpressionSet.h b/src/utility/ChoreoInputExpressionSet.h new file mode 100644 index 0000000..b839709 --- /dev/null +++ b/src/utility/ChoreoInputExpressionSet.h @@ -0,0 +1,44 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef CHOREOINPUTEXPRESSIONSET_H_ +#define CHOREOINPUTEXPRESSIONSET_H_ + +#include +#include "TembooGlobal.h" +#include "ChoreoInputExpression.h" + +class ChoreoInputExpressionSet { + + public: + ChoreoInputExpressionSet(); + ~ChoreoInputExpressionSet(); + void put(const char* name, const char* value); + const char* get(const char* name) const; + bool isEmpty() const {return m_first == NULL;} + const ChoreoInputExpression* getFirstInput() const {return m_first;} + + protected: + ChoreoInputExpression* m_first; +}; + +#endif //CHOREOINPUTEXPRESSIONSET_H_ \ No newline at end of file diff --git a/src/utility/ChoreoInputFormatter.cpp b/src/utility/ChoreoInputFormatter.cpp index a54c553..6bd6390 100644 --- a/src/utility/ChoreoInputFormatter.cpp +++ b/src/utility/ChoreoInputFormatter.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoInputFormatter.h b/src/utility/ChoreoInputFormatter.h index 8946c5d..f5b676a 100644 --- a/src/utility/ChoreoInputFormatter.h +++ b/src/utility/ChoreoInputFormatter.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoInputSet.cpp b/src/utility/ChoreoInputSet.cpp index 09a9f1a..0260d8c 100644 --- a/src/utility/ChoreoInputSet.cpp +++ b/src/utility/ChoreoInputSet.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoInputSet.h b/src/utility/ChoreoInputSet.h index 123a38a..e5338f1 100644 --- a/src/utility/ChoreoInputSet.h +++ b/src/utility/ChoreoInputSet.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoOutput.cpp b/src/utility/ChoreoOutput.cpp index 63cdc5f..f04598f 100644 --- a/src/utility/ChoreoOutput.cpp +++ b/src/utility/ChoreoOutput.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoOutput.h b/src/utility/ChoreoOutput.h index 844e8b5..755f202 100644 --- a/src/utility/ChoreoOutput.h +++ b/src/utility/ChoreoOutput.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoOutputFormatter.cpp b/src/utility/ChoreoOutputFormatter.cpp index 53561cc..1d09f62 100644 --- a/src/utility/ChoreoOutputFormatter.cpp +++ b/src/utility/ChoreoOutputFormatter.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoOutputFormatter.h b/src/utility/ChoreoOutputFormatter.h index 52874a6..583e02c 100644 --- a/src/utility/ChoreoOutputFormatter.h +++ b/src/utility/ChoreoOutputFormatter.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoOutputSet.cpp b/src/utility/ChoreoOutputSet.cpp index 084fe62..6066257 100644 --- a/src/utility/ChoreoOutputSet.cpp +++ b/src/utility/ChoreoOutputSet.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoOutputSet.h b/src/utility/ChoreoOutputSet.h index 2c0fc4b..636cb00 100644 --- a/src/utility/ChoreoOutputSet.h +++ b/src/utility/ChoreoOutputSet.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoPreset.cpp b/src/utility/ChoreoPreset.cpp index 61a7850..8370705 100644 --- a/src/utility/ChoreoPreset.cpp +++ b/src/utility/ChoreoPreset.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoPreset.h b/src/utility/ChoreoPreset.h index 2ba457b..a821ea3 100644 --- a/src/utility/ChoreoPreset.h +++ b/src/utility/ChoreoPreset.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoPresetFormatter.cpp b/src/utility/ChoreoPresetFormatter.cpp index f34d181..3241a4a 100644 --- a/src/utility/ChoreoPresetFormatter.cpp +++ b/src/utility/ChoreoPresetFormatter.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoPresetFormatter.h b/src/utility/ChoreoPresetFormatter.h index 30e4a9b..ad9d8d7 100644 --- a/src/utility/ChoreoPresetFormatter.h +++ b/src/utility/ChoreoPresetFormatter.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/ChoreoSensorInput.cpp b/src/utility/ChoreoSensorInput.cpp new file mode 100644 index 0000000..691daef --- /dev/null +++ b/src/utility/ChoreoSensorInput.cpp @@ -0,0 +1,41 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#include +#include "ChoreoSensorInput.h" + +ChoreoSensorInput::ChoreoSensorInput(ChoreoSensorInput* prev, const char* name, int value, const char* sensorConversion, const char* rawLow, const char* rawHigh, const char* scaleLow, const char* scaleHigh, const char* calibration) { + if (prev != NULL) { + prev->m_next = this; + } + m_next = NULL; + m_name = name; + snprintf(m_value, TEMBOO_SENSOR_INPUT_ARRAY_SIZE, "%i",value); + m_sensorConversion = sensorConversion; + m_rawLow = rawLow; + m_rawHigh = rawHigh; + m_scaleLow = scaleLow; + m_scaleHigh = scaleHigh; + m_calibration = calibration; +} + + diff --git a/src/utility/ChoreoSensorInput.h b/src/utility/ChoreoSensorInput.h new file mode 100644 index 0000000..83e44d0 --- /dev/null +++ b/src/utility/ChoreoSensorInput.h @@ -0,0 +1,63 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef CHOREOSENSORINPUT_H_ +#define CHOREOSENSORINPUT_H_ + +#include "TembooGlobal.h" +#define TEMBOO_SENSOR_INPUT_ARRAY_SIZE 8 + +class ChoreoSensorInput { + public: + + ChoreoSensorInput(ChoreoSensorInput* prev, const char* name, int value, const char* sensorConversion, const char* rawLow, const char* rawHigh, const char* scaleLow, const char* scaleHigh, const char* calibration); + + const char* getName() const {return m_name;} + const char* getValue() const {return m_value;} + const char* getConversion() const {return m_sensorConversion;} + const char* getRawLow() const {return m_rawLow;} + const char* getRawHigh() const {return m_rawHigh;} + const char* getScaleLow() const {return m_scaleLow;} + const char* getScaleHigh() const {return m_scaleHigh;} + const char* getCalibration() const {return m_calibration;} + void setValue(int value) {snprintf(m_value, TEMBOO_SENSOR_INPUT_ARRAY_SIZE, "%i",value);} + void setConversion(const char* conversion) {m_sensorConversion = conversion;} + void setRawLow(const char* value) {m_rawLow = value;} + void setRawHigh(const char* value) {m_rawHigh = value;} + void setScaleLow(const char* value) {m_scaleLow = value;} + void setScaleHigh(const char* value) {m_scaleHigh = value;} + void setCalibration(const char* value) {m_calibration = value;} + ChoreoSensorInput* getNext() const {return m_next;} + + private: + ChoreoSensorInput* m_next; + const char* m_name; + char m_value[TEMBOO_SENSOR_INPUT_ARRAY_SIZE]; + const char* m_sensorConversion; + const char* m_rawLow; + const char* m_rawHigh; + const char* m_scaleLow; + const char* m_scaleHigh; + const char* m_calibration; +}; + +#endif //CHOREOSENSORINPUT_H_ \ No newline at end of file diff --git a/src/utility/ChoreoSensorInputFormatter.cpp b/src/utility/ChoreoSensorInputFormatter.cpp new file mode 100644 index 0000000..4769ef7 --- /dev/null +++ b/src/utility/ChoreoSensorInputFormatter.cpp @@ -0,0 +1,316 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#include +#include +#include "ChoreoSensorInputFormatter.h" +#include "ChoreoSensorInputSet.h" + +static const char TAG_INPUTS_START[] PROGMEM = "\"sensorInputs\":{"; +static const char TAG_SENSOR_NAME_SEPERATOR[] PROGMEM = "\":{"; +static const char TAG_VALUE_START[] PROGMEM = "\"value\":"; +static const char TAG_CALIBRATION_START[] PROGMEM = ",\"calibration\":"; +static const char TAG_RAW_LOW_START[] PROGMEM = ",\"rawLow\":"; +static const char TAG_RAW_HIGH_START[] PROGMEM = ",\"rawHigh\":"; +static const char TAG_SCALE_LOW_START[] PROGMEM = ",\"scaleLow\":"; +static const char TAG_SCALE_HIGH_START[] PROGMEM = ",\"scaleHigh\":"; +static const char TAG_CONVERSION_START[] PROGMEM = ",\"conversion\":"; + +ChoreoSensorInputFormatter::ChoreoSensorInputFormatter(const ChoreoSensorInputSet* inputSet) { + m_inputSet = inputSet; + reset(); +} + +void ChoreoSensorInputFormatter::reset() { + m_currentInput = NULL; + m_nextChar = NULL; + if (m_inputSet == NULL || m_inputSet->isEmpty()) { + m_nextState = END; + } else { + m_nextState = START; + } +} + +bool ChoreoSensorInputFormatter::hasNext() { + return m_nextState != END; +} + +char ChoreoSensorInputFormatter::next() { + char c; + switch(m_nextState) { + case START: + c = readStartTagChar(TAG_INPUTS_START, SENSOR_INPUT_TAG); + break; + + case SENSOR_INPUT_TAG: + c = readTagChar(SENSOR_NAME_START); + if (m_nextState == SENSOR_NAME_START) { + m_currentInput= m_inputSet->getFirstInput(); + } + break; + + case SENSOR_NAME_START: + c = '"'; + m_nextChar = m_currentInput->getName(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = SENSOR_NAME_END; + } else { + m_nextState = SENSOR_NAME; + } + break; + + case SENSOR_NAME: + c = readValueChar(SENSOR_NAME_END); + break; + + case SENSOR_NAME_END: + c = readStartTagChar(TAG_SENSOR_NAME_SEPERATOR, SENSOR_NAME_SEPERATOR); + break; + + case SENSOR_NAME_SEPERATOR: + c = readTagChar(VALUE_TAG); + if (m_nextState == VALUE_TAG) { + m_nextChar= TAG_VALUE_START; + } + break; + + case VALUE_TAG: + c = readTagChar(VALUE_START); + break; + + case VALUE_START: + c = '"'; + m_nextChar = m_currentInput->getValue(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = VALUE_END; + } else { + m_nextState = VALUE; + } + break; + + case VALUE: + c = readValueChar(VALUE_END); + break; + + case VALUE_END: + c = '"'; + // decide how the data set should be set up, with just the value, with + // a conversion, or with the user defined scale + if (m_currentInput->getCalibration() != NULL) { + m_nextChar = TAG_CALIBRATION_START; + m_nextState = CALIBRATION_TAG; + } else { + if (m_currentInput->getConversion() != NULL) { + // use conversion + m_nextState = CONVERSION_TAG; + m_nextChar = TAG_CONVERSION_START; + } else if (m_currentInput->getScaleHigh() != m_currentInput->getScaleLow()) { + // use user defined scale + m_nextState = RAW_LOW_TAG; + m_nextChar = TAG_RAW_LOW_START; + } else { + // just the value is needed + m_nextState = DATA_SET_END; + } + } + break; + + case CALIBRATION_TAG: + c = readTagChar(CALIBRATION_START); + break; + + case CALIBRATION_START: + c = '"'; + m_nextChar = m_currentInput->getCalibration(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = CALIBRATION_END; + } else { + m_nextState = CALIBRATION; + } + break; + + case CALIBRATION: + c = readValueChar(CALIBRATION_END); + break; + + case CALIBRATION_END: + c = '"'; + if (m_currentInput->getConversion() != NULL) { + // use conversion + m_nextState = CONVERSION_TAG; + m_nextChar = TAG_CONVERSION_START; + } else if (m_currentInput->getScaleHigh() != m_currentInput->getScaleLow()) { + // use user defined scale + m_nextState = RAW_LOW_TAG; + m_nextChar = TAG_RAW_LOW_START; + } else { + // just the value is needed + m_nextState = DATA_SET_END; + } + break; + + case CONVERSION_TAG: + c = readTagChar(CONVERSION_START); + break; + + case CONVERSION_START: + c = '"'; + m_nextChar = m_currentInput->getConversion(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = CONVERSION_END; + } else { + m_nextState = CONVERSION; + } + break; + + case CONVERSION: + c = readValueChar(CONVERSION_END); + break; + + case CONVERSION_END: + c = '"'; + m_nextState = DATA_SET_END; + break; + + case RAW_LOW_TAG: + c = readTagChar(RAW_LOW_START); + break; + + case RAW_LOW_START: + c = '"'; + m_nextChar = m_currentInput->getRawLow(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = RAW_LOW_END; + } else { + m_nextState = RAW_LOW; + } + break; + + case RAW_LOW: + c = readValueChar(RAW_LOW_END); + break; + + case RAW_LOW_END: + c = '"'; + m_nextState = RAW_HIGH_TAG; + m_nextChar = TAG_RAW_HIGH_START; + break; + + case RAW_HIGH_TAG: + c = readTagChar(RAW_HIGH_START); + break; + + case RAW_HIGH_START: + c = '"'; + m_nextChar = m_currentInput->getRawHigh(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = RAW_HIGH_END; + } else { + m_nextState = RAW_HIGH; + } + break; + + case RAW_HIGH: + c = readValueChar(RAW_HIGH_END); + break; + + case RAW_HIGH_END: + c = '"'; + m_nextState = SCALE_LOW_TAG; + m_nextChar = TAG_SCALE_LOW_START; + break; + + case SCALE_LOW_TAG: + c = readTagChar(SCALE_LOW_START); + break; + + case SCALE_LOW_START: + c = '"'; + m_nextChar = m_currentInput->getScaleLow(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = SCALE_LOW_END; + } else { + m_nextState = SCALE_LOW; + } + break; + + case SCALE_LOW: + c = readValueChar(SCALE_LOW_END); + break; + + case SCALE_LOW_END: + c = '"'; + m_nextState = SCALE_HIGH_TAG; + m_nextChar = TAG_SCALE_HIGH_START; + break; + + case SCALE_HIGH_TAG: + c = readTagChar(SCALE_HIGH_START); + break; + + case SCALE_HIGH_START: + c = '"'; + m_nextChar = m_currentInput->getScaleHigh(); + if ((NULL == m_nextChar) || ('\0' == *m_nextChar)) { + m_nextState = SCALE_HIGH_END; + } else { + m_nextState = SCALE_HIGH; + } + break; + + case SCALE_HIGH: + c = readValueChar(SCALE_HIGH_END); + break; + + case SCALE_HIGH_END: + c = '"'; + m_nextState = DATA_SET_END; + break; + + case DATA_SET_END: + c = '}'; + m_currentInput = m_currentInput->getNext(); + if (NULL != m_currentInput) { + m_nextState = NEXT_INPUT; + } else { + m_nextState = INPUTS_END; + } + break; + + case NEXT_INPUT: + c = ','; + m_nextChar = m_currentInput->getName(); + m_nextState = SENSOR_NAME_START; + break; + + case INPUTS_END: + c = '}'; + m_nextState = END; + break; + + case END: + default: + c = '\0'; + } + + return c; +} diff --git a/src/utility/ChoreoSensorInputFormatter.h b/src/utility/ChoreoSensorInputFormatter.h new file mode 100644 index 0000000..a0092b1 --- /dev/null +++ b/src/utility/ChoreoSensorInputFormatter.h @@ -0,0 +1,86 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef CHOREOSENSORINPUTFORMATTER_H_ +#define CHOREOSENSORINPUTFORMATTER_H_ + +#include "TembooGlobal.h" +#include "BaseFormatter.h" +#include "ChoreoSensorInputSet.h" + +class ChoreoSensorInputFormatter : public BaseFormatter { + + public: + ChoreoSensorInputFormatter(const ChoreoSensorInputSet* inputSet); + bool hasNext(); + char next(); + void reset(); + + protected: + const ChoreoSensorInputSet* m_inputSet; + const ChoreoSensorInput* m_currentInput; + + + enum State { + // This is added to fix a compilation bug for the mkr1000 + START = 256, + SENSOR_INPUT_TAG, + SENSOR_NAME_START, + SENSOR_NAME, + SENSOR_NAME_END, + SENSOR_NAME_SEPERATOR, + VALUE_TAG, + VALUE_START, + VALUE, + VALUE_END, + CALIBRATION_TAG, + CALIBRATION_START, + CALIBRATION, + CALIBRATION_END, + CONVERSION_TAG, + CONVERSION_START, + CONVERSION, + CONVERSION_END, + RAW_LOW_TAG, + RAW_LOW_START, + RAW_LOW, + RAW_LOW_END, + RAW_HIGH_TAG, + RAW_HIGH_START, + RAW_HIGH, + RAW_HIGH_END, + SCALE_LOW_TAG, + SCALE_LOW_START, + SCALE_LOW, + SCALE_LOW_END, + SCALE_HIGH_TAG, + SCALE_HIGH_START, + SCALE_HIGH, + SCALE_HIGH_END, + DATA_SET_END, + NEXT_INPUT, + INPUTS_END, + END + }; +}; + +#endif //CHOREOSENSORINPUTFORMATTER_H_ \ No newline at end of file diff --git a/src/utility/ChoreoSensorInputSet.cpp b/src/utility/ChoreoSensorInputSet.cpp new file mode 100644 index 0000000..ba452d1 --- /dev/null +++ b/src/utility/ChoreoSensorInputSet.cpp @@ -0,0 +1,86 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#include +#include "ChoreoSensorInputSet.h" + +ChoreoSensorInputSet::ChoreoSensorInputSet() { + m_first = NULL; +} + +ChoreoSensorInputSet::~ChoreoSensorInputSet() { + ChoreoSensorInput* i = m_first; + ChoreoSensorInput* next = NULL; + while (i != NULL) { + next = i->getNext(); + delete i; + i = next; + } +} + +void ChoreoSensorInputSet::put(const char* name, int value, const char* sensorConversion, const char* rawLow, const char* rawHigh, const char* scaleLow, const char* scaleHigh, const char* calibration) { + + // Haven't set ANY inputs yet? + // Just create a new one. + if (m_first == NULL) { + m_first = new ChoreoSensorInput(NULL, name, value, sensorConversion, rawLow, rawHigh, scaleLow, scaleHigh, calibration); + } else { + // Some inputs already set. + // See if we already have this input. + ChoreoSensorInput* last = NULL; + ChoreoSensorInput* i = m_first; + while(i != NULL) { + if (strcmp(i->getName(), name) == 0) { + // We already have an input with this name. + // Just update the value. + i->setValue(value); + i->setConversion(sensorConversion); + i->setRawLow(rawLow); + i->setRawHigh(rawHigh); + i->setScaleLow(scaleLow); + i->setScaleHigh(scaleHigh); + i->setCalibration(calibration); + break; + } + last = i; + i = i->getNext(); + } + + // We don't have an input with this name + // So we need to create a new one. + if (i == NULL) { + new ChoreoSensorInput(last, name, value, sensorConversion, rawLow, rawHigh, scaleLow, scaleHigh, calibration); + } + } +} + +const char* ChoreoSensorInputSet::get(const char* name) const { + ChoreoSensorInput* i = m_first; + while(i != NULL) { + if (strcmp(i->getName(), name) == 0) { + return i->getValue(); + } + i = i->getNext(); + } + return NULL; +} + diff --git a/src/utility/ChoreoSensorInputSet.h b/src/utility/ChoreoSensorInputSet.h new file mode 100644 index 0000000..086f348 --- /dev/null +++ b/src/utility/ChoreoSensorInputSet.h @@ -0,0 +1,44 @@ +/* +############################################################################### +# +# Temboo Arduino library +# +# Copyright 2017, Temboo Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +# +############################################################################### +*/ + +#ifndef CHOREOSENSORINPUTSET_H_ +#define CHOREOSENSORINPUTSET_H_ + +#include +#include "TembooGlobal.h" +#include "ChoreoSensorInput.h" + +class ChoreoSensorInputSet { + + public: + ChoreoSensorInputSet(); + ~ChoreoSensorInputSet(); + void put(const char* name, int value, const char* sensorConversion, const char* rawLow, const char* rawHigh, const char* scaleLow, const char* scaleHigh, const char* calibration); + const char* get(const char* name) const; + bool isEmpty() const {return m_first == NULL;} + const ChoreoSensorInput* getFirstInput() const {return m_first;} + + protected: + ChoreoSensorInput* m_first; +}; + +#endif //CHOREOSENSORINPUTSET_H_ \ No newline at end of file diff --git a/src/utility/CoapMessageLayer.cpp b/src/utility/CoapMessageLayer.cpp index d3aacf4..d8971b5 100644 --- a/src/utility/CoapMessageLayer.cpp +++ b/src/utility/CoapMessageLayer.cpp @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/CoapMessageLayer.h b/src/utility/CoapMessageLayer.h index d9b5b74..47db3c8 100644 --- a/src/utility/CoapMessageLayer.h +++ b/src/utility/CoapMessageLayer.h @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/CoapMsg.cpp b/src/utility/CoapMsg.cpp index 5743aac..19a9616 100644 --- a/src/utility/CoapMsg.cpp +++ b/src/utility/CoapMsg.cpp @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/CoapMsg.h b/src/utility/CoapMsg.h index fd64b35..9733de7 100644 --- a/src/utility/CoapMsg.h +++ b/src/utility/CoapMsg.h @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/CoapRRLayer.cpp b/src/utility/CoapRRLayer.cpp index f146dd9..6c4a892 100644 --- a/src/utility/CoapRRLayer.cpp +++ b/src/utility/CoapRRLayer.cpp @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/CoapRRLayer.h b/src/utility/CoapRRLayer.h index e84c04b..1e514d7 100644 --- a/src/utility/CoapRRLayer.h +++ b/src/utility/CoapRRLayer.h @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/DataFormatter.cpp b/src/utility/DataFormatter.cpp index f5cdf98..9a89ea7 100644 --- a/src/utility/DataFormatter.cpp +++ b/src/utility/DataFormatter.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,15 +23,18 @@ #include "DataFormatter.h" -DataFormatter::DataFormatter( - const ChoreoInputSet* inputSet, - const ChoreoOutputSet* outputSet, - const ChoreoPreset* preset) : - m_inputFormatter(inputSet), +DataFormatter::DataFormatter(const ChoreoInputSet* inputSet, const ChoreoInputExpressionSet* expressionSet, const ChoreoSensorInputSet* sensorSet, const ChoreoOutputSet* outputSet, const ChoreoPreset* preset, const ChoreoDevice* device, const ChoreoDevice* deviceName) : + m_inputFormatter(inputSet), + m_expressionFormatter(expressionSet), + m_sensorFormatter(sensorSet), m_outputFormatter(outputSet), - m_presetFormatter(preset) { + m_presetFormatter(preset), + m_deviceTypeFormatter(device, ChoreoDeviceFormatter::DEVICE_TYPE), + m_deviceNameFormatter(deviceName, ChoreoDeviceFormatter::DEVICE_NAME) { m_inputSet = inputSet; + m_expressionSet = expressionSet; + m_sensorSet = sensorSet; m_outputSet = outputSet; m_preset = preset; @@ -41,8 +44,12 @@ DataFormatter::DataFormatter( void DataFormatter::reset() { m_nextState = DATA_START; m_inputFormatter.reset(); + m_expressionFormatter.reset(); + m_sensorFormatter.reset(); m_outputFormatter.reset(); m_presetFormatter.reset(); + m_deviceTypeFormatter.reset(); + m_deviceNameFormatter.reset(); } bool DataFormatter::hasNext() { @@ -54,19 +61,123 @@ char DataFormatter::next() { switch(m_nextState) { case DATA_START: c = '{'; - if (m_inputFormatter.hasNext()) { + // only add device type or device name if + // sensor data is being sent with the Choreo + // If device name is added, no need to send + // device type + if (m_sensorFormatter.hasNext()) { + if (m_deviceNameFormatter.hasNext()) { + m_nextState = FORMATTING_DEVICE_NAME; + } else if (m_deviceTypeFormatter.hasNext()) { + m_nextState = FORMATTING_DEVICE_TYPE; + } + } else { + if (m_inputFormatter.hasNext()) { + m_nextState = FORMATTING_INPUTS; + } else if (m_expressionFormatter.hasNext()) { + m_nextState = FORMATTING_EXPRESSIONS; + } else if (m_sensorFormatter.hasNext()) { + m_nextState = FORMATTING_SENSORS; + } else if (m_outputFormatter.hasNext()) { + m_nextState = FORMATTING_OUTPUTS; + } else if (m_presetFormatter.hasNext()) { + m_nextState = FORMATTING_PRESET; + } else { + m_nextState = FORMATTING_EMPTY; + } + } + break; + + case FORMATTING_DEVICE_TYPE: + if (m_deviceTypeFormatter.hasNext()) { + c = m_deviceTypeFormatter.next(); + } else if (m_inputFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_INPUTS; + } else if (m_expressionFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_EXPRESSIONS; + } else if (m_sensorFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_SENSORS; + } else if (m_outputFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_OUTPUTS; + } else if (m_presetFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_PRESET; + } else { + c = '}'; + m_nextState = DATA_END; + } + break; + + case FORMATTING_DEVICE_NAME: + if (m_deviceNameFormatter.hasNext()) { + c = m_deviceNameFormatter.next(); + } else if (m_inputFormatter.hasNext()) { + c = ','; m_nextState = FORMATTING_INPUTS; + } else if (m_expressionFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_EXPRESSIONS; + } else if (m_sensorFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_SENSORS; } else if (m_outputFormatter.hasNext()) { + c = ','; m_nextState = FORMATTING_OUTPUTS; } else if (m_presetFormatter.hasNext()) { + c = ','; m_nextState = FORMATTING_PRESET; } else { - m_nextState = FORMATTING_EMPTY; + c = '}'; + m_nextState = DATA_END; } break; + case FORMATTING_INPUTS: if (m_inputFormatter.hasNext()) { c = m_inputFormatter.next(); + } else if (m_expressionFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_EXPRESSIONS; + } else if (m_sensorFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_SENSORS; + } else if (m_outputFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_OUTPUTS; + } else if (m_presetFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_PRESET; + } else { + c = '}'; + m_nextState = DATA_END; + } + break; + + case FORMATTING_EXPRESSIONS: + if (m_expressionFormatter.hasNext()) { + c = m_expressionFormatter.next(); + } else if (m_sensorFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_SENSORS; + } else if (m_outputFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_OUTPUTS; + } else if (m_presetFormatter.hasNext()) { + c = ','; + m_nextState = FORMATTING_PRESET; + } else { + c = '}'; + m_nextState = DATA_END; + } + break; + + case FORMATTING_SENSORS: + if (m_sensorFormatter.hasNext()) { + c = m_sensorFormatter.next(); } else if (m_outputFormatter.hasNext()) { c = ','; m_nextState = FORMATTING_OUTPUTS; @@ -78,6 +189,7 @@ char DataFormatter::next() { m_nextState = DATA_END; } break; + case FORMATTING_OUTPUTS: if (m_outputFormatter.hasNext()) { c = m_outputFormatter.next(); diff --git a/src/utility/DataFormatter.h b/src/utility/DataFormatter.h index 542c821..a96b786 100644 --- a/src/utility/DataFormatter.h +++ b/src/utility/DataFormatter.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,35 +24,52 @@ #define DATAFORMATTER_H_ #include "TembooGlobal.h" #include "ChoreoInputSet.h" +#include "ChoreoInputExpressionSet.h" +#include "ChoreoSensorInputSet.h" #include "ChoreoOutputSet.h" #include "ChoreoPreset.h" +#include "ChoreoDevice.h" #include "ChoreoInputFormatter.h" +#include "ChoreoInputExpressionFormatter.h" +#include "ChoreoSensorInputFormatter.h" #include "ChoreoOutputFormatter.h" #include "ChoreoPresetFormatter.h" +#include "ChoreoDeviceFormatter.h" + class DataFormatter { public: - DataFormatter(const ChoreoInputSet* inputSet, const ChoreoOutputSet* outputSet, const ChoreoPreset* preset); + DataFormatter(const ChoreoInputSet* inputSet, const ChoreoInputExpressionSet* expressionSet, const ChoreoSensorInputSet* sensorSet, const ChoreoOutputSet* outputSet, const ChoreoPreset* preset, const ChoreoDevice* device, const ChoreoDevice* deviceName); bool hasNext(); char next(); void reset(); private: const ChoreoInputSet* m_inputSet; + const ChoreoSensorInputSet* m_sensorSet; + const ChoreoInputExpressionSet* m_expressionSet; const ChoreoOutputSet* m_outputSet; const ChoreoPreset* m_preset; ChoreoInputFormatter m_inputFormatter; + ChoreoInputExpressionFormatter m_expressionFormatter; + ChoreoSensorInputFormatter m_sensorFormatter; ChoreoOutputFormatter m_outputFormatter; ChoreoPresetFormatter m_presetFormatter; + ChoreoDeviceFormatter m_deviceTypeFormatter; + ChoreoDeviceFormatter m_deviceNameFormatter; enum State { DATA_START, FORMATTING_INPUTS, + FORMATTING_EXPRESSIONS, + FORMATTING_SENSORS, FORMATTING_OUTPUTS, FORMATTING_PRESET, + FORMATTING_DEVICE_TYPE, + FORMATTING_DEVICE_NAME, FORMATTING_EMPTY, DATA_END }; diff --git a/src/utility/TembooCoAPIPStack.h b/src/utility/TembooCoAPIPStack.h index de412b0..6d01aca 100644 --- a/src/utility/TembooCoAPIPStack.h +++ b/src/utility/TembooCoAPIPStack.h @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooCoAPSession.cpp b/src/utility/TembooCoAPSession.cpp index efdcc22..830ab70 100644 --- a/src/utility/TembooCoAPSession.cpp +++ b/src/utility/TembooCoAPSession.cpp @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -72,11 +72,15 @@ int TembooCoAPSession::executeChoreo( const char* appKeyName, const char* appKeyValue, const char* path, - const ChoreoInputSet& inputSet, - const ChoreoOutputSet& outputSet, - const ChoreoPreset& preset) { - - DataFormatter fmt(&inputSet, &outputSet, &preset); + const ChoreoInputSet& inputSet, + const ChoreoInputExpressionSet& expressionSet, + const ChoreoSensorInputSet& sensorSet, + const ChoreoOutputSet& outputSet, + const ChoreoPreset& preset, + const ChoreoDevice& deviceType, + const ChoreoDevice& deviceName){ + + DataFormatter fmt(&inputSet, &expressionSet, &sensorSet,&outputSet, &preset, &deviceType, &deviceName); char auth[HMAC_HEX_SIZE_BYTES + 1]; char timeStr[11]; char requestIdStr[5]; diff --git a/src/utility/TembooCoAPSession.h b/src/utility/TembooCoAPSession.h index f34ca6c..1f6f0b8 100644 --- a/src/utility/TembooCoAPSession.h +++ b/src/utility/TembooCoAPSession.h @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,10 +65,14 @@ class TembooCoAPSession { const char* appKeyName, const char* appKeyValue, const char* path, - const ChoreoInputSet& inputSet, - const ChoreoOutputSet& outputSet, - const ChoreoPreset& preset); - + const ChoreoInputSet& inputSet, + const ChoreoInputExpressionSet& expressionSet, + const ChoreoSensorInputSet& sensorSet, + const ChoreoOutputSet& outputSet, + const ChoreoPreset& preset, + const ChoreoDevice& deviceType, + const ChoreoDevice& deviceName); + // setTime sets the current time in Unix timestamp format. Needed for execution request authentication. // NOTE: This method is usually called by TembooChoreo.run() with the current time returned by // an error response from the Temboo system, thus automatically setting the time. However, it diff --git a/src/utility/TembooDS18B20.cpp b/src/utility/TembooDS18B20.cpp index 236c927..6795021 100644 --- a/src/utility/TembooDS18B20.cpp +++ b/src/utility/TembooDS18B20.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2016, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooDS18B20.h b/src/utility/TembooDS18B20.h index 6e955b8..10ba395 100644 --- a/src/utility/TembooDS18B20.h +++ b/src/utility/TembooDS18B20.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2016, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooGPIO.c b/src/utility/TembooGPIO.c index 48906f6..1e0ba81 100644 --- a/src/utility/TembooGPIO.c +++ b/src/utility/TembooGPIO.c @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2016, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooGPIO.h b/src/utility/TembooGPIO.h index 2381b2b..6b9b449 100644 --- a/src/utility/TembooGPIO.h +++ b/src/utility/TembooGPIO.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2016, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooGlobal.c b/src/utility/TembooGlobal.c index 63163c1..05f6759 100644 --- a/src/utility/TembooGlobal.c +++ b/src/utility/TembooGlobal.c @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooGlobal.h b/src/utility/TembooGlobal.h index acb8943..15a3b0d 100644 --- a/src/utility/TembooGlobal.h +++ b/src/utility/TembooGlobal.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooMQTTIPStack.h b/src/utility/TembooMQTTIPStack.h index 8282341..000c637 100644 --- a/src/utility/TembooMQTTIPStack.h +++ b/src/utility/TembooMQTTIPStack.h @@ -3,7 +3,7 @@ # # Temboo MQTT edge device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooMQTTSession.cpp b/src/utility/TembooMQTTSession.cpp index 50e59f9..930b684 100644 --- a/src/utility/TembooMQTTSession.cpp +++ b/src/utility/TembooMQTTSession.cpp @@ -3,7 +3,7 @@ # # Temboo MQTT edge device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -54,10 +54,14 @@ int TembooMQTTSession::executeChoreo( const char* appKeyValue, const char* path, const ChoreoInputSet& inputSet, + const ChoreoInputExpressionSet& expressionSet, + const ChoreoSensorInputSet& sensorSet, const ChoreoOutputSet& outputSet, - const ChoreoPreset& preset) { + const ChoreoPreset& preset, + const ChoreoDevice& deviceType, + const ChoreoDevice& deviceName) { - DataFormatter fmt(&inputSet, &outputSet, &preset); + DataFormatter fmt(&inputSet, &expressionSet, &sensorSet,&outputSet, &preset, &deviceType, &deviceName); char auth[HMAC_HEX_SIZE_BYTES + 1]; char timeStr[11]; char requestIdStr[5]; diff --git a/src/utility/TembooMQTTSession.h b/src/utility/TembooMQTTSession.h index 87b2fb7..236feb8 100644 --- a/src/utility/TembooMQTTSession.h +++ b/src/utility/TembooMQTTSession.h @@ -3,7 +3,7 @@ # # Temboo MQTT edge device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,8 +66,12 @@ class TembooMQTTSession { const char* appKeyValue, const char* path, const ChoreoInputSet& inputSet, + const ChoreoInputExpressionSet& expressionSet, + const ChoreoSensorInputSet& sensorSet, const ChoreoOutputSet& outputSet, - const ChoreoPreset& preset); + const ChoreoPreset& preset, + const ChoreoDevice& deviceType, + const ChoreoDevice& deviceName); // setTime sets the current time in Unix timestamp format. Needed for execution request authentication. // NOTE: This method is usually called by TembooChoreo.run() with the current time returned by diff --git a/src/utility/TembooSession.cpp b/src/utility/TembooSession.cpp index 4e7d089..890056d 100644 --- a/src/utility/TembooSession.cpp +++ b/src/utility/TembooSession.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,7 +40,8 @@ static const char BASE_CHOREO_URI[] PROGMEM = "/arcturus-web/api-1.0/ar"; static const char HEADER_AUTH[] PROGMEM = "x-temboo-authentication: "; static const char HEADER_CONTENT_TYPE[] PROGMEM = "Content-Type: text/plain"; static const char TEMBOO_DOMAIN[] PROGMEM = ".temboolive.com"; -static const char SDK_ID[] PROGMEM = "?source_id=arduinoSDK1"; +static const char SDK_ID[] PROGMEM = "?source_id="; +static const char SDK_ID_DEFAULT[] PROGMEM = "ArduinoSDK1.2.0"; static const char HTTP[] PROGMEM = "http://"; unsigned long TembooSession::s_timeOffset = 0; @@ -71,10 +72,14 @@ int TembooSession::executeChoreo( const char* appKeyValue, const char* path, const ChoreoInputSet& inputSet, + const ChoreoInputExpressionSet& expressionSet, + const ChoreoSensorInputSet& sensorSet, const ChoreoOutputSet& outputSet, - const ChoreoPreset& preset) { + const ChoreoPreset& preset, + const ChoreoDevice& deviceType, + const ChoreoDevice& deviceName) { - DataFormatter fmt(&inputSet, &outputSet, &preset); + DataFormatter fmt(&inputSet, &expressionSet, &sensorSet,&outputSet, &preset, &deviceType, &deviceName); char auth[HMAC_HEX_SIZE_BYTES + 1]; char buffer[11]; @@ -128,6 +133,11 @@ int TembooSession::executeChoreo( qsendProgmem(BASE_CHOREO_URI); qsend(path); qsendProgmem(SDK_ID); + if (deviceType.isEmpty()) { + qsendProgmem(SDK_ID_DEFAULT); + } else { + qsend(deviceType.getName()); + } qsendlnProgmem(POSTAMBLE); // Send our custom authentication header diff --git a/src/utility/TembooSession.h b/src/utility/TembooSession.h index 635467f..707898d 100644 --- a/src/utility/TembooSession.h +++ b/src/utility/TembooSession.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -41,8 +41,11 @@ #endif class ChoreoInputSet; +class ChoreoInputExpressionSet; +class ChoreoSensorInputSet; class ChoreoOutputSet; class ChoreoPreset; +class ChoreoDevice; class DataFormatter; class TembooSession { @@ -74,8 +77,12 @@ class TembooSession { const char* appKeyValue, const char* path, const ChoreoInputSet& inputSet, + const ChoreoInputExpressionSet& expressionSet, + const ChoreoSensorInputSet& sensorSet, const ChoreoOutputSet& outputSet, - const ChoreoPreset& preset); + const ChoreoPreset& preset, + const ChoreoDevice& deviceType, + const ChoreoDevice& deviceName); // setTime sets the current time in Unix timestamp format. Needed for execution request authentication. // NOTE: This method is usually called by TembooChoreo.run() with the current time returned by diff --git a/src/utility/TembooTags.h b/src/utility/TembooTags.h index 22cf2f5..de2fa05 100644 --- a/src/utility/TembooTags.h +++ b/src/utility/TembooTags.h @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library for Arduino # -# Copyright (C) 2014, 2015 Temboo Inc. +# Copyright (C) 2017 Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooTimer.h b/src/utility/TembooTimer.h index f2b444f..47f2d53 100644 --- a/src/utility/TembooTimer.h +++ b/src/utility/TembooTimer.h @@ -3,7 +3,7 @@ # # Temboo CoAP Edge Device library # - # Copyright (C) 2015, Temboo Inc. + # Copyright (C) 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooWebSocketRequestHandles.c b/src/utility/TembooWebSocketRequestHandles.c index 3e570f6..d204446 100644 --- a/src/utility/TembooWebSocketRequestHandles.c +++ b/src/utility/TembooWebSocketRequestHandles.c @@ -3,7 +3,7 @@ # # Temboo library # -# Copyright 2016, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/TembooWebSocketRequestHandles.h b/src/utility/TembooWebSocketRequestHandles.h index c7d2ff9..081e306 100644 --- a/src/utility/TembooWebSocketRequestHandles.h +++ b/src/utility/TembooWebSocketRequestHandles.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2016, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/tmbhmac.cpp b/src/utility/tmbhmac.cpp index 9e23763..effd88a 100644 --- a/src/utility/tmbhmac.cpp +++ b/src/utility/tmbhmac.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/tmbhmac.h b/src/utility/tmbhmac.h index 028b2bd..3924b0e 100644 --- a/src/utility/tmbhmac.h +++ b/src/utility/tmbhmac.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/tmbmd5.cpp b/src/utility/tmbmd5.cpp index fe8d7a9..1585514 100644 --- a/src/utility/tmbmd5.cpp +++ b/src/utility/tmbmd5.cpp @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/utility/tmbmd5.h b/src/utility/tmbmd5.h index 9c22c43..0024a7f 100644 --- a/src/utility/tmbmd5.h +++ b/src/utility/tmbmd5.h @@ -3,7 +3,7 @@ # # Temboo Arduino library # -# Copyright 2015, Temboo Inc. +# Copyright 2017, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.