Package com.hivemq.adapter.sdk.api
Interface ProtocolAdapter
-
- All Known Subinterfaces:
PollingProtocolAdapter
public interface ProtocolAdapterA protocol adapter is the resource responsible for connecting to and providing data from disparate remote or local device. The implementation must manage its resources internally, and adhere to the semantic lifecycle applied to the adapter instances.- Since:
- 2023.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voiddestroy()Called by the framework when the instance will be discardeddefault @NotNull CompletableFuture<Void>discoverValues(@NotNull ProtocolAdapterDiscoveryInput input, @NotNull ProtocolAdapterDiscoveryOutput output)This method needs to be implemented in case the adapter provides the possibility to discover values at the PLC.@NotNull StringgetId()The adapter identifier represents a unique id/name of the instance within the runtime.@NotNull ProtocolAdapterInformationgetProtocolAdapterInformation()voidstart(@NotNull ProtocolAdapterStartInput input, @NotNull ProtocolAdapterStartOutput output)Start the adapter, establishing a connection to any internal or external device using the configuration supplied during instantiation.voidstop(@NotNull ProtocolAdapterStopInput input, @NotNull ProtocolAdapterStopOutput output)Stop the adapter.
-
-
-
Method Detail
-
getId
@NotNull @NotNull String getId()
The adapter identifier represents a unique id/name of the instance within the runtime. This value should be considered immutable.- Returns:
- A string ID conform to the regex ([a-zA-Z_0-9-_])* which uniquely identifies the instance of the adapter.
-
start
void start(@NotNull @NotNull ProtocolAdapterStartInput input, @NotNull @NotNull ProtocolAdapterStartOutput output)
Start the adapter, establishing a connection to any internal or external device using the configuration supplied during instantiation.- Parameters:
input- - the state associated with runtime. Allows the adapter to bind to required services in a decoupled manneroutput- - the output to signal back to HiveMQ Edge the status of the start attempt.
-
stop
void stop(@NotNull @NotNull ProtocolAdapterStopInput input, @NotNull @NotNull ProtocolAdapterStopOutput output)
Stop the adapter. Stopping the adapter must release any network interface connections or local resources associated with the connection to the device. State relating to the connection however will be retained allowing the start method to restart the adapter.- Parameters:
input- the input for the stop (currently empty)output- the output to signal back to HiveMQ Edge the status of the stop attempt.
-
discoverValues
@NotNull default @NotNull CompletableFuture<Void> discoverValues(@NotNull @NotNull ProtocolAdapterDiscoveryInput input, @NotNull @NotNull ProtocolAdapterDiscoveryOutput output)
This method needs to be implemented in case the adapter provides the possibility to discover values at the PLC.- Parameters:
input- an input object containing information during the discovery processoutput- an output object to set the discovered nodes on.- Returns:
- a completable future to signal the finishing of the discovery process
-
getProtocolAdapterInformation
@NotNull @NotNull ProtocolAdapterInformation getProtocolAdapterInformation()
- Returns:
- the
ProtocolAdapterInformationcontaining information about this protocol adapter instance.
-
destroy
default void destroy()
Called by the framework when the instance will be discarded
-
-