Package io.openems.backend.edgewebsocket
Class EdgeWebsocketImpl
java.lang.Object
io.openems.backend.common.component.AbstractOpenemsBackendComponent
io.openems.backend.edgewebsocket.EdgeWebsocketImpl
- All Implemented Interfaces:
DebugLoggable
,EdgeWebsocket
,org.osgi.service.event.EventHandler
public class EdgeWebsocketImpl
extends AbstractOpenemsBackendComponent
implements EdgeWebsocket, org.osgi.service.event.EventHandler, DebugLoggable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AppCenterMetadata.EdgeData
protected org.osgi.service.event.EventAdmin
protected Metadata
protected TimedataManager
protected UiWebsocket
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondebugLog()
Gets some output that is suitable for a continuous Debug log.Gets some output that is suitable for a debug metrics to write down asTimedata
.SortedMap<ChannelAddress,
com.google.gson.JsonElement> getChannelValues
(String edgeId, Set<ChannelAddress> channelAddresses) Gets the latest values for the given ChannelAddresses.getId()
void
handleEvent
(org.osgi.service.event.Event event) handleSubscribeSystemLogRequest
(String edgeId, User user, UUID websocketId, 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
-
appCenterMetadata
-
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, UUID websocketId, SubscribeSystemLogRequest request) throws OpenemsError.OpenemsNamedException Description copied from interface:EdgeWebsocket
Handles aSubscribeSystemLogRequest
.- Specified by:
handleSubscribeSystemLogRequest
in interfaceEdgeWebsocket
- Parameters:
edgeId
- the Edge-IDuser
- theUser
websocketId
- the id of the UI websocket connectionrequest
- 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 SortedMap<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
-
getId
-
debugLog
Description copied from interface:DebugLoggable
Gets some output that is suitable for a continuous Debug log.- Specified by:
debugLog
in interfaceDebugLoggable
- Returns:
- the debug log output; null for no log
-
debugMetrics
Description copied from interface:DebugLoggable
Gets some output that is suitable for a debug metrics to write down asTimedata
.- Specified by:
debugMetrics
in interfaceDebugLoggable
- Returns:
- the key value entries to write down; null or emptyMap for no metrics
-