forked from hybridgroup/gobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hybridgroup#75 from hybridgroup/dev
0.6 release
- Loading branch information
Showing
109 changed files
with
7,150 additions
and
1,127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.sass-cache | ||
*.test | ||
robeaux | ||
profile.cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
0.6 | ||
--- | ||
- api | ||
- Add robeaux support | ||
- core | ||
- Refactor `Connection` and `Device` | ||
- Connections are now a collection of Adaptors | ||
- Devices are now a collection of Drivers | ||
- Add `Event(string)` function instead of `Events[string]` for retrieving Driver event | ||
- Add `AddEvent(string)` function to register an event on a Driver | ||
- firmata | ||
- Fix slice bounds out of range error | ||
- sphero | ||
- Fix issue where the driver would not halt correctly on OSX | ||
|
||
0.5.2 | ||
--- | ||
- beaglebone | ||
- Add `DirectPinDriver` | ||
- Ensure slots are properly loaded | ||
|
||
0.5.1 | ||
--- | ||
- core | ||
- Add `Version()` function for Gobot version retrieval | ||
- firmata | ||
- Fix issue with reading analog inputs | ||
- Add `data` event for `AnalogSensorDriver` | ||
|
||
0.5 | ||
--- | ||
- Idomatic clean up | ||
- Removed reflections throughout packages | ||
- All officially supported platforms are now in ./platforms | ||
- API is now a new package ./api | ||
- All platforms examples are in ./examples | ||
- Replaced martini with net/http | ||
- Replaced ginkgo/gomega with system testing package | ||
- Refactor gobot/robot/device commands | ||
- Added Event type | ||
- Replaced Master type with Gobot type | ||
- Every` and `After` now accept `time.Duration` | ||
- Removed reflection helper methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
PACKAGES := "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/api" "github.com/hybridgroup/gobot/platforms/ardrone" "github.com/hybridgroup/gobot/platforms/beaglebone" "github.com/hybridgroup/gobot/platforms/digispark" "github.com/hybridgroup/gobot/platforms/firmata" "github.com/hybridgroup/gobot/platforms/gpio" "github.com/hybridgroup/gobot/platforms/i2c" "github.com/hybridgroup/gobot/platforms/leap" "github.com/hybridgroup/gobot/platforms/neurosky" "github.com/hybridgroup/gobot/platforms/pebble" "github.com/hybridgroup/gobot/platforms/spark" "github.com/hybridgroup/gobot/platforms/sphero" "github.com/hybridgroup/gobot/platforms/opencv" "github.com/hybridgroup/gobot/platforms/joystick" | ||
PACKAGES := gobot gobot/api $(shell ls ./platforms | sed -e 's/^/gobot\/platforms\//') | ||
|
||
.PHONY: test cover robeaux | ||
|
||
test: | ||
for package in $(PACKAGES) ; do \ | ||
go test $$package ; \ | ||
go test github.com/hybridgroup/$$package ; \ | ||
done ; \ | ||
|
||
cover: | ||
echo "mode: count" > profile.cov ; \ | ||
for package in $(PACKAGES) ; do \ | ||
go test -covermode=count -coverprofile=tmp.cov $$package ; \ | ||
go test -covermode=count -coverprofile=tmp.cov github.com/hybridgroup/$$package ; \ | ||
cat tmp.cov | grep -v "mode: count" >> profile.cov ; \ | ||
done ; \ | ||
rm tmp.cov ; \ | ||
|
||
robeaux: | ||
ifeq (,$(shell which go-bindata)) | ||
$(error robeaux not built! https://github.com/jteeuwen/go-bindata is required to build robeaux assets ) | ||
endif | ||
cd api ; \ | ||
git clone --depth 1 git://github.com/hybridgroup/robeaux.git robeaux-tmp; \ | ||
cd robeaux-tmp ; \ | ||
rm fonts/* ; \ | ||
rm Makefile 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 ./... ; \ | ||
mv robeaux.go ../robeaux ; \ | ||
cd .. ; \ | ||
rm -rf robeaux-tmp/ ; \ | ||
go fmt ./robeaux/robeaux.go ; \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,86 @@ | ||
package gobot | ||
|
||
import "fmt" | ||
|
||
type Adaptor struct { | ||
Name string | ||
Port string | ||
Connected bool | ||
Params map[string]interface{} | ||
name string | ||
port string | ||
connected bool | ||
params map[string]interface{} | ||
adaptorType string | ||
} | ||
|
||
type AdaptorInterface interface { | ||
Finalize() bool | ||
Connect() bool | ||
port() string | ||
name() string | ||
setName(string) | ||
params() map[string]interface{} | ||
Port() string | ||
Name() string | ||
Type() string | ||
Connected() bool | ||
SetConnected(bool) | ||
SetName(string) | ||
Params() map[string]interface{} | ||
ToJSON() *JSONConnection | ||
} | ||
|
||
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: "", | ||
params: make(map[string]interface{}), | ||
} | ||
|
||
for i := range v { | ||
switch v[i].(type) { | ||
case string: | ||
a.port = v[i].(string) | ||
case map[string]interface{}: | ||
a.params = v[i].(map[string]interface{}) | ||
default: | ||
fmt.Println("Unknown argument passed to NewAdaptor") | ||
} | ||
} | ||
|
||
return a | ||
} | ||
|
||
func (a *Adaptor) Port() string { | ||
return a.port | ||
} | ||
|
||
func (a *Adaptor) Name() string { | ||
return a.name | ||
} | ||
|
||
func (a *Adaptor) SetName(s string) { | ||
a.name = s | ||
} | ||
|
||
func (a *Adaptor) Type() string { | ||
return a.adaptorType | ||
} | ||
|
||
func (a *Adaptor) port() string { | ||
return a.Port | ||
func (a *Adaptor) Connected() bool { | ||
return a.connected | ||
} | ||
|
||
func (a *Adaptor) name() string { | ||
return a.Name | ||
func (a *Adaptor) SetConnected(b bool) { | ||
a.connected = b | ||
} | ||
|
||
func (a *Adaptor) setName(s string) { | ||
a.Name = s | ||
func (a *Adaptor) Params() map[string]interface{} { | ||
return a.params | ||
} | ||
|
||
func (a *Adaptor) params() map[string]interface{} { | ||
return a.Params | ||
func (a *Adaptor) ToJSON() *JSONConnection { | ||
return &JSONConnection{ | ||
Name: a.Name(), | ||
Port: a.Port(), | ||
Adaptor: a.Type(), | ||
} | ||
} |
Oops, something went wrong.