/*@ ensures
    @ (sb.getSensorsLength() > 0) ==>
    @ ((g_sensor.isEnabled()) ==>
 @ ((g_value >= 1488 && g_value <= 2232) ==> (g_value == packet.accelerometerY)));
    @*/
 private void setAccelerometerY(/*@non_null*/ final FormalInstancePacket packet) {
   if (sb.getSensorsLength() > 0) {
     final ISensor sensor = sb.getSensor(SensorIndexer.ACCEL_Y);
     // @ set g_sensor = sensor;
     if (sensor.isEnabled()) {
       sensor.measure();
       final short value = (short) sensor.getValue();
       // @ set g_value = value;
       if (value >= 1488 && value <= 2232) {
         packet.setAccelerometerY(value);
       }
     }
   }
 }
 /*@ ensures
 @ (sb.getSensorsLength() > 0) ==>
 @ ((g_sensor.isEnabled()) ==>
 @ ((g_value >= 310 && g_value <= 5585) ==> (g_value == packet.pressure)));
 @*/
 private void setPressure(/*@non_null*/ final FormalInstancePacket packet) {
   if (sb.getSensorsLength() > 0) {
     final ISensor sensor = sb.getSensor(SensorIndexer.PRESS);
     // @ set g_sensor = sensor;
     if (sensor.isEnabled()) {
       sensor.measure();
       final short value = (short) sensor.getValue();
       // @ set g_value = value;
       if (value >= 310 && value <= 5585) {
         packet.setPressure(value);
       }
     }
   }
 }
 /*@ ensures
 @ (sb.getSensorsLength() > 0) ==>
 @ ((g_sensor.isEnabled()) ==>
 @ ((g_value >= 0 && g_value <= 1000) ==> (g_value == packet.lightLevel)));
 @*/
 private void setLightLevel(/*@non_null*/ final FormalInstancePacket packet) {
   if (sb.getSensorsLength() > 0) {
     final ISensor sensor = sb.getSensor(SensorIndexer.LIGHT);
     // @ set g_sensor = sensor;
     if (sensor.isEnabled()) {
       sensor.measure();
       final short value = (short) sensor.getValue();
       // @ set g_value = value;
       if (value >= 0 && value <= 1000) {
         packet.setLightLevel(value);
       }
     }
   }
 }
  /*@ ensures
  @ (sb.getSensorsLength() > 0) ==>
  @ ((g_sensor.isEnabled()) ==>
  @ ((g_value >= -880 && g_value <= 2047) ==> (g_value == packet.temperature)));
  @*/
  private void setTemperature(/*@non_null*/ final FormalInstancePacket packet) {
    if (sb.getSensorsLength() > 0) {
      final ISensor sensor = sb.getSensor(SensorIndexer.THERM);
      // @ set g_sensor = sensor;

      if (sensor.isEnabled()) {
        sensor.measure();
        final short value = (short) sensor.getValue();
        // @ set g_value = value;
        if (value >= -880 && value <= 2047) {
          packet.setTemperature(value);
        }
      }
    }
  }