Mediatek LinkIt One libraries and examples to connect to http://thethings.iO
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
LICENSE
README.md
thethingsiOClient.cpp
thethingsiOClient.h
thethingsiOWiFiLinkItOne.h
thethingsiOlinkItOne.h

README.md

thethings.iO-Mediatek-LinkItOne-library

Mediatek LinkIt One libraries and examples to connect to http://thethings.iO

If you want to use the WiFi client you should #include <SPI.h> #include <LWiFi.h> #include <LWiFiClient.h>#include <LWiFiServer.h>#include <LWiFiUdp.h>before including this library.Then include this library with #include <thethingsiOlinkItOne.h>. Before using any client from this library, the WiFI connection should be initialized. Check the examples for mor details


// Initialize WiFi
int status = -1
Serial.println("Connecting LinkIt One to network...");
LWiFi.begin();
 // attempt to connect to Wifi network:
while ( status != LWIFI_STATUS_CONNECTED ) {
  Serial.print("Attempting to connect to WPA SSID: ");
  Serial.println(WIFI_AP);
  LWiFi.connectWPA(WIFI_AP, WIFI_PWD);
  // wait 10 seconds for connection:
  delay(10000);
  status = LWiFi.status();
thethingsiOWiFiLinkItOne();
thethingsiOWiFiLinkItOne (String token);

Create a new client. The first form is used to activate new things with the activate(String) method. The second form sets the token for an already activated thing.

String activate(String activationCode);

Activates a thing with the given activation code. The token for the Thing is automatically set and returned. In the case of failure an empty string is returned.

String getToken();

Returns the token associated with this thing.

void addValue(String key, String value);
void addValue(String key, double value);

Adds the key/value pair in the buffer of data to be sent. Since those pairs are stored in memory until the data is sent the user should be aware of the memory.

String send();

Send and flush the data stored in the data buffer (added with the addValue functions).

String read(String key);
String read(String key, int limit);

Get the last limit key/value pairs sent to this thing with the given key. In the first form , the last 10 items are returned.

void subscribe();
int available();
String read();

Subscribe, check for data to be read and actually read the data from the thing. This is used to listen and get the data sent to this thing.