hybridgroup.gobot/adaptor.go

41 lines
587 B
Go

package gobot
type Adaptor struct {
Name string
Port string
Connected bool
Params map[string]interface{}
}
func (Adaptor) NewAdaptor(a Adaptor) Adaptor {
return a
}
func (a *Adaptor) Finalize() bool {
if a.IsConnected() {
a.Disconnect()
}
return true
}
func (a *Adaptor) Connect() bool {
a.Connected = true
return true
}
func (a *Adaptor) Disconnect() bool {
a.Connected = false
return true
}
func (a *Adaptor) Reconnect() bool {
if !a.IsConnected() {
return a.Connect()
}
return true
}
func (a *Adaptor) IsConnected() bool {
return a.Connected
}