startCalibration method

  1. @override
Future<void> startCalibration(
  1. CalibrationMode mode,
  2. CalibrationCriteria criteria,
  3. Rect? region
)
override

Implementation

@override
Future<void> startCalibration(
    CalibrationMode mode, CalibrationCriteria criteria, Rect? region) async {
  Map<String, dynamic> argument = {};

  int caliMode = 5;
  if (mode == CalibrationMode.ONE) {
    caliMode = 1;
  } else if (mode == CalibrationMode.SIX) {
    caliMode = 6;
  }
  argument[SeeSoPluginArgumentKey.CALIBRATION_MODE.name] = caliMode;

  int caliCriteria = 0;
  if (criteria == CalibrationCriteria.HIGH) {
    caliCriteria = 1;
  } else if (criteria == CalibrationCriteria.LOW) {
    caliCriteria = -1;
  }

  argument[SeeSoPluginArgumentKey.CALIBRATION_CRITERIA.name] = caliCriteria;

  if (region != null) {
    argument[SeeSoPluginArgumentKey.CALIBRATION_REGION_LEFT.name] =
        region.left;
    argument[SeeSoPluginArgumentKey.CALIBRATION_REGION_TOP.name] = region.top;
    argument[SeeSoPluginArgumentKey.CALIBRATION_REGION_RIGHT.name] =
        region.right;
    argument[SeeSoPluginArgumentKey.CALIBRATION_REGION_BOTTOM.name] =
        region.bottom;
  }

  await methodChannel.invokeMethod(
      SeeSoPluginMethod.START_CALIBRATION.name, argument);
}