You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/06/07 13:08:06 UTC
[plc4x] 01/03: refactor(plc4go): deduplicate package name out of struct names
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 524c2c836fa78e8843dc525471adf45da856fedd
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Jun 7 13:57:45 2023 +0200
refactor(plc4go): deduplicate package name out of struct names
---
plc4go/internal/eip/{EipDriver.go => Driver.go} | 0
plc4go/internal/modbus/{ModbusAsciiDriver.go => AsciiDriver.go} | 8 ++++----
plc4go/internal/modbus/{ModbusRtuDriver.go => RtuDriver.go} | 8 ++++----
plc4go/internal/modbus/{ModbusTcpDriver.go => TcpDriver.go} | 8 ++++----
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/plc4go/internal/eip/EipDriver.go b/plc4go/internal/eip/Driver.go
similarity index 100%
rename from plc4go/internal/eip/EipDriver.go
rename to plc4go/internal/eip/Driver.go
diff --git a/plc4go/internal/modbus/ModbusAsciiDriver.go b/plc4go/internal/modbus/AsciiDriver.go
similarity index 92%
rename from plc4go/internal/modbus/ModbusAsciiDriver.go
rename to plc4go/internal/modbus/AsciiDriver.go
index 783f1327ac..4d77c1fb9d 100644
--- a/plc4go/internal/modbus/ModbusAsciiDriver.go
+++ b/plc4go/internal/modbus/AsciiDriver.go
@@ -34,21 +34,21 @@ import (
"strconv"
)
-type ModbusAsciiDriver struct {
+type AsciiDriver struct {
_default.DefaultDriver
log zerolog.Logger // TODO: use it
}
-func NewModbusAsciiDriver(_options ...options.WithOption) *ModbusAsciiDriver {
- driver := &ModbusAsciiDriver{
+func NewModbusAsciiDriver(_options ...options.WithOption) *AsciiDriver {
+ driver := &AsciiDriver{
log: options.ExtractCustomLogger(_options...),
}
driver.DefaultDriver = _default.NewDefaultDriver(driver, "modbus-ascii", "Modbus ASCII", "serial", NewTagHandler())
return driver
}
-func (m ModbusAsciiDriver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, connectionOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult {
+func (m AsciiDriver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, connectionOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult {
m.log.Debug().Stringer("transportUrl", &transportUrl).Msgf("Get connection for transport url with %d transport(s) and %d option(s)", len(transports), len(connectionOptions))
// Get an the transport specified in the url
transport, ok := transports[transportUrl.Scheme]
diff --git a/plc4go/internal/modbus/ModbusRtuDriver.go b/plc4go/internal/modbus/RtuDriver.go
similarity index 92%
rename from plc4go/internal/modbus/ModbusRtuDriver.go
rename to plc4go/internal/modbus/RtuDriver.go
index 62120ca44f..7e285e0fc6 100644
--- a/plc4go/internal/modbus/ModbusRtuDriver.go
+++ b/plc4go/internal/modbus/RtuDriver.go
@@ -34,21 +34,21 @@ import (
"strconv"
)
-type ModbusRtuDriver struct {
+type RtuDriver struct {
_default.DefaultDriver
log zerolog.Logger // TODO: use it
}
-func NewModbusRtuDriver(_options ...options.WithOption) *ModbusRtuDriver {
- driver := &ModbusRtuDriver{
+func NewModbusRtuDriver(_options ...options.WithOption) *RtuDriver {
+ driver := &RtuDriver{
log: options.ExtractCustomLogger(_options...),
}
driver.DefaultDriver = _default.NewDefaultDriver(driver, "modbus-rtu", "Modbus RTU", "serial", NewTagHandler())
return driver
}
-func (m ModbusRtuDriver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, driverOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult {
+func (m RtuDriver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, driverOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult {
m.log.Debug().Stringer("transportUrl", &transportUrl).Msgf("Get connection for transport url with %d transport(s) and %d option(s)", len(transports), len(driverOptions))
// Get an the transport specified in the url
transport, ok := transports[transportUrl.Scheme]
diff --git a/plc4go/internal/modbus/ModbusTcpDriver.go b/plc4go/internal/modbus/TcpDriver.go
similarity index 92%
rename from plc4go/internal/modbus/ModbusTcpDriver.go
rename to plc4go/internal/modbus/TcpDriver.go
index 7267bdede8..ffacff0073 100644
--- a/plc4go/internal/modbus/ModbusTcpDriver.go
+++ b/plc4go/internal/modbus/TcpDriver.go
@@ -34,21 +34,21 @@ import (
"strconv"
)
-type ModbusTcpDriver struct {
+type TcpDriver struct {
_default.DefaultDriver
log zerolog.Logger // TODO: use it
}
-func NewModbusTcpDriver(_options ...options.WithOption) *ModbusTcpDriver {
- driver := &ModbusTcpDriver{
+func NewModbusTcpDriver(_options ...options.WithOption) *TcpDriver {
+ driver := &TcpDriver{
log: options.ExtractCustomLogger(_options...),
}
driver.DefaultDriver = _default.NewDefaultDriver(driver, "modbus-tcp", "Modbus TCP", "tcp", NewTagHandler())
return driver
}
-func (m ModbusTcpDriver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, driverOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult {
+func (m TcpDriver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, driverOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult {
m.log.Debug().Stringer("transportUrl", &transportUrl).Msgf("Get connection for transport url with %d transport(s) and %d option(s)", len(transports), len(driverOptions))
// Get an the transport specified in the url
transport, ok := transports[transportUrl.Scheme]