Remove Reconnect and Disconnect from AdaptorInterface
This commit is contained in:
parent
8d4a851fd3
commit
646362a75c
|
@ -10,6 +10,4 @@ type Adaptor struct {
|
|||
type AdaptorInterface interface {
|
||||
Finalize() bool
|
||||
Connect() bool
|
||||
Disconnect() bool
|
||||
Reconnect() bool
|
||||
}
|
||||
|
|
|
@ -14,9 +14,7 @@ type connection struct {
|
|||
|
||||
type Connection interface {
|
||||
Connect() bool
|
||||
Disconnect() bool
|
||||
Finalize() bool
|
||||
Reconnect() bool
|
||||
}
|
||||
|
||||
func NewConnection(adaptor AdaptorInterface, r *Robot) *connection {
|
||||
|
@ -38,17 +36,7 @@ func (c *connection) Connect() bool {
|
|||
return c.Adaptor.Connect()
|
||||
}
|
||||
|
||||
func (c *connection) Disconnect() bool {
|
||||
log.Println("Disconnecting " + c.Name + "...")
|
||||
return c.Adaptor.Disconnect()
|
||||
}
|
||||
|
||||
func (c *connection) Finalize() bool {
|
||||
log.Println("Finalizing " + c.Name + "...")
|
||||
return c.Adaptor.Finalize()
|
||||
}
|
||||
|
||||
func (c *connection) Reconnect() bool {
|
||||
log.Println("Reconnecting to " + c.Name + " on port " + c.Port + "...")
|
||||
return c.Adaptor.Reconnect()
|
||||
}
|
||||
|
|
|
@ -25,10 +25,8 @@ type testAdaptor struct {
|
|||
Adaptor
|
||||
}
|
||||
|
||||
func (me *testAdaptor) Finalize() bool { return true }
|
||||
func (me *testAdaptor) Connect() bool { return true }
|
||||
func (me *testAdaptor) Disconnect() bool { return true }
|
||||
func (me *testAdaptor) Reconnect() bool { return true }
|
||||
func (me *testAdaptor) Finalize() bool { return true }
|
||||
func (me *testAdaptor) Connect() bool { return true }
|
||||
|
||||
func newTestDriver(name string, adaptor *testAdaptor) *testDriver {
|
||||
d := new(testDriver)
|
||||
|
|
Loading…
Reference in New Issue