Package com.hivemq.adapter.sdk.api
Interface ProtocolAdapter
- All Known Subinterfaces:
PollingProtocolAdapter,WritingProtocolAdapter
public interface ProtocolAdapter
A 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
Modifier and TypeMethodDescriptiondefault voidcreateTagSchema(@NotNull TagSchemaCreationInput input, @NotNull TagSchemaCreationOutput output) This method is intended to retrieve the json schema that represents the data of a tag on a PLC.default voiddestroy()Called by the framework when the instance will be discardeddefault voiddiscoverValues(@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.getId()The adapter identifier represents a unique id/name of the instance within the runtime.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 Details
-
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
default 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 and signal edge that the discovery process has finished.
-
getProtocolAdapterInformation
- Returns:
- the
ProtocolAdapterInformationcontaining information about this protocol adapter instance.
-
destroy
default void destroy()Called by the framework when the instance will be discarded -
createTagSchema
default void createTagSchema(@NotNull @NotNull TagSchemaCreationInput input, @NotNull @NotNull TagSchemaCreationOutput output) This method is intended to retrieve the json schema that represents the data of a tag on a PLC. The json schema is used to create mappings between incoming and outgoing data.- Parameters:
input- the input object holding information necessary for the operation.output- the output object on which the result of the operation can be set.
-