Skip to content

Commit

Permalink
Docs updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kcech committed May 9, 2019
1 parent 951e706 commit dec24aa
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 31 deletions.
1 change: 1 addition & 0 deletions docs/clients.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Sentilo using various existing platforms and languages.
+-----------------------------------+
| |raspberrypi.jpeg| |
| `RaspberryPi Client`_ |
| |
| .. raw:: html |
| |
| </div> |
Expand Down
58 changes: 29 additions & 29 deletions docs/clients/arduino_client.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Arduino Client
==============

.. figure:: _static/images/clients/arduino-mega-2560-r3.jpg
.. figure:: /_static/images/tutorials/arduino-mega-2560-r3.jpg
:alt: Arduino

The **SentiloClient Library** for Arduino offers a basic C++ library
Expand Down Expand Up @@ -109,10 +109,10 @@ You must have configured this information in the Sentilo catalog:

::

sensor = sample-sensor-arduino-01
type = status
dataType = TEXT
component = sample-component
sensor = sample-sensor-arduino-01
type = status
dataType = TEXT
component = sample-component
componentType = generic

Then, you must replace the client connection data code (next section)
Expand Down Expand Up @@ -179,11 +179,11 @@ You’ll should see this code in the editor:
observation.value = "This is a sample observation";
Serial.println("[loop] Publishing a sample observation...");
// Publish the observation to Sentilo Platform
statusCode = sentiloClient.publishObservation(providerId, sensorId, observation, apiKey, response);
// Read response status and show an error if it is necessary
// Read response status and show an error if it is necessary
if (statusCode !## 200) {
Serial.print("[loop] [ERROR] Status code from server after publish the observations: ");
Serial.println(statusCode);
Expand All @@ -193,7 +193,7 @@ You’ll should see this code in the editor:
Serial.println("[loop] Sample observation published!");
Serial.println("[loop] Program ended");
// The example has ended, so we are going to execute an infinite loop
while (true) {}
}
Expand Down Expand Up @@ -343,16 +343,16 @@ You should see this code in the editor:
}
void loop() {
// Get the LDR value
// Get the LDR value
int ldrValue = getLdrValue();
// Get the LM35 value
float lm35Value = getLM35Value();
// Create the observation input message like this: {"ldr":"234","lm35":"24.5"}
String obsInputMsg =
"{\\\"ldr\\\":\\\"" + String(ldrValue) +
"\\\",\\\"lm35\\\":\\\"" + String(lm35Value) +
String obsInputMsg =
"{\\\"ldr\\\":\\\"" + String(ldrValue) +
"\\\",\\\"lm35\\\":\\\"" + String(lm35Value) +
"\\\"}";
int bufLength = obsInputMsg.length() + 1;
char obsMsgBuffer[bufLength];
Expand All @@ -365,7 +365,7 @@ You should see this code in the editor:
// Debug on Serial the observations value. Note that we must scape special characters
Serial.print("[loop] Publishing actual sensors values as observations: ");
Serial.println(obsMsgBuffer);
// Publish the observation to Sentilo Platform
statusCode = sentiloClient.publishObservation(providerId, sensorId, observation, apiKey, response);
Expand Down Expand Up @@ -444,7 +444,7 @@ the first example.
- Once we’ve retrieved the sensors data, we’re mounting the new
observation message, with value:
``{"ldr":"{ldrValue}","lm35":"{lm35Value}"}``

- The SentiloClient library gets the value and transforms it on a
complete **observation message** using the **publishObservation**
method (see below)
Expand Down Expand Up @@ -556,11 +556,11 @@ You should see this code in the editor:
// Setup the LM35 sensor
setupLM35();
// Setup the Sentilo Client
// Setup the Sentilo Client
// and network connection
setupSetiloClient();
// Setup the Sentilo sensor
// Setup the Sentilo sensor
// and create it if doesn't exists
setupSentiloSensor();
Expand All @@ -570,20 +570,20 @@ You should see this code in the editor:
void loop() {
if (existsSensor) {
// If the sensor exists,
// If the sensor exists,
// we can start publishing observations
// Get the LDR value
// Get the LDR value
int ldrValue = getLdrValue();
// Get the LM35 value
float lm35Value = getLM35Value();
// Create the observation input message
// like this: {"ldr":"234","lm35":"24.5"}
String obsInputMsg =
"{\\\"ldr\\\":\\\"" + String(ldrValue) +
"\\\",\\\"lm35\\\":\\\"" + String(lm35Value) +
String obsInputMsg =
"{\\\"ldr\\\":\\\"" + String(ldrValue) +
"\\\",\\\"lm35\\\":\\\"" + String(lm35Value) +
"\\\"}";
int bufLength = obsInputMsg.length() + 1;
char obsMsgBuffer[bufLength];
Expand All @@ -597,7 +597,7 @@ You should see this code in the editor:
// Note that the message includes slashes (\) because we must scape special characters as "
Serial.print("[loop] Publishing actual sensors values as observations: ");
Serial.println(obsMsgBuffer);
// Publish the observation to Sentilo Platform
statusCode = sentiloClient.publishObservation(providerId, sensorId, observation, apiKey, response);
Expand All @@ -610,11 +610,11 @@ You should see this code in the editor:
} else {
Serial.println("[loop] Sensors observations published!");
}
// Waiting for the next loop
delay(loopTimeout);
} else {
// If the sensor does not exist and it could
// If the sensor does not exist and it could
// not be created in the catalog, we must stop running
Serial.println("[loop] [ERROR] Oops! The sensor doesn't exists, so I can't publish data to it...");
Serial.println("[loop] [ERROR] I'm sorry with you, but now I'm going to halt...");
Expand Down Expand Up @@ -781,19 +781,19 @@ library tansforms this object in a JSON message like this:
{"sensors":[{
"sensor":"sample-sensor-arduino-03",
"description":"",
"type":"status",
"type":"status",
"dataType":"TEXT",
"unit":"",
"component":"sample-component",
"component":"sample-component",
"componentType":"generic",
"componentDesc":"",
"location":"41,385063 2,1734034",
"timeZone":"CET"
"timeZone":"CET"
}]
}
As you can see, the type is generic and the data type is text, because
this is the best way to publish any data without any format problem.


.. |arduino_sensors_board.png| image:: ../_static/images/clients/arduino_sensors_board.png
.. |arduino_sensors_board.png| image:: ../_static/images/tutorials/arduino_sensors_board.png
2 changes: 1 addition & 1 deletion docs/clients/java_client.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Java Client
===========

.. figure:: _static/images/clients/java_logo.jpg
.. figure:: /_static/images/clients/java_logo.jpg
:alt: Java

The Sentilo Java Client is a library developed for working with webapps
Expand Down
2 changes: 1 addition & 1 deletion docs/clients/raspberrypi_client.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RaspberryPi Client
==================

.. figure:: _static/images/clients/raspberrypi.jpeg
.. figure:: /_static/images/clients/raspberrypi.jpeg
:alt: RaspberryPi

The **SentiloClientNodej** is a library written in javascript that
Expand Down

0 comments on commit dec24aa

Please sign in to comment.