![]() |
Halyri - Mobiili
0.9
|
Mock of a class that manages an active measurement session on a measurement instrument connested to the mobile device. Currently provides data conforming to the data structure parameters specified in the provided MeasurementInstrumentDto and imitating nomrmal ECG. More...
Public Member Functions | |
MeasurementManager (MeasurementInstrumentDto instrument) | |
Initializes a new mock MeasurementManager instance that provides mock samples conforming to the data parameters specified by the provided instrument. More... | |
void | StartMeasurement () |
Starts generating mock ECG data. MeasurementDataAvailableEvent is fired every time new measurement data sample is available. More... | |
void | StopMeasurement () |
Stops measurement. More... | |
Properties | |
bool | Active [get] |
Events | |
MeasurementDataAvailable | MeasurementDataAvailableEvent |
Private Member Functions | |
void | GeneratePulseData () |
Generates an ECG pulse imitating the Q, R and S waves. More... | |
void | measurementDataSendTimerTick (Object state) |
Handles measurement data timer ticks. Generates a new measurement data sequence consisting of flat line and ECG pulses generated in the GeneratePulseData method. The rate of ECG pulses is determined by the ppm value. More... | |
void | UpdatePpm () |
Updates ppm value by addin or substracting the ppmFluctuationRate from the current ppm. Keeps the ppm value inside the range defined by the maxPpm and the minPpm. More... | |
float | LinearSlope (int x1, int x2, int y1, int y2) |
Calculates the slope of a linear function using two point on the line. More... | |
byte | addNoiseToByte (byte b) |
Adds or substracts a random value between 0 and the noiseMagnitude from the argument. Returns the resulting byte. More... | |
Private Attributes | |
MeasurementInstrumentDto | activeMeasurementInstrument |
Timer | measurementPublishTimer |
Random | randomSource |
int | measurementPacketIntervalMilliSeconds = 1000 |
int | measurementPacketIntervalSeconds |
int | measurementPacketSequence |
byte | zeroLevel = 70 |
byte[] | pulseData |
byte[] | sampleOverflowData = null |
int | ppm = 75 |
int | ppmFluctuationRate = 1 |
int | minPpm = 50 |
int | maxPpm = 185 |
int | noiseMagnitude = 11 |
bool | lastWasPulse = false |
bool | active = false |
Mock of a class that manages an active measurement session on a measurement instrument connested to the mobile device. Currently provides data conforming to the data structure parameters specified in the provided MeasurementInstrumentDto and imitating nomrmal ECG.
<author>Veli-Mikko Puupponen</author> Assumes the DataSampleSize to be 1 byte.
Halyri.Measurement.MeasurementManager.MeasurementManager | ( | MeasurementInstrumentDto | instrument | ) |
Initializes a new mock MeasurementManager instance that provides mock samples conforming to the data parameters specified by the provided instrument.
instrument | Instrument used as data parameter source |
|
private |
Adds or substracts a random value between 0 and the noiseMagnitude from the argument. Returns the resulting byte.
b | The byte to which the random value is added |
|
private |
Generates an ECG pulse imitating the Q, R and S waves.
|
private |
Calculates the slope of a linear function using two point on the line.
x1 | x coordinate of the first point |
x2 | x coordinate of the second point |
y1 | y coordinate of the first point |
y2 | y coordinate of the second point |
|
private |
Handles measurement data timer ticks. Generates a new measurement data sequence consisting of flat line and ECG pulses generated in the GeneratePulseData method. The rate of ECG pulses is determined by the ppm value.
Fires the MeasurementDataAvailableEvent.
state | State of the invoking timer instance. |
void Halyri.Measurement.MeasurementManager.StartMeasurement | ( | ) |
Starts generating mock ECG data. MeasurementDataAvailableEvent is fired every time new measurement data sample is available.
void Halyri.Measurement.MeasurementManager.StopMeasurement | ( | ) |
Stops measurement.
|
private |
Updates ppm value by addin or substracting the ppmFluctuationRate from the current ppm. Keeps the ppm value inside the range defined by the maxPpm and the minPpm.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
get |
MeasurementDataAvailable Halyri.Measurement.MeasurementManager.MeasurementDataAvailableEvent |