Package org.apache.plc4x.java.api
Interface PlcConnection
-
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
EventPlcConnection
public interface PlcConnection extends AutoCloseable
Interface defining the most basic methods a PLC4X connection should support. This generally handles the connection establishment itself and the parsing of tag address strings to the platform dependent PlcTag instances.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description PlcBrowseRequest.Builder
browseRequestBuilder()
void
close()
Closes the connection to the remote PLC.void
connect()
Establishes the connection to the remote PLC.PlcConnectionMetadata
getMetadata()
Provides connection metadata.boolean
isConnected()
Indicates if the connection is established to a remote PLC.default PlcTag
parseTagAddress(String tagAddress)
Deprecated.CompletableFuture<? extends PlcPingResponse>
ping()
Execute a ping query against a remote device to check the availability of the connection.PlcReadRequest.Builder
readRequestBuilder()
PlcSubscriptionRequest.Builder
subscriptionRequestBuilder()
PlcUnsubscriptionRequest.Builder
unsubscriptionRequestBuilder()
PlcWriteRequest.Builder
writeRequestBuilder()
-
-
-
Method Detail
-
connect
void connect() throws PlcConnectionException
Establishes the connection to the remote PLC.- Throws:
PlcConnectionException
- if the connection attempt failed
-
isConnected
boolean isConnected()
Indicates if the connection is established to a remote PLC.- Returns:
true
if connected,false
otherwise
-
close
void close() throws Exception
Closes the connection to the remote PLC.- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
- if shutting down the connection failed
-
parseTagAddress
@Deprecated default PlcTag parseTagAddress(String tagAddress) throws PlcInvalidTagException
Deprecated.Parse a tagAddress for the given connection type.- Throws:
PlcRuntimeException
- If the string cannot be parsedPlcInvalidTagException
-
getMetadata
PlcConnectionMetadata getMetadata()
Provides connection metadata.
-
ping
CompletableFuture<? extends PlcPingResponse> ping()
Execute a ping query against a remote device to check the availability of the connection.- Returns:
- CompletableFuture that is completed successfully (Void) or unsuccessfully with an PlcException.
-
readRequestBuilder
PlcReadRequest.Builder readRequestBuilder()
- Returns:
- read request builder.
- Throws:
PlcUnsupportedOperationException
- if the connection does not support reading
-
writeRequestBuilder
PlcWriteRequest.Builder writeRequestBuilder()
- Returns:
- write request builder.
- Throws:
PlcUnsupportedOperationException
- if the connection does not support writing
-
subscriptionRequestBuilder
PlcSubscriptionRequest.Builder subscriptionRequestBuilder()
- Returns:
- subscription request builder.
- Throws:
PlcUnsupportedOperationException
- if the connection does not support subscription
-
unsubscriptionRequestBuilder
PlcUnsubscriptionRequest.Builder unsubscriptionRequestBuilder()
- Returns:
- unsubscription request builder.
- Throws:
PlcUnsupportedOperationException
- if the connection does not support subscription
-
browseRequestBuilder
PlcBrowseRequest.Builder browseRequestBuilder()
- Returns:
- browse request builder.
- Throws:
PlcUnsupportedOperationException
- if the connection does not support browsing
-
-