public String processManualCalibrationDataMessage(float value,boolean instant,boolean doCalibration){
  float mult=1f;
  float num=value * mult;
  lastGlucometerRecord=new GlucometerRecord();
  lastGlucometerRecord.numGlucometerValue=num;
  lastGlucometerValue=num;
  Date d=new Date();
  lastGlucometerRecord.lastDate=d.getTime();
  lastGlucometerDate=d.getTime();
  calculateDate(lastGlucometerRecord,d,0);
  if (!instant && doCalibration) {
    if (HexDump.unsignedByte(expectedSensorSortNumber) == HexDump.unsignedByte((byte)0xff)) {
      expectedSensorSortNumberForCalibration[0]=(byte)0x00;
      expectedSensorSortNumberForCalibration[1]=(byte)0x71;
    }
 else {
synchronized (expectedSensorSortNumberLock) {
        byte expectedAux=expectedSensorSortNumber;
        if (HexDump.unsignedByte((byte)(expectedSensorSortNumber & (byte)0x01)) > 0)         expectedAux=(byte)(expectedSensorSortNumber & (byte)0xFE);
        expectedSensorSortNumberForCalibration[0]=calculateNextSensorSortNameFrom(6,expectedAux);
        expectedSensorSortNumberForCalibration[1]=calculateNextSensorSortNameFrom(10,expectedAux);
      }
    }
  }
  SharedPreferences.Editor editor=settings.edit();
  editor.putFloat("lastGlucometerValue",(float)num);
  editor.putLong("glucometerLastDate",d.getTime());
  if (!instant && doCalibration) {
    editor.putString("expectedSensorSortNumberForCalibration0",HexDump.toHexString(expectedSensorSortNumberForCalibration[0]));
    editor.putString("expectedSensorSortNumberForCalibration1",HexDump.toHexString(expectedSensorSortNumberForCalibration[1]));
  }
 else {
    editor.remove("expectedSensorSortNumberForCalibration0");
    editor.remove("expectedSensorSortNumberForCalibration1");
  }
  if (lastGlucometerValue > 0) {
    isCalibrating=!instant && doCalibration;
    if (previousRecord == null) {
      MedtronicSensorRecord auxRecord=new MedtronicSensorRecord();
      auxRecord.isCalibrating=!instant;
      log.debug("8");
      writeLocalCSV(auxRecord,context);
    }
 else {
      previousRecord.isCalibrating=!instant;
      log.debug("9");
      writeLocalCSV(previousRecord,context);
    }
    editor.putBoolean("isCalibrating",!instant);
    editor.commit();
  }
  editor.commit();
  return "Measure received " + num + " mg/dl";
}

public String processManualCalibrationDataMessage ( float value , boolean instant , boolean doCalibration ) { float mult = 1f ; float num = value * mult ; lastGlucometerRecord = new GlucometerRecord ( ) ; lastGlucometerRecord . numGlucometerValue = num ; lastGlucometerValue = num ; Date d = new Date ( ) ; lastGlucometerRecord . lastDate = d . getTime ( ) ; lastGlucometerDate = d . getTime ( ) ; calculateDate ( lastGlucometerRecord , d , 0 ) ; if ( ! instant && doCalibration ) { if ( HexDump . unsignedByte ( expectedSensorSortNumber ) == HexDump . unsignedByte ( ( byte ) 0xff ) ) { expectedSensorSortNumberForCalibration [ 0 ] = ( byte ) 0x00 ; expectedSensorSortNumberForCalibration [ 1 ] = ( byte ) 0x71 ; } else { synchronized ( expectedSensorSortNumberLock ) { byte expectedAux = expectedSensorSortNumber ; if ( HexDump . unsignedByte ( ( byte ) ( expectedSensorSortNumber & ( byte ) 0x01 ) ) > 0 ) expectedAux = ( byte ) ( expectedSensorSortNumber & ( byte ) 0xFE ) ; expectedSensorSortNumberForCalibration [ 0 ] = calculateNextSensorSortNameFrom ( 6 , expectedAux ) ; expectedSensorSortNumberForCalibration [ 1 ] = calculateNextSensorSortNameFrom ( 10 , expectedAux ) ; } } } SharedPreferences . Editor editor = settings . edit ( ) ; editor . putFloat ( "lastGlucometerValue" , ( float ) num ) ; editor . putLong ( "glucometerLastDate" , d . getTime ( ) ) ; if ( ! instant && doCalibration ) { editor . putString ( "expectedSensorSortNumberForCalibration0" , HexDump . toHexString ( expectedSensorSortNumberForCalibration [ 0 ] ) ) ; editor . putString ( "expectedSensorSortNumberForCalibration1" , HexDump . toHexString ( expectedSensorSortNumberForCalibration [ 1 ] ) ) ; } else { editor . remove ( "expectedSensorSortNumberForCalibration0" ) ; editor . remove ( "expectedSensorSortNumberForCalibration1" ) ; } if ( lastGlucometerValue > 0 ) { isCalibrating = ! instant && doCalibration ; if ( previousRecord == null ) { MedtronicSensorRecord auxRecord = new MedtronicSensorRecord ( ) ; auxRecord . isCalibrating = ! instant ; log . debug ( "8" ) ; writeLocalCSV ( auxRecord , context ) ; } else { previousRecord . isCalibrating = ! instant ; log . debug ( "9" ) ; writeLocalCSV ( previousRecord , context ) ; } editor . putBoolean ( "isCalibrating" , ! instant ) ; editor . commit ( ) ; } editor . commit ( ) ; return "Measure received " + num + " mg/dl" ; }
this method process the manual calibration message
