mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-27 13:48:56 +08:00
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 {
|
type AdaptorInterface interface {
|
||||||
Finalize() bool
|
Finalize() bool
|
||||||
Connect() bool
|
Connect() bool
|
||||||
Disconnect() bool
|
|
||||||
Reconnect() bool
|
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,7 @@ type connection struct {
|
|||||||
|
|
||||||
type Connection interface {
|
type Connection interface {
|
||||||
Connect() bool
|
Connect() bool
|
||||||
Disconnect() bool
|
|
||||||
Finalize() bool
|
Finalize() bool
|
||||||
Reconnect() bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConnection(adaptor AdaptorInterface, r *Robot) *connection {
|
func NewConnection(adaptor AdaptorInterface, r *Robot) *connection {
|
||||||
@ -38,17 +36,7 @@ func (c *connection) Connect() bool {
|
|||||||
return c.Adaptor.Connect()
|
return c.Adaptor.Connect()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *connection) Disconnect() bool {
|
|
||||||
log.Println("Disconnecting " + c.Name + "...")
|
|
||||||
return c.Adaptor.Disconnect()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *connection) Finalize() bool {
|
func (c *connection) Finalize() bool {
|
||||||
log.Println("Finalizing " + c.Name + "...")
|
log.Println("Finalizing " + c.Name + "...")
|
||||||
return c.Adaptor.Finalize()
|
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
|
Adaptor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *testAdaptor) Finalize() bool { return true }
|
func (me *testAdaptor) Finalize() bool { return true }
|
||||||
func (me *testAdaptor) Connect() 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 newTestDriver(name string, adaptor *testAdaptor) *testDriver {
|
func newTestDriver(name string, adaptor *testAdaptor) *testDriver {
|
||||||
d := new(testDriver)
|
d := new(testDriver)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user