This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit f0b7fb92765678ce7fa869f4bd832117f20b78e5 Author: Sebastian Rühl <[email protected]> AuthorDate: Fri Apr 16 02:23:34 2021 +0200 plc4go: fixed some public comments --- plc4go/pkg/plc4go/connection.go | 20 ++++++++++---------- plc4go/pkg/plc4go/driver.go | 10 +++++----- plc4go/pkg/plc4go/driverManager.go | 16 ++++++++-------- plc4go/pkg/plc4go/model/plc_browse.go | 4 ++-- plc4go/pkg/plc4go/model/plc_connection_metadata.go | 12 ++++++------ plc4go/pkg/plc4go/model/plc_subscription.go | 2 +- plc4go/pkg/plc4go/values/plc_value.go | 17 ++++++++--------- 7 files changed, 40 insertions(+), 41 deletions(-) diff --git a/plc4go/pkg/plc4go/connection.go b/plc4go/pkg/plc4go/connection.go index 1601ac5..1c9a58d 100644 --- a/plc4go/pkg/plc4go/connection.go +++ b/plc4go/pkg/plc4go/connection.go @@ -56,29 +56,29 @@ func NewPlcConnectionPingResult(err error) PlcConnectionPingResult { } type PlcConnection interface { - // Initiate the connection to the PLC + // Connect Initiate the connection to the PLC Connect() <-chan PlcConnectionConnectResult - // Blocking variant of Close (for usage in "defer" statements) + // BlockingClose Blocking variant of Close (for usage in "defer" statements) BlockingClose() // Close the connection to the PLC (gracefully) Close() <-chan PlcConnectionCloseResult - // Checks if the connection is currently still connected + // IsConnected Checks if the connection is currently still connected IsConnected() bool - // Executes a no-op operation to check if the current connection is still able to communicate + // Ping Executes a no-op operation to check if the current connection is still able to communicate Ping() <-chan PlcConnectionPingResult - // Get some metadata regarding the current connection + // GetMetadata Get some metadata regarding the current connection GetMetadata() model.PlcConnectionMetadata - // Create a builder for assembling read-requests + // ReadRequestBuilder Create a builder for assembling read-requests ReadRequestBuilder() model.PlcReadRequestBuilder - // Create a builder for assembling write-requests + // WriteRequestBuilder Create a builder for assembling write-requests WriteRequestBuilder() model.PlcWriteRequestBuilder - // Create a builder for assembling subscription-requests + // SubscriptionRequestBuilder Create a builder for assembling subscription-requests SubscriptionRequestBuilder() model.PlcSubscriptionRequestBuilder - // Create a builder for assembling unsubscription-requests + // UnsubscriptionRequestBuilder Create a builder for assembling unsubscription-requests UnsubscriptionRequestBuilder() model.PlcUnsubscriptionRequestBuilder - + // BrowseRequestBuilder Create a builder for assembling browser-requests BrowseRequestBuilder() model.PlcBrowseRequestBuilder } diff --git a/plc4go/pkg/plc4go/driver.go b/plc4go/pkg/plc4go/driver.go index 7794e66..80dd345 100644 --- a/plc4go/pkg/plc4go/driver.go +++ b/plc4go/pkg/plc4go/driver.go @@ -26,19 +26,19 @@ import ( ) type PlcDriver interface { - // Get the short code used to identify this driver (As used in the connection string) + // GetProtocolCode Get the short code used to identify this driver (As used in the connection string) GetProtocolCode() string - // Get a human readable name for this driver + // GetProtocolName Get a human readable name for this driver GetProtocolName() string - // If the driver has a default form of transport, provide this and make + // GetDefaultTransport If the driver has a default form of transport, provide this and make // providing the transport code optional in the connection string GetDefaultTransport() string - // Have the driver parse the query string and provide feedback if it's not a valid one + // CheckQuery Have the driver parse the query string and provide feedback if it's not a valid one CheckQuery(query string) error - // Establishes a connection to a given PLC using the information in the connectionString + // GetConnection Establishes a connection to a given PLC using the information in the connectionString GetConnection(transportUrl url.URL, transports map[string]transports.Transport, options map[string][]string) <-chan PlcConnectionConnectResult SupportsDiscovery() bool diff --git a/plc4go/pkg/plc4go/driverManager.go b/plc4go/pkg/plc4go/driverManager.go index 495cd6c..7949712 100644 --- a/plc4go/pkg/plc4go/driverManager.go +++ b/plc4go/pkg/plc4go/driverManager.go @@ -29,24 +29,24 @@ import ( // This is the main entry point for PLC4Go applications type PlcDriverManager interface { - // Manually register a new driver + // RegisterDriver Manually register a new driver RegisterDriver(driver PlcDriver) - // List the names of all drivers registered in the system + // ListDriverNames List the names of all drivers registered in the system ListDriverNames() []string - // Get access to a driver instance for a given driver-name + // GetDriver Get access to a driver instance for a given driver-name GetDriver(driverName string) (PlcDriver, error) - // Manually register a new driver + // RegisterTransport Manually register a new driver RegisterTransport(transport transports.Transport) - // List the names of all drivers registered in the system + // ListTransportNames List the names of all drivers registered in the system ListTransportNames() []string - // Get access to a driver instance for a given driver-name + // GetTransport Get access to a driver instance for a given driver-name GetTransport(transportName string, connectionString string, options map[string][]string) (transports.Transport, error) - // Get a connection to a remote PLC for a given plc4x connection-string + // GetConnection Get a connection to a remote PLC for a given plc4x connection-string GetConnection(connectionString string) <-chan PlcConnectionConnectResult - // Execute all available discovery methods on all available drivers using all transports + // Discover Execute all available discovery methods on all available drivers using all transports Discover(func(event model.PlcDiscoveryEvent)) error } diff --git a/plc4go/pkg/plc4go/model/plc_browse.go b/plc4go/pkg/plc4go/model/plc_browse.go index 86351b0..f51ac1c 100644 --- a/plc4go/pkg/plc4go/model/plc_browse.go +++ b/plc4go/pkg/plc4go/model/plc_browse.go @@ -34,9 +34,9 @@ type PlcBrowseQueryResult struct { } type PlcBrowseRequest interface { - // Will not return until a potential scan is finished and will return all results in one block + // Execute Will not return until a potential scan is finished and will return all results in one block Execute() <-chan PlcBrowseRequestResult - // Will call the given callback for every found resource + // ExecuteWithInterceptor Will call the given callback for every found resource ExecuteWithInterceptor(interceptor func(result PlcBrowseEvent) bool) <-chan PlcBrowseRequestResult GetQueryNames() []string GetQueryString(name string) string diff --git a/plc4go/pkg/plc4go/model/plc_connection_metadata.go b/plc4go/pkg/plc4go/model/plc_connection_metadata.go index 7ce6930..aa5f770 100644 --- a/plc4go/pkg/plc4go/model/plc_connection_metadata.go +++ b/plc4go/pkg/plc4go/model/plc_connection_metadata.go @@ -19,19 +19,19 @@ package model -// Information about connection capabilities. +// PlcConnectionMetadata Information about connection capabilities. // This includes connection and driver specific metadata. type PlcConnectionMetadata interface { - // Gives access to a map of additional information the driver might be able to provide. + // GetConnectionAttributes Gives access to a map of additional information the driver might be able to provide. GetConnectionAttributes() map[string]string - // Indicates that the connection supports reading. + // CanRead Indicates that the connection supports reading. CanRead() bool - // Indicates that the connection supports writing. + // CanWrite Indicates that the connection supports writing. CanWrite() bool - // Indicates that the connection supports subscription. + // CanSubscribe Indicates that the connection supports subscription. CanSubscribe() bool - // Indicates that the connection supports browsing. + // CanBrowse Indicates that the connection supports browsing. CanBrowse() bool } diff --git a/plc4go/pkg/plc4go/model/plc_subscription.go b/plc4go/pkg/plc4go/model/plc_subscription.go index a0279c0..d139762 100644 --- a/plc4go/pkg/plc4go/model/plc_subscription.go +++ b/plc4go/pkg/plc4go/model/plc_subscription.go @@ -25,12 +25,12 @@ import ( ) type PlcSubscriptionEvent interface { + PlcResponse GetRequest() PlcSubscriptionRequest GetFieldNames() []string GetResponseCode(name string) PlcResponseCode GetAddress(name string) string GetValue(name string) values.PlcValue - PlcResponse } type PlcSubscriptionEventHandler func(event PlcSubscriptionEvent) diff --git a/plc4go/pkg/plc4go/values/plc_value.go b/plc4go/pkg/plc4go/values/plc_value.go index d07a2e4..26b6100 100644 --- a/plc4go/pkg/plc4go/values/plc_value.go +++ b/plc4go/pkg/plc4go/values/plc_value.go @@ -88,17 +88,16 @@ type PlcValue interface { GetStruct() map[string]PlcValue } -/* - This type is used in cases where the driver doesn't have access to type information and therefore can't decode - the payload yet. This allows an application to take the raw plc-value and have the payload decoded later. -*/ +// RawPlcValue This type is used in cases where the driver doesn't have access to type information and therefore can't decode +// the payload yet. This allows an application to take the raw plc-value and have the payload decoded later. type RawPlcValue interface { - // Read the internal buffer and parse a value of given type + // PlcValue the base value + PlcValue + + // RawDecodeValue Read the internal buffer and parse a value of given type RawDecodeValue(typeName string) PlcValue - // If the internal read-buffer has not yet reached the end + // RawHasMore If the internal read-buffer has not yet reached the end RawHasMore() bool - // Reset the internal read-buffer (For the case that a raw plc-value has to be parsed multiple times) + // RawReset Reset the internal read-buffer (For the case that a raw plc-value has to be parsed multiple times) RawReset() - - PlcValue }
