Skip to content

Commit

Permalink
Format device and connection type
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Apr 19, 2014
1 parent 345b60d commit 076f24e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ type Connection interface {

func NewConnection(adaptor AdaptorInterface, r *Robot) *connection {
c := new(connection)
c.Type = reflect.ValueOf(adaptor).Type().String()
s := reflect.ValueOf(adaptor).Type().String()
c.Type = s[1:len(s)]
c.Name = FieldByNamePtr(adaptor, "Name").String()
c.Port = FieldByNamePtr(adaptor, "Port").String()
c.Params = make(map[string]interface{})
Expand Down
3 changes: 2 additions & 1 deletion device.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ type Device interface {

func NewDevice(driver DriverInterface, r *Robot) *device {
d := new(device)
d.Type = reflect.ValueOf(driver).Type().String()
s := reflect.ValueOf(driver).Type().String()
d.Type = s[1:len(s)]
d.Name = FieldByNamePtr(driver, "Name").String()
d.Robot = r
if FieldByNamePtr(driver, "Interval").String() == "" {
Expand Down

0 comments on commit 076f24e

Please sign in to comment.