diff --git a/gobot.go b/gobot.go index 58a0d7b8..93f49c53 100644 --- a/gobot.go +++ b/gobot.go @@ -58,6 +58,10 @@ func (g *Gobot) Robots() *robots { return g.robots } +func (g *Gobot) AddRobot(r *Robot) *Robot { + return g.Robots().Add(r) +} + func (g *Gobot) Robot(name string) *Robot { for _, robot := range g.Robots().robots { if robot.Name == name { diff --git a/robot.go b/robot.go index 7934fd55..3728a542 100644 --- a/robot.go +++ b/robot.go @@ -113,6 +113,10 @@ func (r *Robot) Devices() *devices { return r.devices } +func (r *Robot) AddDevice(d Device) Device { + return r.Devices().Add(d) +} + func (r *Robot) Device(name string) Device { if r == nil { return nil @@ -129,6 +133,10 @@ func (r *Robot) Connections() *connections { return r.connections } +func (r *Robot) AddConnection(c Connection) Connection { + return r.Connections().Add(c) +} + func (r *Robot) Connection(name string) Connection { if r == nil { return nil