From 9bfc2fe08fbb71322b31b86585816250baf8e883 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 28 Dec 2016 01:05:26 +0100 Subject: wip send --- cmd/experimental/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/experimental/main.go b/cmd/experimental/main.go index c9a55f2..577a516 100644 --- a/cmd/experimental/main.go +++ b/cmd/experimental/main.go @@ -31,6 +31,10 @@ func onDiscover(p gatt.Peripheral, a *gatt.Advertisement, rssi int) { } } +func onRead(w gatt.ResponseWriter, r *gatt.ReadRequest) { + log.Println("READ", r) +} + func onConnect(p gatt.Peripheral, err error) { ss, err := p.DiscoverServices(nil) if err != nil { @@ -54,12 +58,18 @@ func onConnect(p gatt.Peripheral, err error) { for _, d := range ds { log.Println("Descriptor", d.UUID()) } + log.Println("Properties", c.Properties()) if (c.Properties() & (gatt.CharNotify | gatt.CharIndicate)) != 0 { if err := p.SetNotifyValue(c, onNotify); err != nil { log.Println("Set notify", err) return } } + if (c.Properties() & gatt.CharWrite) != 0 { + //c.HandleReadFunc(onRead) + //log.Println("Send") + //c.SetValue([]byte{0x01, 0x18}) + } } } } -- cgit v1.2.3