tuning sleep commands
This commit is contained in:
parent
f718c09265
commit
b15b1f0c33
@ -120,6 +120,9 @@ func (s *Scan) Start() error {
|
||||
projVars.ScanAdapter.SetConnectHandler(func(result bluetooth.Addresser, connected bool) {
|
||||
|
||||
})
|
||||
|
||||
//time.Sleep(1 * time.Second)
|
||||
|
||||
TargetDevice, _ := projVars.ScanAdapter.Connect(result.Address, bluetooth.ConnectionParams{})
|
||||
|
||||
var targetServices []bluetooth.DeviceService
|
||||
@ -134,16 +137,16 @@ func (s *Scan) Start() error {
|
||||
UUID: srvcs.String(),
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
//time.Sleep(1 * time.Second)
|
||||
|
||||
chars, _ := srvcs.DiscoverCharacteristics(nil)
|
||||
|
||||
dev.Services = append(dev.Services, charSer)
|
||||
for _, char := range chars {
|
||||
|
||||
//dev.Services = append(dev.Services, )
|
||||
dev.Services = append(dev.Services)
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
//time.Sleep(1 * time.Second)
|
||||
|
||||
//if char.
|
||||
|
||||
@ -151,6 +154,8 @@ func (s *Scan) Start() error {
|
||||
ReadPos, _ := char.Read(buf)
|
||||
println("data bytes", strconv.Itoa(ReadPos))
|
||||
println("vale = ", string(buf[:ReadPos]))
|
||||
println("Rawvalue = ", buf[:ReadPos])
|
||||
|
||||
}
|
||||
|
||||
sublog.Debug().Str("Connected and enumerated", charSer.UUID).Msg("Yay!")
|
||||
@ -192,6 +197,7 @@ func (s *Scan) Start() error {
|
||||
//projVars.ScanAdapter.StopScan()
|
||||
|
||||
//dust.Must("start scan", err)
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
return nil
|
||||
|
||||
|
4
vendor/tinygo.org/x/bluetooth/gattc_linux.go
generated
vendored
4
vendor/tinygo.org/x/bluetooth/gattc_linux.go
generated
vendored
@ -48,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(40 * time.Millisecond)
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
}
|
||||
|
||||
services := []DeviceService{}
|
||||
@ -179,6 +179,8 @@ func (s *DeviceService) DiscoverCharacteristics(uuids []UUID) ([]DeviceCharacter
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
|
||||
if _, ok := uuidChars[char.Properties.UUID]; ok {
|
||||
// There is more than one characteristic with the same UUID?
|
||||
// Don't overwrite it, to keep the servicesFound count correct.
|
||||
|
Loading…
Reference in New Issue
Block a user