TeslasuitDocumentation
Plugins

PPG viewer

Windows · Unity 6000.0.44f1 · Plugin 2.6.0 · Requires Teslasuit Studio

This example streams processed photoplethysmography (PPG) data from the suit and displays it in a Unity UI. It shows how a provider component surfaces biometric data that a viewer can poll each frame. The scene is TS/Examples/Scenes/Ppg/ProcessedPpg.unity.

What it demonstrates#

  • Streaming processed PPG data with TsPpgProvider.
  • Reading IProcessedPpgData and presenting it in a UI list.

Scene setup#

The scene has a suit GameObject carrying a TsSuitBehaviour and a TsPpgProvider, which requires the device behaviour on the same object. When the suit connects, the provider grabs the device's Biometry.Ppg interface and starts streaming automatically; it stops on disable.

The UI side is a viewer script bound to a scroll list. It instantiates one row per processed data item using the ProcessedPpgItem prefab, a demo list row that is reference only. For your own project, rebuild the row against your UI.

The key API pattern#

The provider exposes the latest processed data through GetData. The viewer polls it and updates the UI.

[SerializeField] private TsPpgProvider m_provider;   // on the suit object

private void Update()
{
    if (!m_provider.IsRunning) return;

    IProcessedPpgData data = m_provider.GetData();
    if (data != null)
    {
        // read the processed values and refresh the UI rows
    }
}

GetData returns null until the device is connected and streaming, so the viewer guards on IsRunning before reading. The provider manages start and stop through the device connection and the component's enable state, so you do not call start yourself.