ble: correct spelling error in function name
Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
parent
8e6391105d
commit
5c74cab289
|
@ -28,7 +28,7 @@ type BLEConnector interface {
|
||||||
ReadCharacteristic(string) ([]byte, error)
|
ReadCharacteristic(string) ([]byte, error)
|
||||||
WriteCharacteristic(string, []byte) error
|
WriteCharacteristic(string, []byte) error
|
||||||
Subscribe(string, func([]byte, error)) error
|
Subscribe(string, func([]byte, error)) error
|
||||||
WithoutReponses(bool)
|
WithoutResponses(bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientAdaptor represents a Client Connection to a BLE Peripheral
|
// ClientAdaptor represents a Client Connection to a BLE Peripheral
|
||||||
|
@ -42,19 +42,19 @@ type ClientAdaptor struct {
|
||||||
client blelib.Client
|
client blelib.Client
|
||||||
profile *blelib.Profile
|
profile *blelib.Profile
|
||||||
|
|
||||||
connected bool
|
connected bool
|
||||||
ready chan struct{}
|
ready chan struct{}
|
||||||
withoutReponses bool
|
withoutResponses bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClientAdaptor returns a new ClientAdaptor given an address or peripheral name
|
// NewClientAdaptor returns a new ClientAdaptor given an address or peripheral name
|
||||||
func NewClientAdaptor(address string) *ClientAdaptor {
|
func NewClientAdaptor(address string) *ClientAdaptor {
|
||||||
return &ClientAdaptor{
|
return &ClientAdaptor{
|
||||||
name: gobot.DefaultName("BLEClient"),
|
name: gobot.DefaultName("BLEClient"),
|
||||||
address: address,
|
address: address,
|
||||||
DeviceName: "default",
|
DeviceName: "default",
|
||||||
connected: false,
|
connected: false,
|
||||||
withoutReponses: false,
|
withoutResponses: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,9 +67,9 @@ func (b *ClientAdaptor) SetName(n string) { b.name = n }
|
||||||
// Address returns the Bluetooth LE address for the adaptor
|
// Address returns the Bluetooth LE address for the adaptor
|
||||||
func (b *ClientAdaptor) Address() string { return b.address }
|
func (b *ClientAdaptor) Address() string { return b.address }
|
||||||
|
|
||||||
// WithoutReponses sets if the adaptor should expect responses after
|
// WithoutResponses sets if the adaptor should expect responses after
|
||||||
// writing characteristics for this device
|
// writing characteristics for this device
|
||||||
func (b *ClientAdaptor) WithoutReponses(use bool) { b.withoutReponses = use }
|
func (b *ClientAdaptor) WithoutResponses(use bool) { b.withoutResponses = use }
|
||||||
|
|
||||||
// Connect initiates a connection to the BLE peripheral. Returns true on successful connection.
|
// Connect initiates a connection to the BLE peripheral. Returns true on successful connection.
|
||||||
func (b *ClientAdaptor) Connect() (err error) {
|
func (b *ClientAdaptor) Connect() (err error) {
|
||||||
|
@ -152,7 +152,7 @@ func (b *ClientAdaptor) WriteCharacteristic(cUUID string, data []byte) (err erro
|
||||||
uuid, _ := blelib.Parse(cUUID)
|
uuid, _ := blelib.Parse(cUUID)
|
||||||
|
|
||||||
if u := b.profile.Find(blelib.NewCharacteristic(uuid)); u != nil {
|
if u := b.profile.Find(blelib.NewCharacteristic(uuid)); u != nil {
|
||||||
err = b.client.WriteCharacteristic(u.(*blelib.Characteristic), data, b.withoutReponses)
|
err = b.client.WriteCharacteristic(u.(*blelib.Characteristic), data, b.withoutResponses)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
@ -5,23 +5,23 @@ import "sync"
|
||||||
var _ BLEConnector = (*bleTestClientAdaptor)(nil)
|
var _ BLEConnector = (*bleTestClientAdaptor)(nil)
|
||||||
|
|
||||||
type bleTestClientAdaptor struct {
|
type bleTestClientAdaptor struct {
|
||||||
name string
|
name string
|
||||||
address string
|
address string
|
||||||
mtx sync.Mutex
|
mtx sync.Mutex
|
||||||
withoutReponses bool
|
withoutResponses bool
|
||||||
|
|
||||||
testReadCharacteristic func(string) ([]byte, error)
|
testReadCharacteristic func(string) ([]byte, error)
|
||||||
testWriteCharacteristic func(string, []byte) error
|
testWriteCharacteristic func(string, []byte) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *bleTestClientAdaptor) Connect() (err error) { return }
|
func (t *bleTestClientAdaptor) Connect() (err error) { return }
|
||||||
func (t *bleTestClientAdaptor) Reconnect() (err error) { return }
|
func (t *bleTestClientAdaptor) Reconnect() (err error) { return }
|
||||||
func (t *bleTestClientAdaptor) Disconnect() (err error) { return }
|
func (t *bleTestClientAdaptor) Disconnect() (err error) { return }
|
||||||
func (t *bleTestClientAdaptor) Finalize() (err error) { return }
|
func (t *bleTestClientAdaptor) Finalize() (err error) { return }
|
||||||
func (t *bleTestClientAdaptor) Name() string { return t.name }
|
func (t *bleTestClientAdaptor) Name() string { return t.name }
|
||||||
func (t *bleTestClientAdaptor) SetName(n string) { t.name = n }
|
func (t *bleTestClientAdaptor) SetName(n string) { t.name = n }
|
||||||
func (t *bleTestClientAdaptor) Address() string { return t.address }
|
func (t *bleTestClientAdaptor) Address() string { return t.address }
|
||||||
func (t *bleTestClientAdaptor) WithoutReponses(use bool) { t.withoutReponses = use }
|
func (t *bleTestClientAdaptor) WithoutResponses(use bool) { t.withoutResponses = use }
|
||||||
|
|
||||||
func (t *bleTestClientAdaptor) ReadCharacteristic(cUUID string) (data []byte, err error) {
|
func (t *bleTestClientAdaptor) ReadCharacteristic(cUUID string) (data []byte, err error) {
|
||||||
t.mtx.Lock()
|
t.mtx.Lock()
|
||||||
|
|
Loading…
Reference in New Issue