Buffer Element

The buffer element is used to place values into a stack which operates using first in, last out order.

The buffer element is located in the Element Toolbox within Studio’s Application tab and Cloud tab.

Properties

The following properties can be changed for the buffer element:

Name

The name of the element.

Triggers

The following triggers are available to execute events from within the buffer element:

Triggered

Execute an event when the source element connected to the buffer triggers.

Pushed

Execute an event when the source element sends a value to the end of the buffer.

Popped

Execute an event when a value is removed from the end of the buffer.

Shifted

Execute an event when a value is removed from the front of the buffer.

Spliced

Execute an event when values within the buffer is spliced into a separate array.

Cleared

Execute an event when the buffer is cleared.

Index Set

Execute an event when the index defined by the buffer’s argument is set.

Index Retrieved

Execute an event when the index defined by the buffer’s argument is retrieved.

Abilities

The following abilities are available for the buffer element when its source element triggers:

Trigger

Trigger the element(s) that follow the buffer element.

Push

Append the provided value(s) to the end of the buffer.

Push Arguments    
Name Type Description
Pushed Value Object Send a value from the source element to the end of the buffer.

Pop

Remove the last value from the end of the buffer.

Shift

Remove a value from the buffer in first in first out order.

Shift Arguments    
Name Type Description
Shifted Value Integer Remove a value from the buffer.

Splice

Send an index of values into an array.

Splice Arguments    
Name Type Description
Index Integer Index to start the splice.
Length Integer Number of values in the array.

Set Index

Set an index of values.

Set Index Arguments    
Name Type Description
Index Value Integer Index of stored values.

Get Index

Return the index used.

Get Index Arguments    
Name Type Description
Index Value Integer Index to retrieve values from the buffer.

Clear

Clear all values within the buffer.

Demo Projects

To view the Buffer element used within a project, click the demo’s name to open the project in Atmosphere and see how the element is set up.

Name Hardware Description
Buffer/Average Element Demo NXP Rapid IoT Every second, the Rapid IoT kit sends the temperature via BLE. The app will average every 6 values and send the result to a buffer. When you press the button, the latest average is popped from the buffer and printed.