public class ApiWorker
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TIMEOUT_SECONDS |
Constructor and Description |
---|
ApiWorker() |
Modifier and Type | Method and Description |
---|---|
void |
addValue(WriteChannel<?> channel,
WriteObject writeObject)
Adds a value to the write-pipeline.
|
java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> |
handleSetChannelValueRequest(ComponentManager componentManager,
User user,
SetChannelValueRequest request)
Adds a value via JSON-RPC SetChannelValueRequest.
|
void |
run()
Sets the channels.
|
void |
setLogChannel(StringReadChannel logChannel)
Sets the Channel that should be used to log debug information about writes to
channels.
|
void |
setTimeoutSeconds(int timeoutSeconds)
Sets the timeout in seconds.
|
public static final int DEFAULT_TIMEOUT_SECONDS
public void setLogChannel(StringReadChannel logChannel)
logChannel
- a StringReadChannel
public void addValue(WriteChannel<?> channel, WriteObject writeObject)
run()
, until the timeout is reached.channel
- the WriteChannel
writeObject
- the WriteObject
public java.util.concurrent.CompletableFuture<JsonrpcResponseSuccess> handleSetChannelValueRequest(ComponentManager componentManager, User user, SetChannelValueRequest request) throws java.lang.IllegalArgumentException, OpenemsError.OpenemsNamedException
componentManager
- the ComponentManager
user
- the authenticated Userrequest
- the RequestOpenemsError.OpenemsNamedException
- on errorjava.lang.IllegalArgumentException
- on errorpublic void setTimeoutSeconds(int timeoutSeconds)
timeoutSeconds
- the timeout for this ApiWorkerpublic void run() throws OpenemsError.OpenemsNamedException
OpenemsError.OpenemsNamedException
- on error