SampleRate
SampleRate

Represents a MicroStrain sample rate (rate at which data is sampling)

Types
RateType
rateType_seconds

0 - Sample rate type of seconds  (less than 1 Hz)

rateType_hertz

1 - Sample rate type of Hertz  (1 Hz and above)

rateType_event

2 - Event triggered, No sample rate

Functions
SampleRate
SampleRate(
RateType type,
uint32 samples
)

Creates a sample rate with the given type and samples

Parameters
type

The RateType of the given sample rate

samples
uint32

The number of samples in the given sample rate (or seconds if the type is rateType_seconds)

str
std::string str() const

Gets the string representation of the sample rate.  Ex. 1Hz = "1-hertz", 10kHz = "10000-hertz", 1 per 10 seconds = "10-seconds", 1 per 1 minute = "60 seconds"

Returns

The sample rate represented as a string

prettyStr
std::string prettyStr() const

Gets the string representation of the sample rate in a more human-readable format.  Ex. 1Hz = "1Hz", 10kHz = "10kHz", 1 per 10 seconds = "Every 10 sec", 1 per 1 minute = "Every 1 min"

Returns

The sample rate represented as a string

samplePeriod
TimeSpan samplePeriod() const

Gets the sample period (time between samples) as a TimeSpan for the current sample rate

Returns

The TimeSpan representing the sample period

Exceptions
samplesPerSecond
double samplesPerSecond() const

Gets the number of samples per second.

Returns

The number of samples per second as a double

Exceptions
rateType
RateType rateType() const

Gets the sample rate type

Returns

The type of the current sample rate

samples
uint32 samples() const

Gets the number of samples for the sample rate (or seconds if less than 1 Hz)

Returns

The number of samples for the sample rate

toWirelessSampleRate
WirelessTypes::WirelessSampleRate toWirelessSampleRate() const

Gets the WirelessTypes::WirelessSampleRate enum for the current SampleRate.

Returns

The WirelessTypes::WirelessSampleRate that is associated with the current SampleRate.

Exceptions
Hertz
static SampleRate Hertz(
uint32 samplesPerSecond
)

Creates a SampleRate object from the given samples per second

Parameters
samplesPerSecond
uint32

The number of samples per second (Hz)

Returns

A SampleRate object built from the given parameter

KiloHertz
static SampleRate KiloHertz(
uint32 kSamplesPerSecond
)

Creates a SampleRate object from the given 1000 samples per second

Parameters
kSamplesPerSecond
uint32

The number of 1000's samples per second (kHz) (20 kHz = 20)

Returns

A SampleRate object built from the given parameter

Seconds
static SampleRate Seconds(
uint32 secondsBetweenSamples
)

Creates a SampleRate object from the given seconds between samples

Parameters
secondsBetweenSamples
uint32

The number of seconds between samples (1 sample every 2 minutes = 120)

Returns

A SampleRate object built from the given parameter

Seconds

Creates a SampleRate object with the asynchronous/event type.

Returns

A SampleRate object of the event type.

FromWirelessEepromValue
static SampleRate FromWirelessEepromValue(
WirelessTypes::WirelessSampleRate eepromValue
)

Creates a SampleRate object from the WirelessTypes::WirelessSampleRate value (the value that gets stored in eeprom).

Parameters
eepromValue

The WirelessTypes::WirelessSampleRate value (the value that gets stored in eeprom).

Returns

A SampleRate object built from the given parameter.

Exceptions
Variables
m_rateType
RateType m_rateType

The type of the sample rate

m_samples
uint32 m_samples

Represents the number of samples.  If the sample rate type is Hertz, m_samples represents the number of samples per second (256 = 256 Hz).  If the sample rate type is Seconds, m_samples represents the number of seconds (60 = 1 per 60 seconds, 120 = 1 per 2 minutes).

Types
SampleRates

A typedef for a vector of SampleRate objects.