Package io.openems.backend.edgewebsocket
Class EdgeWebsocketImpl
java.lang.Object
io.openems.backend.common.component.AbstractOpenemsBackendComponent
io.openems.backend.edgewebsocket.EdgeWebsocketImpl
- All Implemented Interfaces:
EdgeWebsocket
,org.osgi.service.event.EventHandler
public class EdgeWebsocketImpl
extends AbstractOpenemsBackendComponent
implements EdgeWebsocket, org.osgi.service.event.EventHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.osgi.service.event.EventAdmin
protected Metadata
protected TimedataManager
protected UiWebsocket
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMap<ChannelAddress,
com.google.gson.JsonElement> getChannelValues
(String edgeId, Set<ChannelAddress> channelAddresses) Gets the latest values for the given ChannelAddresses.void
handleEvent
(org.osgi.service.event.Event event) handleSubscribeSystemLogRequest
(String edgeId, User user, String token, SubscribeSystemLogRequest request) Handles aSubscribeSystemLogRequest
.void
handleSystemLogNotification
(String edgeId, SystemLogNotification notification) Handles aSystemLogNotification
, i.e.protected boolean
Gets whether the Websocket for this Edge is connected.protected void
Log an error message including the Component ID.protected void
Log an info message including the Component ID.protected void
Logs a info message with Edge-ID.protected void
Log a warn message including the Component ID.protected void
Logs a warning message with Edge-ID.send
(String edgeId, User user, JsonrpcRequest request) Send an authenticated JSON-RPC Request to an Edge via Websocket and expect a JSON-RPC Response.void
send
(String edgeId, JsonrpcNotification notification) Send a JSON-RPC Notification to an Edge.
-
Field Details
-
metadata
-
timedataManager
-
eventAdmin
protected volatile org.osgi.service.event.EventAdmin eventAdmin -
uiWebsocket
-
-
Constructor Details
-
EdgeWebsocketImpl
public EdgeWebsocketImpl()
-
-
Method Details
-
isOnline
Gets whether the Websocket for this Edge is connected.- Parameters:
edgeId
- the Edge-ID- Returns:
- true if it is online
-
send
public CompletableFuture<JsonrpcResponseSuccess> send(String edgeId, User user, JsonrpcRequest request) throws OpenemsError.OpenemsNamedException Description copied from interface:EdgeWebsocket
Send an authenticated JSON-RPC Request to an Edge via Websocket and expect a JSON-RPC Response.- Specified by:
send
in interfaceEdgeWebsocket
- Parameters:
edgeId
- the Edge-IDuser
- the authenticatedUser
request
- theJsonrpcRequest
- Returns:
- the JSON-RPC Success Response Future
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
send
Description copied from interface:EdgeWebsocket
Send a JSON-RPC Notification to an Edge.- Specified by:
send
in interfaceEdgeWebsocket
- Parameters:
edgeId
- the Edge-IDnotification
- the JsonrpcNotification- Throws:
OpenemsException
-
logInfo
Description copied from class:AbstractOpenemsBackendComponent
Log an info message including the Component ID.- Overrides:
logInfo
in classAbstractOpenemsBackendComponent
- Parameters:
log
- the Logger that is used for writing the logmessage
- the Info-message
-
logInfo
Logs a info message with Edge-ID.- Parameters:
log
- theLogger
edgeId
- the Edge-IDmessage
- the message
-
logWarn
Description copied from class:AbstractOpenemsBackendComponent
Log a warn message including the Component ID.- Overrides:
logWarn
in classAbstractOpenemsBackendComponent
- Parameters:
log
- the Logger that is used for writing the logmessage
- the Warn-message
-
logWarn
Logs a warning message with Edge-ID.- Parameters:
log
- theLogger
edgeId
- the Edge-IDmessage
- the message
-
logError
Description copied from class:AbstractOpenemsBackendComponent
Log an error message including the Component ID.- Overrides:
logError
in classAbstractOpenemsBackendComponent
- Parameters:
log
- the Logger that is used for writing the logmessage
- the Error-message
-
handleSubscribeSystemLogRequest
public CompletableFuture<JsonrpcResponseSuccess> handleSubscribeSystemLogRequest(String edgeId, User user, String token, SubscribeSystemLogRequest request) throws OpenemsError.OpenemsNamedException Description copied from interface:EdgeWebsocket
Handles aSubscribeSystemLogRequest
.- Specified by:
handleSubscribeSystemLogRequest
in interfaceEdgeWebsocket
- Parameters:
edgeId
- the Edge-IDuser
- theUser
token
- the UI session tokenrequest
- theSubscribeSystemLogRequest
- Returns:
- a reply
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
handleSystemLogNotification
Handles aSystemLogNotification
, i.e. the replies toSubscribeSystemLogRequest
.- Parameters:
edgeId
- the Edge-IDnotification
- the SystemLogNotification
-
handleEvent
public void handleEvent(org.osgi.service.event.Event event) - Specified by:
handleEvent
in interfaceorg.osgi.service.event.EventHandler
-
getChannelValues
public Map<ChannelAddress,com.google.gson.JsonElement> getChannelValues(String edgeId, Set<ChannelAddress> channelAddresses) Description copied from interface:EdgeWebsocket
Gets the latest values for the given ChannelAddresses.- Specified by:
getChannelValues
in interfaceEdgeWebsocket
- Parameters:
edgeId
- The unique Edge-IDchannelAddresses
- TheChannelAddress
es- Returns:
- the values; possibly
JsonNull
-