package net.heartshield.sensors;

import com.google.gson.annotations.SerializedName;

/**
 * @author David Madl (git@abanbytes.eu)
 * @date 2017-04-12
 */
public interface IAudioSensor extends ISensor {
    /**
     * Time series of sensor data recorded so far.
     * Deep copies are returned.
     *
     * @return sensor data recorded since {@link ISensor#start} was called
     */
    byte[] getPCM();

    /** start time in nanoTime timebase */
    long getStartTimeNanos();

    /** type of start time acquisition */
    AudioStartTimeAccuracy getExpectedStartTimeAccuracy();

    enum AudioStartTimeAccuracy {
        /** about 200 ms accurate - nanoTime() timestamp taken before calling APIs (to playback silence -> trigger recording) */
        @SerializedName("low")
        LOW,

        /** about 50 ms accurate - AudioTimestamp from AudioTrack (playback silence, get a timestamp, and trigger recording) */
        @SerializedName("medium")
        MEDIUM,

        /** hardware specific - AudioTimestamp from AudioRecord above API 24 (Android 7.0 N) */
        @SerializedName("high")
        HIGH
    }
}
