diff --git a/src/scanStuff/scanStuff.go b/src/scanStuff/scanStuff.go index a51bcfe..bd6dfa5 100644 --- a/src/scanStuff/scanStuff.go +++ b/src/scanStuff/scanStuff.go @@ -134,6 +134,8 @@ func (s *Scan) Start() error { UUID: srvcs.String(), } + time.Sleep(1 * time.Second) + chars, _ := srvcs.DiscoverCharacteristics(nil) dev.Services = append(dev.Services, charSer) @@ -143,6 +145,8 @@ func (s *Scan) Start() error { time.Sleep(1 * time.Second) + //if char. + println(char.UUID().String()) ReadPos, _ := char.Read(buf) println("data bytes", strconv.Itoa(ReadPos)) diff --git a/vendor/tinygo.org/x/bluetooth/gattc_linux.go b/vendor/tinygo.org/x/bluetooth/gattc_linux.go index 8a8c5dc..f96a210 100644 --- a/vendor/tinygo.org/x/bluetooth/gattc_linux.go +++ b/vendor/tinygo.org/x/bluetooth/gattc_linux.go @@ -39,6 +39,7 @@ func (s *DeviceService) UUID() UUID { // services haven't been resolved yet) and uses this list of cached services. func (d *Device) DiscoverServices(uuids []UUID) ([]DeviceService, error) { for { + resolved, err := d.device.GetServicesResolved() if err != nil { return nil, err @@ -47,7 +48,7 @@ func (d *Device) DiscoverServices(uuids []UUID) ([]DeviceService, error) { break } // This is a terrible hack, but I couldn't find another way. - time.Sleep(10 * time.Millisecond) + time.Sleep(30 * time.Millisecond) } services := []DeviceService{}