Remove Reconnect and Disconnect from AdaptorInterface

This commit is contained in:
Adrian Zankich 2014-04-15 19:26:07 -07:00
parent 8d4a851fd3
commit 646362a75c
3 changed files with 2 additions and 18 deletions

View File

@ -10,6 +10,4 @@ type Adaptor struct {
type AdaptorInterface interface {
Finalize() bool
Connect() bool
Disconnect() bool
Reconnect() bool
}

View File

@ -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()
}

View File

@ -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)