Package io.openems.common.jsonrpc.base
Class JsonrpcRequest
java.lang.Object
io.openems.common.jsonrpc.base.JsonrpcMessage
io.openems.common.jsonrpc.base.AbstractJsonrpcRequest
io.openems.common.jsonrpc.base.JsonrpcRequest
- Direct Known Subclasses:
AddAppInstance.Request
,AddAppInstanceRequest
,AddEdgeToUserRequest
,AppCenterAddDeinstallInstanceHistoryRequest
,AppCenterAddInstallInstanceHistoryRequest
,AppCenterAddRegisterKeyHistoryRequest
,AppCenterAddUnregisterKeyHistoryRequest
,AppCenterGetInstalledAppsRequest
,AppCenterGetPossibleAppsRequest
,AppCenterGetRegisteredKeysRequest
,AppCenterInstallAppWithSuppliedKeyRequest
,AppCenterIsAppFreeRequest
,AppCenterIsKeyApplicableRequest
,AppCenterRequest
,AuthenticatedRpcRequest
,AuthenticateWithPasswordRequest
,AuthenticateWithTokenRequest
,ChannelExportXlsxRequest
,ComponentJsonApiRequest
,CreateComponentConfigRequest
,DeleteAppInstance.Request
,DeleteComponentConfigRequest
,EdgeRpcRequest
,ExecuteSimulationRequest
,ExecuteSystemCommandRequest
,ExecuteSystemUpdateRequest
,GenericJsonrpcRequest
,Get24HoursPredictionRequest
,GetApp.Request
,GetAppAssistant.Request
,GetAppDescriptor.Request
,GetAppInstances.Request
,GetApps.Request
,GetDevicesRequest
,GetEdgeConfigRequest
,GetEdgeRequest
,GetEdgesChannelsValuesRequest
,GetEdgesRequest
,GetEdgesStatusRequest
,GetFieldNamesRequest
,GetMetersRequest
,GetModbusProtocolExportXlsxRequest
,GetModbusProtocolRequest
,GetNetworkConfigRequest
,GetSetupProtocolDataRequest
,GetSetupProtocolRequest
,GetSystemUpdateStateRequest
,GetUserAlertingConfigsRequest
,GetUserInformationRequest
,LogoutRequest
,QueryHistoricTimeseriesDataRequest
,QueryHistoricTimeseriesEnergyPerPeriodRequest
,QueryHistoricTimeseriesEnergyRequest
,QueryHistoricTimeseriesExportXlxsRequest
,RegisterUserRequest
,SetChannelValueRequest
,SetGridConnScheduleRequest
,SetNetworkConfigRequest
,SetUserAlertingConfigsRequest
,SetUserInformationRequest
,SubmitSetupProtocolRequest
,SubscribeChannelsRequest
,SubscribeEdgesChannelsRequest
,SubscribeEdgesRequest
,SubscribeEdgesRequest
,SubscribeSystemLogRequest
,SystemUpdateRequest
,UpdateAppInstance.Request
,UpdateComponentConfigRequest
,UpdateUserLanguageRequest
Represents a JSON-RPC Request.
{ "jsonrpc": "2.0", "id": "UUID", "method": string, "params": {}, "timeout"?: number, defaults to 60 seconds; negative or zero to disable timeout }
- See Also:
-
Field Summary
FieldsFields inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
JSONRPC_VERSION
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
JsonrpcRequest
(JsonrpcRequest request, String method) Creates aJsonrpcRequest
by copying and validating header information.JsonrpcRequest
(String method) JsonrpcRequest
(String method, int timeout) Creates aJsonrpcRequest
with randomUUID
as id.JsonrpcRequest
(String method, Optional<Integer> timeout) Creates aJsonrpcRequest
with randomUUID
as id.JsonrpcRequest
(UUID id, String method, int timeout) Creates aJsonrpcRequest
.JsonrpcRequest
(UUID id, String method, Optional<Integer> timeoutOpt) Creates aJsonrpcRequest
. -
Method Summary
Modifier and TypeMethodDescriptiongetId()
Gets the JSON-RPC id.Gets the max time in seconds to wait for theJsonrpcResponse
, negative or zero to disable timeout.com.google.gson.JsonObject
Gets theJsonObject
representation of thisJsonrpcMessage
.Methods inherited from class io.openems.common.jsonrpc.base.AbstractJsonrpcRequest
getFullyQualifiedMethod, getMethod, getParams
Methods inherited from class io.openems.common.jsonrpc.base.JsonrpcMessage
from, from, toString
-
Field Details
-
DEFAULT_TIMEOUT_SECONDS
public static final int DEFAULT_TIMEOUT_SECONDS- See Also:
-
NO_TIMEOUT
public static final int NO_TIMEOUT- See Also:
-
id
-
timeoutOpt
-
-
Constructor Details
-
JsonrpcRequest
- Parameters:
method
- the JSON-RPC method
-
JsonrpcRequest
Creates aJsonrpcRequest
with randomUUID
as id.- Parameters:
method
- the JSON-RPC methodtimeout
- max time in seconds to wait for theJsonrpcResponse
, negative or zero to disable timeout
-
JsonrpcRequest
Creates aJsonrpcRequest
with randomUUID
as id.- Parameters:
method
- the JSON-RPC methodtimeout
- max time in seconds to wait for theJsonrpcResponse
, negative or zero to disable timeout, empty forDEFAULT_TIMEOUT_SECONDS
timeout
-
JsonrpcRequest
Creates aJsonrpcRequest
.- Parameters:
id
- the JSON-RPC idmethod
- the JSON-RPC methodtimeoutOpt
- max time in seconds to wait for theJsonrpcResponse
, negative or zero to disable timeout, empty forDEFAULT_TIMEOUT_SECONDS
timeout
-
JsonrpcRequest
Creates aJsonrpcRequest
by copying and validating header information.- copies id and timeout
- validates that the method names match
- Parameters:
request
- the template JSON-RPC Requestmethod
- the JSON-RPC method
-
JsonrpcRequest
Creates aJsonrpcRequest
.- Parameters:
id
- the JSON-RPC idmethod
- the JSON-RPC methodtimeout
- max time in seconds to wait for theJsonrpcResponse
, negative or zero to disable timeout
-
-
Method Details
-
getId
Gets the JSON-RPC id.- Returns:
- the
UUID
id
-
getTimeout
Gets the max time in seconds to wait for theJsonrpcResponse
, negative or zero to disable timeout.- Returns:
- the timeout in seconds
-
toJsonObject
public com.google.gson.JsonObject toJsonObject()Description copied from class:JsonrpcMessage
Gets theJsonObject
representation of thisJsonrpcMessage
.- Overrides:
toJsonObject
in classAbstractJsonrpcRequest
- Returns:
- a
JsonObject
-