ECG

Sets ECG listener

Sets the ECG monitor and get the return value through ecgEveStm.

_blePlugin.ecgEveStm.listen(
        (EgcBean event) {
             /// Do something with new state,for example:
          setState(() {
            switch (event.type) {
              case ECGType.ecgChangeInts:
                _ints = event.ints!;
                break;
              case ECGType.measureComplete:
                break;
              case ECGType.date:
                _date = event.date!;
                break;
              case ECGType.cancel:
                break;
              case ECGType.fail:
                break;
            }
          });
        });

Callback Description(event):

EgcBean:

callback valuecallback value typecallback value description
typeintGet the corresponding return value according to type, where type is the value corresponding to ECGType
intsint[]ECG information
dateDatedate

ECGType:

typevaluevalue description
ecgChangeInts1measure ECG
measureComplete2ECG measurement complete
date3ECG measurement date
cancel4ECG measurement off
fail5ECG measurement failed

Measuring ECG

Start to measure the ECG, the ECG measurement time is 30 seconds, and the user needs to touch the left and right electrodes of the watch with both hands. The value is obtained by listening to the ecgEveStm data stream, and the value is saved in EgcBean.ints,type is ecgChangeInts.

_blePlugin.startECGMeasure;

Stop measuring ECG

_blePlugin.stopECGMeasure;

Detect new ECG measurement methods

In the new measurement mode, the watch can save the last unsent measurement result; the old version does not.

bool newMeasurementVersion = await _blePlugin.isNewECGMeasurementVersion;

Gets the last ECG data

Gets the ECG data saved by the watch, monitor the data stream through ecgEveStm , and save the value in EgcBean.ints,type is ecgChangeInts.

_blePlugin.queryLastMeasureECGData;

Sets heart rate during ECG measurement

Using the measured data, the instantaneous heart rate is calculated through the ECG algorithm library and sent to the watch.

_blePlugin.sendECGHeartRate(int heartRate);
Last Updated: