Skip to content

Commit

Permalink
Version 1.1.3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbuck-temboo committed Sep 16, 2015
1 parent a71b352 commit a56d05f
Show file tree
Hide file tree
Showing 46 changed files with 8,520 additions and 120 deletions.
12 changes: 11 additions & 1 deletion README.adoc
@@ -1,6 +1,6 @@
= Temboo Library for Arduino =

This library allows an Arduino Yun to connect to the Temboo service.
This library allows an Arduino to connect to the Temboo service.

== License ==

Expand All @@ -17,3 +17,13 @@ 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.

--------------------------------------------------------------
This library includes elements of the Paho MQTT client, used
with permission under the Eclipse Public License - v1.0
(http://www.eclipse.org/legal/epl-v10.html) and the Eclipse Distribution
License v1.0 (http://www.eclipse.org/org/documents/edl-v10.php).
The Eclipse MQTT Paho client source is available here:
http://www.eclipse.org/paho/
31 changes: 0 additions & 31 deletions extras/readme.txt

This file was deleted.

5 changes: 5 additions & 0 deletions keywords.txt
Expand Up @@ -7,12 +7,16 @@
#######################################

Temboo KEYWORD1
TembooMQTTEdgeDevice KEYWORD1
TembooCoAPEdgeDevice KEYWORD1

#######################################
# Datatypes (KEYWORD2)
#######################################

TembooChoreo KEYWORD2
TembooCoAPChoreo KEYWORD2
TembooMQTTChoreo KEYWORD2

#######################################
# Methods and Functions (KEYWORD2)
Expand All @@ -29,3 +33,4 @@ addInput KEYWORD2
addOutputFilter KEYWORD2
setSettingsFileToWrite KEYWORD2
setSettingsFileToRead KEYWORD2
setGatewayAddress KEYWORD2
2 changes: 1 addition & 1 deletion library.properties
Expand Up @@ -6,5 +6,5 @@ paragraph=Use this library to connect your Arduino board to Temboo, making it si
category=Communication
url=http://www.temboo.com/arduino
architectures=*
version=1.1.2
version=1.1.3
core-dependencies=arduino (>=1.5.0)
63 changes: 10 additions & 53 deletions src/Temboo.cpp
Expand Up @@ -24,60 +24,9 @@
#if defined (ARDUINO_AVR_YUN) || defined (ARDUINO_AVR_TRE)

///////////////////////////////////////////////////////
// BEGIN ARDUINO YUN AND TRE SUPPORT
// ARDUINO YUN AND TRE SUPPORT IN HEADER FILE
///////////////////////////////////////////////////////

#include <Temboo.h>

void TembooChoreo::begin() {
Process::begin("temboo");
}

void TembooChoreo::setAccountName(const String& accountName) {
addParameter("-a" + accountName);
}

void TembooChoreo::setAppKeyName(const String& appKeyName) {
addParameter("-u" + appKeyName);
}

void TembooChoreo::setAppKey(const String& appKey) {
addParameter("-p" + appKey);
}

void TembooChoreo::setChoreo(const String& choreo) {
addParameter("-c" + choreo);
}

void TembooChoreo::setCredential(const String& credentialName) {
addParameter("-e" + credentialName);
}

void TembooChoreo::setSavedInputs(const String& savedInputsName) {
addParameter("-e" + savedInputsName);
}

void TembooChoreo::setProfile(const String& profileName) {
addParameter("-e" + profileName);
}

void TembooChoreo::addInput(const String& inputName, const String& inputValue) {
addParameter("-i" + inputName + ":" + inputValue);
}

void TembooChoreo::addOutputFilter(const String& outputName, const String& filterPath, const String& variableName) {
addParameter("-o" + outputName + ":" + filterPath + ":" + variableName);
}

void TembooChoreo::setSettingsFileToWrite(const String& filePath) {
addParameter("-w" + filePath);
}

void TembooChoreo::setSettingsFileToRead(const String& filePath) {
addParameter("-r" + filePath);
}


#else //ARDUINO_AVR_YUN

///////////////////////////////////////////////////////
Expand Down Expand Up @@ -241,6 +190,10 @@ int TembooChoreo::run(uint16_t timeoutSecs) {
return run(INADDR_NONE, 80, timeoutSecs);
}

int TembooChoreo::run(IPAddress addr, uint16_t port) {
return run(addr, port, TEMBOO_CHOREO_DEFAULT_TIMEOUT_SECS);
}

int TembooChoreo::run(IPAddress addr, uint16_t port, uint16_t timeoutSecs) {

m_nextChar = NULL;
Expand Down Expand Up @@ -351,7 +304,11 @@ int TembooChoreo::peek() {
// If we're still sending the HTTP response code,
// return the next character in that sequence.
if (m_nextChar != NULL) {
return (int)*m_nextChar;
if(m_nextState != HTTP_CODE_VALUE) {
return (int)pgm_read_byte(m_nextChar);
} else {
return (int)*m_nextChar;
}
}

// Otherwise, return whatever is in the client buffer.
Expand Down
33 changes: 18 additions & 15 deletions src/Temboo.h
Expand Up @@ -35,18 +35,20 @@
class TembooChoreo : public Process {

public:
void begin();
void setAccountName(const String& accountName);
void setAppKeyName(const String& appKeyName);
void setAppKey(const String& appKey);
void setChoreo(const String& choreo);
void setCredential(const String& credentialName);
void setSavedInputs(const String& saveInputsName);
void setProfile(const String& profileName);
void addInput(const String& inputName, const String& inputValue);
void addOutputFilter(const String& filterName, const String& filterPath, const String& variableName);
void setSettingsFileToWrite(const String& filePath);
void setSettingsFileToRead(const String& filePath);
void begin() {Process::begin("temboo");}
void setAccountName(const String& accountName) { addParameter("-a" + accountName);}
void setAppKeyName(const String& appKeyName) { addParameter("-u" + appKeyName);}
void setAppKey(const String& appKey) { addParameter("-p" + appKey);}
void setChoreo(const String& choreo) { addParameter("-c" + choreo);}
void setCredential(const String& credentialName) { addParameter("-e" + credentialName);}
void setSavedInputs(const String& savedInputsName) { addParameter("-e" + savedInputsName);}
void setProfile(const String& profileName) { addParameter("-e" + profileName);}
void addInput(const String& inputName, const String& inputValue) { addParameter("-i" + inputName + ":" + inputValue);}
void addOutputFilter(const String& filterName, const String& filterPath, const String& variableName) { addParameter("-o" + filterName + ":" + filterPath + ":" + variableName);}
void setSettingsFileToWrite(const String& filePath) { addParameter("-w" + filePath);}
void setSettingsFileToRead(const String& filePath) { addParameter("-r" + filePath);}
unsigned int setGatewayAddress(const String& addr) { addParameter("-s" + addr);}


};

Expand Down Expand Up @@ -134,10 +136,11 @@ class TembooChoreo : public Stream {

// run the choreo using the current input info
int run();

// run the choreo on the Temboo server at the given IP address and port
// (used only when instructed by Temboo customer support.)
// run the choreo with a user specified timeout
int run(uint16_t timeoutSecs);

// run the choreo on the Temboo server at the given IP address and port
int run(IPAddress addr, uint16_t port);
int run(IPAddress addr, uint16_t port, uint16_t timeoutSecs);

void close();
Expand Down

0 comments on commit a56d05f

Please sign in to comment.