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.
The following properties can be changed for the buffer element:
The name of the element.
The following triggers are available to execute events from within the buffer element:
Execute an event when the source element connected to the buffer triggers.
Execute an event when the source element sends a value to the end of the buffer.
Execute an event when a value is removed from the end of the buffer.
Execute an event when a value is removed from the front of the buffer.
Execute an event when values within the buffer is spliced into a separate array.
Execute an event when the buffer is cleared.
Execute an event when the index defined by the buffer’s argument is set.
Execute an event when the index defined by the buffer’s argument is retrieved.
The following abilities are available for the buffer element when its source element triggers:
Trigger the element(s) that follow the buffer element.
Append the provided value(s) to the end of the buffer.
|Pushed Value||Object||Send a value from the source element to the end of the buffer.|
Remove the last value from the end of the buffer.
Remove a value from the buffer in first in first out order.
|Shifted Value||Integer||Remove a value from the buffer.|
Send an index of values into an array.
|Index||Integer||Index to start the splice.|
|Length||Integer||Number of values in the array.|
Set an index of values.
|Set Index Arguments|
|Index Value||Integer||Index of stored values.|
Return the index used.
|Get Index Arguments|
|Index Value||Integer||Index to retrieve values from the buffer.|
Clear all values within the buffer.
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.
|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.|