Service UUID test is working in scanStuff
This commit is contained in:
parent
6ec91334db
commit
f3348ca990
@ -29,12 +29,17 @@ func Scanners() {
|
|||||||
|
|
||||||
//results := new(bluetooth.ScanResult)
|
//results := new(bluetooth.ScanResult)
|
||||||
|
|
||||||
|
var SonosScanTest = bluetooth.New16BitUUID(0xfe07)
|
||||||
|
|
||||||
projVars.ScanAdapter.Scan(func(scanAdapter *bluetooth.Adapter, device bluetooth.ScanResult) {
|
projVars.ScanAdapter.Scan(func(scanAdapter *bluetooth.Adapter, device bluetooth.ScanResult) {
|
||||||
lname := device.LocalName()
|
lname := device.LocalName()
|
||||||
adbytes := device.AdvertisementPayload.Bytes()
|
adbytes := device.AdvertisementPayload.Bytes()
|
||||||
rssi := device.RSSI
|
rssi := device.RSSI
|
||||||
//Trying to extract the service UUIDs from advertisment packets
|
//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()] {
|
if lname == projVars.ScanList[device.Address.String()] {
|
||||||
log.Debug().Str("lname", lname).Str("device_address", projVars.ScanList[device.Address.String()]).Msg("Skipping existing device")
|
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()
|
projVars.ScanList[device.Address.String()] = device.LocalName()
|
||||||
|
|
||||||
//Attempt to connect -- This should be put in bluestuff once its working
|
//Attempt to connect -- This should be put in bluestuff once its working
|
||||||
|
/*
|
||||||
scanAdapter.SetConnectHandler(func(device bluetooth.Addresser, connected bool) {
|
scanAdapter.SetConnectHandler(func(device bluetooth.Addresser, connected bool) {
|
||||||
scanAdapter.Connect(device, bluetooth.ConnectionParams{})
|
scanAdapter.Connect(device, bluetooth.ConnectionParams{})
|
||||||
})
|
})
|
||||||
|
*/
|
||||||
//projVars.ScanAdapter.Connect(device.Address, bluetooth.ConnectionParams{})
|
//projVars.ScanAdapter.Connect(device.Address, bluetooth.ConnectionParams{})
|
||||||
|
|
||||||
//fucking sanity check
|
//fucking sanity check
|
||||||
|
Loading…
Reference in New Issue
Block a user