ResourceAllocationType.ResourceAllocation.Priority.EMERGENCY, locationRemote, BlindStateType.BlindState.newBuilder().setOpeningRatio(100.0).build(), UnitType.UNKNOWN, ServiceTemplateType.ServiceTemplate.ServiceType.BLIND_STATE_SERVICE,
return TimestampProcessor.updateTimestamp(timestamp, BlindState.newBuilder().setMovementState(mostOccurrences).setOpeningRatio(openingRatioAverage), TimeUnit.MICROSECONDS, logger).build();
if (simulatedBlindState.getOpeningRatio() == MAX_OPENING_RATIO) { simulatedBlindState.setMovementState(BlindState.MovementState.DOWN); simulatedBlindState.setOpeningRatio(MAX_OPENING_RATIO - OPENING_RATIO_STEP); } else { simulatedBlindState.setMovementState(BlindState.MovementState.UP); simulatedBlindState.setOpeningRatio(MIN_OPENING_RATIO + OPENING_RATIO_STEP); simulatedBlindState.setOpeningRatio(simulatedBlindState.getOpeningRatio() - OPENING_RATIO_STEP); } else { simulatedBlindState.setMovementState(BlindState.MovementState.STOP); simulatedBlindState.setOpeningRatio(MIN_OPENING_RATIO); simulatedBlindState.setOpeningRatio(simulatedBlindState.getOpeningRatio() + OPENING_RATIO_STEP); } else { simulatedBlindState.setMovementState(BlindState.MovementState.STOP); simulatedBlindState.setOpeningRatio(MAX_OPENING_RATIO); simulatedBlindState.setOpeningRatio(MAX_OPENING_RATIO); break;
/** * Creates a new custom service simulator. * * @param unitController the unit to simulate. */ public BlindStateServiceSimulator(UnitController unitController) { super(unitController, ServiceType.BLIND_STATE_SERVICE); this.simulatedBlindState = BlindState.newBuilder(); this.simulatedBlindState.setMovementState(BlindState.MovementState.STOP); this.simulatedBlindState.setOpeningRatio(100); }
/** * Transform a number to a brightness state by setting the number as the brightness value. * * @param value the brightness value * @return the corresponding brightness state */ public static BlindState transform(final Double value) { BlindState.Builder state = BlindState.newBuilder(); state.setOpeningRatio(value); return state.build(); }