Skip to content

Commit 7bdec8d

Browse files
authored
[Core] Add method to complete command with result and message (#322)
1 parent a8bfdb7 commit 7bdec8d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

sensorhub-core/src/main/java/org/sensorhub/api/command/CommandStatus.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ public static ICommandStatus failed(BigId commandID, String errorMsg)
101101
* Generate a status report for a command that is pending and will be
102102
* processed later on
103103
* @param commandID The ID of the command triggering the report
104-
* @param taskID ID assigned to the command/task
105104
* @return The status report
106105
*/
107106
public static ICommandStatus pending(BigId commandID)
@@ -181,6 +180,22 @@ public static ICommandStatus completed(BigId commandID, TimeExtent execTime, ICo
181180
return status;
182181
}
183182

183+
/**
184+
* Generate a status report for a command that was asynchronously executed
185+
* and completed successfully with a result
186+
* @param commandID The ID of the command triggering the report
187+
* @param execTime The actual time (or time period) the command was executed
188+
* @param result The result (observations) produced during execution of the command
189+
* @param message The message
190+
* @return The status report
191+
*/
192+
public static ICommandStatus completed(BigId commandID, TimeExtent execTime, ICommandResult result, String message)
193+
{
194+
var status = new CommandStatus(commandID, CommandStatusCode.COMPLETED, execTime);
195+
status.result = Asserts.checkNotNull(result, ICommandResult.class);
196+
status.message = message;
197+
return status;
198+
}
184199

185200
@Override
186201
public BigId getCommandID()

0 commit comments

Comments
 (0)