Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:hybridgroup/gobot
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Dec 24, 2014
2 parents 527be9e + 944b878 commit 39b042f
Show file tree
Hide file tree
Showing 123 changed files with 5,843 additions and 7,994 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
0.8
---
- Refactor core, gpio, and i2c interfaces
- Correctly pass errors throughout packages and remove all panics
- Numerous bug fixes and performance improvements
- api
- Update robeaux to v0.3.0
- firmata
- Add optional io.ReadWriteCloser parameter to FirmataAdaptor
- Fix `thread exhaustion` error
- cli
- generator
- Update generator for new adaptor and driver interfaces
- Add driver, adaptor and project generators
- Add optional package name parameter

0.7.1
---
- opencv
Expand Down Expand Up @@ -46,7 +62,6 @@
- Fix incorrect Event names
- sphero
- Correctly format output of GetRGB
>>>>>>> master

0.6.1
---
Expand Down
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ PACKAGES := gobot gobot/api gobot/platforms/intel-iot/edison gobot/sysfs $(shell

test:
for package in $(PACKAGES) ; do \
go test github.com/hybridgroup/$$package ; \
go test -a github.com/hybridgroup/$$package ; \
done ; \

cover:
echo "mode: count" > profile.cov ; \
echo "mode: set" > profile.cov ; \
for package in $(PACKAGES) ; do \
go test -covermode=count -coverprofile=tmp.cov github.com/hybridgroup/$$package ; \
cat tmp.cov | grep -v "mode: count" >> profile.cov ; \
go test -a -coverprofile=tmp.cov github.com/hybridgroup/$$package ; \
cat tmp.cov | grep -v "mode: set" >> profile.cov ; \
done ; \
rm tmp.cov ; \

Expand All @@ -23,7 +23,8 @@ endif
cd robeaux-tmp ; \
rm fonts/* ; \
rm -r test/* ; \
rm Makefile package.json README.markdown robeaux.gemspec css/fonts.css ; \
rm -r less/* ; \
rm Makefile Gruntfile.js package.json README.markdown robeaux.gemspec css/fonts.css ; \
touch css/fonts.css ; \
echo "Updating robeaux to $(shell git rev-parse HEAD)" ; \
go-bindata -pkg="robeaux" -o robeaux.go -ignore=\\.git ./... ; \
Expand Down
92 changes: 5 additions & 87 deletions adaptor.go
Original file line number Diff line number Diff line change
@@ -1,93 +1,11 @@
package gobot

import "fmt"

type Adaptor struct {
name string
port string
connected bool
adaptorType string
}

// AdaptorInterface defines behaviour expected for a Gobot Adaptor
type AdaptorInterface interface {
Finalize() bool
Connect() bool
Port() string
type Adaptor interface {
Finalize() []error
Connect() []error
Name() string
Type() string
Connected() bool
SetConnected(bool)
SetName(string)
SetPort(string)
ToJSON() *JSONConnection
}

// NewAdaptor returns a new Adaptor given a name, adaptorType and optionally accepts:
//
// string: Port the adaptor connects to
//
// adaptorType is a label used for identification in the api
func NewAdaptor(name string, adaptorType string, v ...interface{}) *Adaptor {
if name == "" {
name = fmt.Sprintf("%X", Rand(int(^uint(0)>>1)))
}

a := &Adaptor{
adaptorType: adaptorType,
name: name,
port: "",
}

for i := range v {
switch v[i].(type) {
case string:
a.port = v[i].(string)
}
}

return a
}

// Port returns adaptor port
func (a *Adaptor) Port() string {
return a.port
}

// SetPort sets adaptor port
func (a *Adaptor) SetPort(s string) {
a.port = s
}

// Name returns adaptor name
func (a *Adaptor) Name() string {
return a.name
}

// SetName sets adaptor name
func (a *Adaptor) SetName(s string) {
a.name = s
}

// Type returns adaptor type
func (a *Adaptor) Type() string {
return a.adaptorType
}

// Connected returns true if the adaptor is connected
func (a *Adaptor) Connected() bool {
return a.connected
}

// SetConnected sets adaptor as connected/disconnected
func (a *Adaptor) SetConnected(b bool) {
a.connected = b
}

// ToJSON returns a json representation of an adaptor
func (a *Adaptor) ToJSON() *JSONConnection {
return &JSONConnection{
Name: a.Name(),
Adaptor: a.Type(),
}
type Porter interface {
Port() string
}
18 changes: 0 additions & 18 deletions adaptor_test.go

This file was deleted.

Loading

0 comments on commit 39b042f

Please sign in to comment.