mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-05-11 19:29:20 +08:00
firmata: restrict scope for ble serial port for ble firmata adaptor
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
37ca4142ea
commit
c5f3427586
@ -17,7 +17,6 @@ const (
|
||||
// BLEAdaptor represents a Bluetooth LE based connection to a
|
||||
// microcontroller running FirmataBLE
|
||||
type BLEAdaptor struct {
|
||||
SerialPort *ble.SerialPort
|
||||
*Adaptor
|
||||
}
|
||||
|
||||
@ -33,16 +32,15 @@ func NewBLEAdaptor(args ...interface{}) *BLEAdaptor {
|
||||
wid = args[2].(string)
|
||||
}
|
||||
|
||||
sp := ble.NewSerialPort(address, rid, wid)
|
||||
a := NewAdaptor(address)
|
||||
a.SetName("BLEFirmata")
|
||||
a.PortOpener = func(port string) (io.ReadWriteCloser, error) {
|
||||
sp := ble.NewSerialPort(address, rid, wid)
|
||||
sp.Open()
|
||||
return sp, nil
|
||||
}
|
||||
|
||||
return &BLEAdaptor{
|
||||
Adaptor: a,
|
||||
SerialPort: sp,
|
||||
Adaptor: a,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user