aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-12-28 01:05:26 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-12-28 01:05:26 +0100
commit9bfc2fe08fbb71322b31b86585816250baf8e883 (patch)
treec9b109174fcefeebd1c912c0bedf995831089c56
parent3465c63058b4d28b370d0453edfad9ac99768d01 (diff)
wip send
-rw-r--r--cmd/experimental/main.go10
1 files changed, 10 insertions, 0 deletions
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})
+ }
}
}
}