Add the Peripheral and the Characteristic to UpdateValueEvent.
This commit is contained in:
parent
fbb58a8d99
commit
5955e369e4
|
@ -165,6 +165,8 @@ type DiscoverCharacteristicEvent struct {
|
|||
}
|
||||
|
||||
type UpdateValueEvent struct {
|
||||
Peripheral Peripheral
|
||||
Characteristic *ns.CBCharacteristic
|
||||
Data []byte
|
||||
}
|
||||
|
||||
|
@ -247,6 +249,9 @@ func (b *BLE) StopScan() {
|
|||
|
||||
func CancelConnection(p Peripheral) {
|
||||
b := pdLookup[p.p.Ptr()]
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
b.connections.Lock()
|
||||
var ch chan string;
|
||||
for _, item := range b.connections.items {
|
||||
|
@ -494,6 +499,8 @@ func updateValue(p *ns.CBPeripheral, chr *ns.CBCharacteristic, e *ns.NSError) {
|
|||
b := pdLookup[p.Ptr()]
|
||||
v := chr.Value()
|
||||
b.events <-UpdateValueEvent{
|
||||
Peripheral: newPeripheral(p),
|
||||
Characteristic: chr,
|
||||
Data: C.GoBytes(v.Bytes(), (C.int)(v.Length())),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user