Service UUID test is working in scanStuff

This commit is contained in:
freqyXin 2021-05-09 14:30:51 -07:00
parent 6ec91334db
commit f3348ca990

@ -29,12 +29,17 @@ func Scanners() {
//results := new(bluetooth.ScanResult)
var SonosScanTest = bluetooth.New16BitUUID(0xfe07)
projVars.ScanAdapter.Scan(func(scanAdapter *bluetooth.Adapter, device bluetooth.ScanResult) {
lname := device.LocalName()
adbytes := device.AdvertisementPayload.Bytes()
rssi := device.RSSI
//Trying to extract the service UUIDs from advertisment packets
srvcPld := device.AdvertisementPayload.HasServiceUUID(bluetooth.UUID{})
srvcPld := device.AdvertisementPayload.HasServiceUUID(SonosScanTest)
// ** List of common Service UUIDS to search for **
//bluetooth.ServiceUUIDDeviceInformation
//bluetooth.ServiceUUIDGenericAttribute
if lname == projVars.ScanList[device.Address.String()] {
log.Debug().Str("lname", lname).Str("device_address", projVars.ScanList[device.Address.String()]).Msg("Skipping existing device")
@ -58,9 +63,11 @@ func Scanners() {
projVars.ScanList[device.Address.String()] = device.LocalName()
//Attempt to connect -- This should be put in bluestuff once its working
scanAdapter.SetConnectHandler(func(device bluetooth.Addresser, connected bool) {
scanAdapter.Connect(device, bluetooth.ConnectionParams{})
})
/*
scanAdapter.SetConnectHandler(func(device bluetooth.Addresser, connected bool) {
scanAdapter.Connect(device, bluetooth.ConnectionParams{})
})
*/
//projVars.ScanAdapter.Connect(device.Address, bluetooth.ConnectionParams{})
//fucking sanity check