From dedc74f03ddee8552c2209275d16e630f68f51ae Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Sun, 15 Jun 2014 17:27:51 -0700 Subject: [PATCH] Update generator --- gobot/generate.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gobot/generate.go b/gobot/generate.go index 9c3247bf..bf235ed3 100644 --- a/gobot/generate.go +++ b/gobot/generate.go @@ -142,7 +142,6 @@ import ( type {{ .UpperName }}Driver struct { gobot.Driver - Adaptor *{{ .UpperName }}Adaptor } type {{ .UpperName }}Interface interface { @@ -154,11 +153,15 @@ func New{{.UpperName}}Driver(a *{{.UpperName}}Adaptor, name string) *{{.UpperNam Name: name, Events: make(map[string]*gobot.Event), Commands: make(map[string]func(map[string]interface{}) interface{}), + Adaptor: a, }, - Adaptor: a, } } +func ({{.FirstLetter}} *{{ .UpperName }}Driver) adaptor() *{{ .UpperName }}Adaptor { + return {{ .FirstLetter }}.Driver.Adaptor.(*{{ .UpperName }}Adaptor) +} + func ({{.FirstLetter}} *{{ .UpperName }}Driver) Start() bool { return true } func ({{.FirstLetter}} *{{ .UpperName }}Driver) Halt() bool { return true } `