This commit is contained in:
cn 2018-11-30 15:21:58 +01:00
parent c1c348db75
commit 4a3cd53cf3
7 changed files with 697 additions and 67 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
miflorad

5
go.mod
View File

@ -2,8 +2,13 @@ module miflorad
require (
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 // indirect
github.com/currantlabs/gatt v0.0.0-20161006170101-f949eac78f4e
github.com/fatih/structs v1.1.0 // indirect
github.com/godbus/dbus v0.0.0-20181031085051-66d97ae // indirect
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab // indirect
github.com/muka/ble v0.0.0-20180314094923-5613a57406d1 // indirect
github.com/muka/go-bluetooth v0.0.0-20181012115104-31d8f53bf9a1
github.com/pkg/errors v0.8.0 // indirect

10
go.sum
View File

@ -1,5 +1,7 @@
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 h1:3jFq2xL4ZajGK4aZY8jz+DAF0FHjI51BXjjSwCzS1Dk=
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/currantlabs/gatt v0.0.0-20161006170101-f949eac78f4e h1:qu1wqkuctiqRtgZu8kNMtFxQ7/xXuOxSJZ2kYoOxFM0=
github.com/currantlabs/gatt v0.0.0-20161006170101-f949eac78f4e/go.mod h1:GCdlaU9vOYeye8wQtSZNyZ4j5PhmnJ2HUqhRZO0KoZI=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
@ -8,6 +10,14 @@ github.com/godbus/dbus v0.0.0-20181031085051-66d97ae/go.mod h1:/YcGZj5zSblfDWMMo
github.com/godbus/dbus v4.1.0+incompatible h1:WqqLRTsQic3apZUK9qC5sGNfXthmPXzUZ7nQPrNITa4=
github.com/godbus/dbus v4.1.0+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab h1:n8cgpHzJ5+EDyDri2s/GC7a9+qK3/YEGnBsd0uS/8PY=
github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab/go.mod h1:y1pL58r5z2VvAjeG1VLGc8zOQgSOzbKN7kMHPvFXJ+8=
github.com/muka/ble v0.0.0-20180314094923-5613a57406d1 h1:DrMDOYCxMG7TUMjhBWnRsgPfpPlz0sFL11ukl+2+CZU=
github.com/muka/ble v0.0.0-20180314094923-5613a57406d1/go.mod h1:1lEPQDLh8Z86+REeQMqID8UpXCSdHF0fvU0qZj3b1eA=
github.com/muka/go-bluetooth v0.0.0-20181012115104-31d8f53bf9a1 h1:VKhCDuxZ3+Bg+Plf7+CxgGRlNEdwHDKUqHoZLzer8Ms=

164
main.g__o Normal file
View File

@ -0,0 +1,164 @@
package main
import (
"flag"
"fmt"
"log"
"os"
"strings"
"time"
"github.com/currantlabs/gatt"
"github.com/currantlabs/gatt/examples/option"
)
var done = make(chan struct{})
func onStateChanged(d gatt.Device, s gatt.State) {
fmt.Println("State:", s)
switch s {
case gatt.StatePoweredOn:
fmt.Println("Scanning...")
d.Scan([]gatt.UUID{}, false)
return
default:
d.StopScanning()
}
}
func onPeriphDiscovered(p gatt.Peripheral, a *gatt.Advertisement, rssi int) {
id := strings.ToUpper(flag.Args()[0])
if strings.ToUpper(p.ID()) != id {
return
}
// Stop scanning once we've got the peripheral we're looking for.
p.Device().StopScanning()
fmt.Printf("\nPeripheral ID:%s, NAME:(%s)\n", p.ID(), p.Name())
fmt.Println(" Local Name =", a.LocalName)
fmt.Println(" TX Power Level =", a.TxPowerLevel)
fmt.Println(" Manufacturer Data =", a.ManufacturerData)
fmt.Println(" Service Data =", a.ServiceData)
fmt.Println("")
p.Device().Connect(p)
}
func onPeriphConnected(p gatt.Peripheral, err error) {
fmt.Println("Connected")
defer p.Device().CancelConnection(p)
if err := p.SetMTU(500); err != nil {
fmt.Printf("Failed to set MTU, err: %s\n", err)
}
// Discovery services
ss, err := p.DiscoverServices(nil)
if err != nil {
fmt.Printf("Failed to discover services, err: %s\n", err)
return
}
for _, s := range ss {
msg := "Service: " + s.UUID().String()
if len(s.Name()) > 0 {
msg += " (" + s.Name() + ")"
}
fmt.Println(msg)
// Discovery characteristics
cs, err := p.DiscoverCharacteristics(nil, s)
if err != nil {
fmt.Printf("Failed to discover characteristics, err: %s\n", err)
continue
}
for _, c := range cs {
msg := " Characteristic " + c.UUID().String()
if len(c.Name()) > 0 {
msg += " (" + c.Name() + ")"
}
msg += "\n properties " + c.Properties().String()
fmt.Println(msg)
// Read the characteristic, if possible.
if (c.Properties() & gatt.CharRead) != 0 {
b, err := p.ReadCharacteristic(c)
if err != nil {
fmt.Printf("Failed to read characteristic, err: %s\n", err)
continue
}
fmt.Printf(" value %x | %q\n", b, b)
}
// Discovery descriptors
ds, err := p.DiscoverDescriptors(nil, c)
if err != nil {
fmt.Printf("Failed to discover descriptors, err: %s\n", err)
continue
}
for _, d := range ds {
msg := " Descriptor " + d.UUID().String()
if len(d.Name()) > 0 {
msg += " (" + d.Name() + ")"
}
fmt.Println(msg)
// Read descriptor (could fail, if it's not readable)
b, err := p.ReadDescriptor(d)
if err != nil {
fmt.Printf("Failed to read descriptor, err: %s\n", err)
continue
}
fmt.Printf(" value %x | %q\n", b, b)
}
// Subscribe the characteristic, if possible.
if (c.Properties() & (gatt.CharNotify | gatt.CharIndicate)) != 0 {
f := func(c *gatt.Characteristic, b []byte, err error) {
fmt.Printf("notified: % X | %q\n", b, b)
}
if err := p.SetNotifyValue(c, f); err != nil {
fmt.Printf("Failed to subscribe characteristic, err: %s\n", err)
continue
}
}
}
fmt.Println()
}
fmt.Printf("Waiting for 5 seconds to get some notifiations, if any.\n")
time.Sleep(5 * time.Second)
}
func onPeriphDisconnected(p gatt.Peripheral, err error) {
fmt.Println("Disconnected")
close(done)
}
func main() {
flag.Parse()
if len(flag.Args()) != 1 {
log.Fatalf("usage: %s [options] peripheral-id\n", os.Args[0])
}
d, err := gatt.NewDevice(option.DefaultClientOptions...)
if err != nil {
log.Fatalf("Failed to open device, err: %s\n", err)
return
}
// Register handlers.
d.Handle(
gatt.PeripheralDiscovered(onPeriphDiscovered),
gatt.PeripheralConnected(onPeriphConnected),
gatt.PeripheralDisconnected(onPeriphDisconnected),
)
d.Init(onStateChanged)
<-done
fmt.Println("Done")
}

129
main.g_o Normal file
View File

@ -0,0 +1,129 @@
//shows how to watch for new devices and list them
package main
import (
"os"
log "github.com/sirupsen/logrus"
"github.com/muka/go-bluetooth/api"
"github.com/muka/go-bluetooth/emitter"
)
const adapterID = "hci0"
// func main() {
// manager, err := api.NewManager()
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
//
// err = manager.RefreshState()
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
//
// var address = "C4:7C:8D:66:D5:27"
//
// dev, err := api.GetDeviceByAddress(address)
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
//
// if dev == nil {
// log.Infof("No device found!")
// os.Exit(1)
// }
//
// dev.GetAllServicesAndUUID()
//
// props, err := dev.GetProperties()
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
//
// log.Infof("name=%s addr=%s rssi=%d", props.Name, props.Address, props.RSSI)
//
// err = dev.Connect()
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
//
// if !dev.IsConnected() {
// log.Infof("Device not connected!")
// os.Exit(1)
// }
//
// y, err := dev.GetCharByUUID("00002a00-0000-1000-8000-00805f9b34fb")
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
//
// log.Infof(y.Path)
//
// err = dev.Disconnect()
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
// }
// func main() {
// log.SetLevel(log.DebugLevel)
//
// // clean up connection on exit
// defer api.Exit()
//
// manager, err := api.NewManager()
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
//
// err = manager.RefreshState()
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
//
// boo, err := api.AdapterExists(adapterID)
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
// log.Debugf("AdapterExists: %b", boo)
//
// err = api.StartDiscoveryOn(adapterID)
// if err != nil {
// log.Error(err)
// os.Exit(1)
// }
// log.Debugf("Started discovery")
//
// err = api.On("discovery", emitter.NewCallback(func(ev emitter.Event) {
// discoveryEvent := ev.GetData().(api.DiscoveredDeviceEvent)
// dev := discoveryEvent.Device
// handleDevice(dev)
// }))
//
// select {}
// }
//
// func handleDevice(dev *api.Device) {
// if dev == nil {
// return
// }
//
// props, err := dev.GetProperties()
// if err != nil {
// log.Error(err)
// return
// }
//
// log.Infof("name=%s addr=%s rssi=%d", props.Name, props.Address, props.RSSI)
// }

247
main.go
View File

@ -1,79 +1,192 @@
//shows how to watch for new devices and list them
package main
import (
"os"
"flag"
"fmt"
"log"
"os"
"strings"
"time"
log "github.com/sirupsen/logrus"
"github.com/muka/go-bluetooth/api"
"github.com/muka/go-bluetooth/emitter"
"github.com/muka/go-bluetooth/linux"
"github.com/currantlabs/gatt"
"github.com/currantlabs/gatt/examples/option"
)
const logLevel = log.DebugLevel
const adapterID = "hci0"
var done = make(chan struct{})
func onStateChanged(d gatt.Device, s gatt.State) {
fmt.Println("State:", s)
switch s {
case gatt.StatePoweredOn:
fmt.Println("Scanning...")
d.Scan([]gatt.UUID{}, false)
return
default:
d.StopScanning()
}
}
func onPeriphDiscovered(p gatt.Peripheral, a *gatt.Advertisement, rssi int) {
id := strings.ToUpper(flag.Args()[0])
if strings.ToUpper(p.ID()) != id {
return
}
// Stop scanning once we've got the peripheral we're looking for.
p.Device().StopScanning()
fmt.Printf("\nPeripheral ID:%s, NAME:(%s)\n", p.ID(), p.Name())
fmt.Println(" Local Name =", a.LocalName)
fmt.Println(" TX Power Level =", a.TxPowerLevel)
fmt.Println(" Manufacturer Data =", a.ManufacturerData)
fmt.Println(" Service Data =", a.ServiceData)
fmt.Println("")
p.Device().Connect(p)
}
func onPeriphConnected(p gatt.Peripheral, err error) {
fmt.Println("Connected")
defer p.Device().CancelConnection(p)
if err := p.SetMTU(500); err != nil {
fmt.Printf("Failed to set MTU, err: %s\n", err)
}
// Discovery services
ss, err := p.DiscoverServices(nil)
if err != nil {
fmt.Printf("Failed to discover services, err: %s\n", err)
return
}
for _, s := range ss {
msg := "Service: " + s.UUID().String()
if len(s.Name()) > 0 {
msg += " (" + s.Name() + ")"
}
fmt.Println(msg)
if s.UUID().String() != "0000120400001000800000805f9b34fb" {
fmt.Printf("Skipping uninteresting service\n")
continue
}
// Discovery characteristics
cs, err := p.DiscoverCharacteristics(nil, s)
if err != nil {
fmt.Printf("Failed to discover characteristics, err: %s\n", err)
continue
}
for _, c := range cs {
msg := " Characteristic " + c.UUID().String()
if len(c.Name()) > 0 {
msg += " (" + c.Name() + ")"
}
fmt.Println(msg)
if c.UUID().String() == "00001a0000001000800000805f9b34fb" {
err := p.WriteCharacteristic(c, []byte{0xa0, 0x1f}, false)
if err != nil {
fmt.Printf("Failed to write characteristic, err: %s\n", err)
continue
}
}
if c.UUID().String() == "00001a0200001000800000805f9b34fb" {
b, err := p.ReadCharacteristic(c)
if err != nil {
fmt.Printf("Failed to read characteristic, err: %s\n", err)
continue
}
// fmt.Printf(" value %x | %q\n", b, b)
fmt.Printf(" battery level: %d%%\n", b[0])
fmt.Printf(" firmware version: %s\n", string(b[2:]))
}
if c.UUID().String() == "00001a0100001000800000805f9b34fb" {
b, err := p.ReadCharacteristic(c)
if err != nil {
fmt.Printf("Failed to read characteristic, err: %s\n", err)
continue
}
fmt.Printf(" temparature: %f °C\n", float64((int32(b[1]) << 8) + int32(b[0])) / 10.0)
fmt.Printf(" brightness: %d lux\n", (int32(b[6]) << 24) + (int32(b[5]) << 16) + (int32(b[4]) << 8) + int32(b[3]))
fmt.Printf(" moisture: %d %%\n", int32(b[7]))
fmt.Printf(" conductivity: %d µS/cm\n", (int32(b[9]) << 8) + int32(b[8]))
}
fmt.Printf("Skipping uninteresting char\n")
continue
// // Discovery descriptors
// ds, err := p.DiscoverDescriptors(nil, c)
// if err != nil {
// fmt.Printf("Failed to discover descriptors, err: %s\n", err)
// continue
// }
//
// for _, d := range ds {
// msg := " Descriptor " + d.UUID().String()
// if len(d.Name()) > 0 {
// msg += " (" + d.Name() + ")"
// }
// fmt.Println(msg)
//
// // Read descriptor (could fail, if it's not readable)
// b, err := p.ReadDescriptor(d)
// if err != nil {
// fmt.Printf("Failed to read descriptor, err: %s\n", err)
// continue
// }
// fmt.Printf(" value %x | %q\n", b, b)
// }
//
// // Subscribe the characteristic, if possible.
// if (c.Properties() & (gatt.CharNotify | gatt.CharIndicate)) != 0 {
// f := func(c *gatt.Characteristic, b []byte, err error) {
// fmt.Printf("notified: % X | %q\n", b, b)
// }
// if err := p.SetNotifyValue(c, f); err != nil {
// fmt.Printf("Failed to subscribe characteristic, err: %s\n", err)
// continue
// }
// }
}
fmt.Println()
}
fmt.Printf("Waiting for 5 seconds to get some notifiations, if any.\n")
time.Sleep(5 * time.Second)
}
func onPeriphDisconnected(p gatt.Peripheral, err error) {
fmt.Println("Disconnected")
close(done)
}
func main() {
flag.Parse()
if len(flag.Args()) != 1 {
log.Fatalf("usage: %s [options] peripheral-id\n", os.Args[0])
}
log.SetLevel(logLevel)
d, err := gatt.NewDevice(option.DefaultClientOptions...)
if err != nil {
log.Fatalf("Failed to open device, err: %s\n", err)
return
}
//clean up connection on exit
defer api.Exit()
// Register handlers.
d.Handle(
gatt.PeripheralDiscovered(onPeriphDiscovered),
gatt.PeripheralConnected(onPeriphConnected),
gatt.PeripheralDisconnected(onPeriphDisconnected),
)
log.Debugf("Reset bluetooth device")
a := linux.NewBtMgmt(adapterID)
err := a.Reset()
if err != nil {
log.Error(err)
os.Exit(1)
}
devices, err := api.GetDevices()
if err != nil {
log.Error(err)
os.Exit(1)
}
log.Infof("Cached devices:")
for _, dev := range devices {
showDeviceInfo(&dev)
}
log.Infof("Discovered devices:")
err = discoverDevices(adapterID)
if err != nil {
log.Error(err)
os.Exit(1)
}
select {}
}
func discoverDevices(adapterID string) error {
err := api.StartDiscovery()
if err != nil {
return err
}
log.Debugf("Started discovery")
err = api.On("discovery", emitter.NewCallback(func(ev emitter.Event) {
discoveryEvent := ev.GetData().(api.DiscoveredDeviceEvent)
dev := discoveryEvent.Device
showDeviceInfo(dev)
}))
return err
}
func showDeviceInfo(dev *api.Device) {
if dev == nil {
return
}
props, err := dev.GetProperties()
if err != nil {
log.Errorf("%s: Failed to get properties: %s", dev.Path, err.Error())
return
}
log.Infof("name=%s addr=%s rssi=%d", props.Name, props.Address, props.RSSI)
d.Init(onStateChanged)
<-done
fmt.Println("Done")
}

208
notes.md Normal file
View File

@ -0,0 +1,208 @@
INFO[0036] name=Flower care addr=C4:7C:8D:66:D5:27 rssi=-43
list-attributes C4:7C:8D:66:D5:27
connect C4:7C:8D:66:D5:27
select-attribute /org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0002/char0003
select-attribute 00002a00-0000-1000-8000-00805f9b34fb
read 0003
08:38:52::$ gatttool --device=C4:7C:8D:66:D5:27 --char-read -a 0x03
Characteristic value/descriptor: 46 6c 6f 77 65 72 20 63 61 72 65
08:53:32::$ sudo hcitool leinfo C4:7C:8D:66:D5:27
Requesting information ...
Handle: 3585 (0x0e01)
LMP Version: 4.0 (0x6) LMP Subversion: 0x706
Manufacturer: RivieraWaves S.A.S (96)
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Attempting to connect to C4:7C:8D:66:D5:27
[CHG] Device C4:7C:8D:66:D5:27 Connected: yes
Connection successful
[NEW] Primary Service
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service000c
00001801-0000-1000-8000-00805f9b34fb
Generic Attribute Profile
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service000c/char000d
00002a05-0000-1000-8000-00805f9b34fb
Service Changed
[NEW] Descriptor
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service000c/char000d/desc000f
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Primary Service
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010
0000fe95-0000-1000-8000-00805f9b34fb
Xiaomi Inc.
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char0011
00000001-0000-1000-8000-00805f9b34fb
SDP
[NEW] Descriptor
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char0011/desc0013
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char0014
00000002-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char0016
00000004-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char0018
00000007-0000-1000-8000-00805f9b34fb
ATT
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char001a
00000010-0000-1000-8000-00805f9b34fb
UPNP
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char001c
00000013-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char001e
00000014-0000-1000-8000-00805f9b34fb
Hardcopy Data Channel
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char0020
00001001-0000-1000-8000-00805f9b34fb
Browse Group Descriptor Service Class
[NEW] Descriptor
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0010/char0020/desc0022
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Primary Service
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0023
0000fef5-0000-1000-8000-00805f9b34fb
Dialog Semiconductor GmbH
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0023/char0024
8082caa8-41a6-4021-91c6-56f9b954cc34
Vendor specific
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0023/char0026
724249f0-5ec3-4b5f-8804-42345af08651
Vendor specific
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0023/char0028
6c53db25-47a1-45fe-a022-7c92fb334fd4
Vendor specific
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0023/char002a
9d84b9a3-000c-49d8-9183-855b673fda31
Vendor specific
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0023/char002c
457871e8-d516-4ca1-9116-57d0b17b9cb2
Vendor specific
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0023/char002e
5f78df94-798c-46f5-990a-b3eb6a065c88
Vendor specific
[NEW] Descriptor
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0023/char002e/desc0030
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Primary Service
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0031
00001204-0000-1000-8000-00805f9b34fb
Generic Telephony
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0031/char0032
00001a00-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0031/char0034
00001a01-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Descriptor
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0031/char0034/desc0036
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0031/char0037
00001a02-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Descriptor
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service0031/char0037/desc0039
00001a02-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Primary Service
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service003a
00001206-0000-1000-8000-00805f9b34fb
UPNP IP Service
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service003a/char003b
00001a11-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service003a/char003d
00001a10-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Descriptor
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service003a/char003d/desc003f
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
[NEW] Characteristic
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service003a/char0040
00001a12-0000-1000-8000-00805f9b34fb
Unknown
[NEW] Descriptor
/org/bluez/hci0/dev_C4_7C_8D_66_D5_27/service003a/char0040/desc0042
00001a12-0000-1000-8000-00805f9b34fb
Unknown
[CHG] Device C4:7C:8D:66:D5:27 ServicesResolved: yes
[CHG] Device C4:7C:8D:66:D5:27 ServicesResolved: no
[CHG] Device C4:7C:8D:66:D5:27 Connected: no
https://github.com/open-homeautomation/miflora/blob/master/miflora/miflora_poller.py#L11
https://github.com/golang/go/wiki/Modules
https://github.com/currantlabs/gatt/blob/master/examples/explorer.go
$ gatttool -b C4:7C:8D:66:D5:27 --characteristics
handle = 0x0002, char properties = 0x02, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0004, char properties = 0x02, char value handle = 0x0005, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x0a, char value handle = 0x0007, uuid = 00002a02-0000-1000-8000-00805f9b34fb
handle = 0x0008, char properties = 0x02, char value handle = 0x0009, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x000d, char properties = 0x22, char value handle = 0x000e, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x0011, char properties = 0x1a, char value handle = 0x0012, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x0014, char properties = 0x02, char value handle = 0x0015, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0016, char properties = 0x12, char value handle = 0x0017, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x0018, char properties = 0x08, char value handle = 0x0019, uuid = 00000007-0000-1000-8000-00805f9b34fb
handle = 0x001a, char properties = 0x08, char value handle = 0x001b, uuid = 00000010-0000-1000-8000-00805f9b34fb
handle = 0x001c, char properties = 0x0a, char value handle = 0x001d, uuid = 00000013-0000-1000-8000-00805f9b34fb
handle = 0x001e, char properties = 0x02, char value handle = 0x001f, uuid = 00000014-0000-1000-8000-00805f9b34fb
handle = 0x0020, char properties = 0x10, char value handle = 0x0021, uuid = 00001001-0000-1000-8000-00805f9b34fb
handle = 0x0024, char properties = 0x0a, char value handle = 0x0025, uuid = 8082caa8-41a6-4021-91c6-56f9b954cc34
handle = 0x0026, char properties = 0x0a, char value handle = 0x0027, uuid = 724249f0-5ec3-4b5f-8804-42345af08651
handle = 0x0028, char properties = 0x02, char value handle = 0x0029, uuid = 6c53db25-47a1-45fe-a022-7c92fb334fd4
handle = 0x002a, char properties = 0x0a, char value handle = 0x002b, uuid = 9d84b9a3-000c-49d8-9183-855b673fda31
handle = 0x002c, char properties = 0x0e, char value handle = 0x002d, uuid = 457871e8-d516-4ca1-9116-57d0b17b9cb2
handle = 0x002e, char properties = 0x12, char value handle = 0x002f, uuid = 5f78df94-798c-46f5-990a-b3eb6a065c88
handle = 0x0032, char properties = 0x0a, char value handle = 0x0033, uuid = 00001a00-0000-1000-8000-00805f9b34fb
handle = 0x0034, char properties = 0x1a, char value handle = 0x0035, uuid = 00001a01-0000-1000-8000-00805f9b34fb
handle = 0x0037, char properties = 0x02, char value handle = 0x0038, uuid = 00001a02-0000-1000-8000-00805f9b34fb
handle = 0x003b, char properties = 0x02, char value handle = 0x003c, uuid = 00001a11-0000-1000-8000-00805f9b34fb
handle = 0x003d, char properties = 0x1a, char value handle = 0x003e, uuid = 00001a10-0000-1000-8000-00805f9b34fb
handle = 0x0040, char properties = 0x02, char value handle = 0x0041, uuid = 00001a12-0000-1000-8000-00805f9b34fb
Service: 0000120400001000800000805f9b34fb
Characteristic 00001a0000001000800000805f9b34fb
properties read write
value 0000 | "\x00\x00"
Characteristic 00001a0100001000800000805f9b34fb
properties read write notify
value aabbccddeeff99887766000000000000 | "\xaa\xbb\xcc\xdd\xee\xff\x99\x88wf\x00\x00\x00\x00\x00\x00"
Descriptor 2902 (Client Characteristic Configuration)
value 0000 | "\x00\x00"
Characteristic 00001a0200001000800000805f9b34fb
properties read
value 6415322e372e30 | "d\x152.7.0"
Descriptor 00001a0200001000800000805f9b34fb
value 6415322e372e30 | "d\x152.7.0"