General Blocks

IoT Development Kit

Block libraries which are useful for IoT application development in general are collected within the IoT Development Kit Team. This team is public, so you can join this team to be able to import the included libraries.

You will find the following libraries:

  • Buffering
  • Camera and Utilities
  • Counters
  • File I/O
  • File Utilities
  • Flow Logic
  • GSON
  • Geofence
  • HTTP+HTPPS
  • Iterator
  • Java Swing Components
  • KML
  • LoRa (Multitech)
  • MQTT
  • ModBus
  • Periodic Timers
  • Properties
  • R-Pi GPIO+I2C
  • SMS (Clickatell)
  • SMS (Twilio)
  • Send SMTP email
  • Serial I/O (rxtxSerial)
  • Session Utils
  • Speech (FreeTTS)
  • Timers
  • Video
  • Watchdogs
  • XML
  • XML to DOM
  • XMPP Client (Smack)
  • Xively

Buffers

Purpose

Many applications include a producer and consumer of some data, which do not necessarily work synchronously. Then the data has to be buffered in between.

Example

This following system is from the Send Multiple Emails tutorial:

The block Emails Generator produces emails, which are going to be sent by block Send Email. However, sending an email may take some time. Therefore the produced emails are stored within Buffer Eager Simple and processed one at time by the consuming block Send Email.

Buffer Library

To use a buffer from the library:

  • Start the Import Wizard, as explained here.
  • Import the following library:
    • Buffering - com.bitreactive.library.buffering

All buffers are suitable for storing data between a producer and a consumer. However, you’ll find some differences in the behaviour of the Buffering library blocks:

Simple vs Advanced

The simple and advanced version of a buffer behave very similar. The advanced buffers provide more functionality:

  • addAll pin to add many items at once
  • stop pin to terminate after having emptied the buffer
  • abort pin to terminate immediately
  • overflow: to be notified in case an overflow occurs

Usually it is a good idea to start with one of the Simple buffers and switch to the more advanced one in case more functionality is needed.

Eager vs Lazy

From your application you will usually know if to use an Eager or a Lazy buffer. Eager means that these buffers will push out the first added element without being asked. Lazy means that no element is going to be pushed out unless you ask for it via pin next. Eager and Lazy buffers have the same pins, however they behave differently as you can see by their contracts:

  • Buffer Lazy Simple:

  • Buffer Eager Simple: