firmata: use new improved default namer to avoid API conflicts
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
5d90090d57
commit
0c06d0bd97
|
@ -3,6 +3,7 @@ package firmata
|
|||
import (
|
||||
"io"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
"gobot.io/x/gobot/platforms/ble"
|
||||
)
|
||||
|
||||
|
@ -33,7 +34,7 @@ func NewBLEAdaptor(args ...interface{}) *BLEAdaptor {
|
|||
}
|
||||
|
||||
a := NewAdaptor(address)
|
||||
a.SetName("BLEFirmata")
|
||||
a.SetName(gobot.DefaultName("BLEFirmata"))
|
||||
a.PortOpener = func(port string) (io.ReadWriteCloser, error) {
|
||||
sp := ble.NewSerialPort(address, rid, wid)
|
||||
sp.Open()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package firmata
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
|
@ -16,5 +17,5 @@ func initTestBLEAdaptor() *BLEAdaptor {
|
|||
|
||||
func TestFirmataBLEAdaptor(t *testing.T) {
|
||||
a := initTestBLEAdaptor()
|
||||
gobottest.Assert(t, a.Name(), "BLEFirmata")
|
||||
gobottest.Assert(t, strings.HasPrefix(a.Name(), "BLEFirmata"), true)
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ type Adaptor struct {
|
|||
// string port as a label to be displayed in the log and api.
|
||||
func NewAdaptor(args ...interface{}) *Adaptor {
|
||||
f := &Adaptor{
|
||||
name: "Firmata",
|
||||
name: gobot.DefaultName("Firmata"),
|
||||
port: "",
|
||||
conn: nil,
|
||||
board: client.New(),
|
||||
|
|
|
@ -3,6 +3,8 @@ package firmata
|
|||
import (
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
)
|
||||
|
||||
// TCPAdaptor represents a TCP based connection to a microcontroller running
|
||||
|
@ -21,7 +23,7 @@ func NewTCPAdaptor(args ...interface{}) *TCPAdaptor {
|
|||
address := args[0].(string)
|
||||
|
||||
a := NewAdaptor(address)
|
||||
a.SetName("TCPFirmata")
|
||||
a.SetName(gobot.DefaultName("TCPFirmata"))
|
||||
a.PortOpener = func(port string) (io.ReadWriteCloser, error) {
|
||||
return connect(port)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package firmata
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
|
@ -16,5 +17,5 @@ func initTestTCPAdaptor() *TCPAdaptor {
|
|||
|
||||
func TestFirmataTCPAdaptor(t *testing.T) {
|
||||
a := initTestTCPAdaptor()
|
||||
gobottest.Assert(t, a.Name(), "TCPFirmata")
|
||||
gobottest.Assert(t, strings.HasPrefix(a.Name(), "TCPFirmata"), true)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue