startCalibration method

Future<CalibrationSession> startCalibration(
  1. CalibrationInput calibrationInput
)

Implementation

Future<CalibrationSession> startCalibration(
    CalibrationInput calibrationInput) async {
  try {
    if (!canRecalibrate) {
      throw Exception(
          "Can't recalibrate sensie. Please check async storage.");
    }

    userId = calibrationInput.userId;
    onEnds = calibrationInput.onEnds;
    final resJSON = await startSessionRequest('calibration');
    final sessionId = resJSON['data']['session']['id'];
    this.sessionId = sessionId;
    return CalibrationSession(accessToken, sessionId);
  } catch (e) {
    throw Exception('Failed to start calibration session.');
  }
}