increaded wait time in discoverservicces gattc_linux.go -- connections and char enumeration working on basic level

This commit is contained in:
freqyXin 2021-05-12 15:12:36 -07:00
parent 4937b77e90
commit 16d12fd44b
2 changed files with 6 additions and 1 deletions

@ -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))

@ -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{}