Search in sources :

Example 6 with OpenSourceExecutionReason

use of me.retrodaredevil.solarthing.reason.OpenSourceExecutionReason in project solarthing by wildmountainfarms.

the class OnMateCommandSent method onCommandExecute.

@Override
public void onCommandExecute(SourcedCommand<MateCommand> command) {
    OpenSource source = command.getSource();
    ExecutionReason reason = new OpenSourceExecutionReason(source);
    Packet packet = new ImmutableSuccessMateCommandPacket(SuccessMateCommandPacket.VERSION_LATEST, command.getCommand(), // for legacy reasons, include the data source converted to a string
    source.toDataSource().toString(), reason);
    packetListReceiver.receive(Collections.singletonList(packet));
}
Also used : Packet(me.retrodaredevil.solarthing.packets.Packet) SuccessMateCommandPacket(me.retrodaredevil.solarthing.solar.outback.command.packets.SuccessMateCommandPacket) ImmutableSuccessMateCommandPacket(me.retrodaredevil.solarthing.solar.outback.command.packets.ImmutableSuccessMateCommandPacket) OpenSource(me.retrodaredevil.solarthing.type.open.OpenSource) ExecutionReason(me.retrodaredevil.solarthing.reason.ExecutionReason) OpenSourceExecutionReason(me.retrodaredevil.solarthing.reason.OpenSourceExecutionReason) OpenSourceExecutionReason(me.retrodaredevil.solarthing.reason.OpenSourceExecutionReason) ImmutableSuccessMateCommandPacket(me.retrodaredevil.solarthing.solar.outback.command.packets.ImmutableSuccessMateCommandPacket)

Aggregations

OpenSourceExecutionReason (me.retrodaredevil.solarthing.reason.OpenSourceExecutionReason)6 OpenSource (me.retrodaredevil.solarthing.type.open.OpenSource)6 Packet (me.retrodaredevil.solarthing.packets.Packet)4 ImmutableRequestCommandPacket (me.retrodaredevil.solarthing.commands.packets.open.ImmutableRequestCommandPacket)3 ExecutionReason (me.retrodaredevil.solarthing.reason.ExecutionReason)3 Instant (java.time.Instant)2 Test (org.junit.jupiter.api.Test)2 ArrayList (java.util.ArrayList)1 EventReceiverEnvironment (me.retrodaredevil.solarthing.actions.environment.EventReceiverEnvironment)1 SourceEnvironment (me.retrodaredevil.solarthing.actions.environment.SourceEnvironment)1 CommandOpenPacket (me.retrodaredevil.solarthing.commands.packets.open.CommandOpenPacket)1 DeleteAlterPacket (me.retrodaredevil.solarthing.commands.packets.open.DeleteAlterPacket)1 RequestCommandPacket (me.retrodaredevil.solarthing.commands.packets.open.RequestCommandPacket)1 RequestFlagPacket (me.retrodaredevil.solarthing.commands.packets.open.RequestFlagPacket)1 RequestHeartbeatPacket (me.retrodaredevil.solarthing.commands.packets.open.RequestHeartbeatPacket)1 ScheduleCommandPacket (me.retrodaredevil.solarthing.commands.packets.open.ScheduleCommandPacket)1 VersionedPacket (me.retrodaredevil.solarthing.database.VersionedPacket)1 IncompatibleUpdateTokenException (me.retrodaredevil.solarthing.database.exception.IncompatibleUpdateTokenException)1 SolarThingDatabaseException (me.retrodaredevil.solarthing.database.exception.SolarThingDatabaseException)1 UpdateConflictSolarThingDatabaseException (me.retrodaredevil.solarthing.database.exception.UpdateConflictSolarThingDatabaseException)1