From 4f40f4fe2bfde3d3e73b288556727494690d5a59 Mon Sep 17 00:00:00 2001 From: freqyXin Date: Sun, 9 May 2021 17:28:57 -0700 Subject: [PATCH] updates to vendor packages to retrieve adapter ID --- src/scanStuff/scanStuff.go | 10 ++++++++-- vendor/tinygo.org/x/bluetooth/adapter_linux.go | 4 ++-- vendor/tinygo.org/x/bluetooth/gap_linux.go | 2 +- vendor/tinygo.org/x/bluetooth/gatts_linux.go | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/scanStuff/scanStuff.go b/src/scanStuff/scanStuff.go index 9eab012..5c45ffc 100644 --- a/src/scanStuff/scanStuff.go +++ b/src/scanStuff/scanStuff.go @@ -20,7 +20,8 @@ func Scanners() { // Enable BLE interface. dust.Must("enable BLE stack", projVars.ScanAdapter.Enable()) - println(projVars.AdapterInUse) + + adapterId := projVars.ScanAdapter.ID //TODO: Add device adapter MAC output //println(bluetooth.Addresser.String()) @@ -29,13 +30,18 @@ func Scanners() { // redundant(?): log.Info().Msg("scanning...") //results := new(bluetooth.ScanResult) + log.Info().Str("ID", adapterId).Msg("Adapter in Use") 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(projVars.SonosScanTest) + //srvcPld := projVars.ScanAdapter.SetConnectHandler(c func) + + //srvcPld := device.AdvertisementPayload.HasServiceUUID(projVars.SonosScanTest) // ** List of common Service UUIDS to search for ** //bluetooth.ServiceUUIDDeviceInformation //bluetooth.ServiceUUIDGenericAttribute diff --git a/vendor/tinygo.org/x/bluetooth/adapter_linux.go b/vendor/tinygo.org/x/bluetooth/adapter_linux.go index f107dfa..b225348 100644 --- a/vendor/tinygo.org/x/bluetooth/adapter_linux.go +++ b/vendor/tinygo.org/x/bluetooth/adapter_linux.go @@ -32,12 +32,12 @@ var DefaultAdapter = &Adapter{ // Enable configures the BLE stack. It must be called before any // Bluetooth-related calls (unless otherwise indicated). func (a *Adapter) Enable() (err error) { - if a.id == "" { + if a.ID == "" { a.adapter, err = api.GetDefaultAdapter() if err != nil { return } - a.id, err = a.adapter.GetAdapterID() + a.ID, err = a.adapter.GetAdapterID() } return nil } diff --git a/vendor/tinygo.org/x/bluetooth/gap_linux.go b/vendor/tinygo.org/x/bluetooth/gap_linux.go index 9d3fd14..d3997f8 100644 --- a/vendor/tinygo.org/x/bluetooth/gap_linux.go +++ b/vendor/tinygo.org/x/bluetooth/gap_linux.go @@ -59,7 +59,7 @@ func (a *Advertisement) Start() error { if a.advertisement != nil { panic("todo: start advertisement a second time") } - _, err := api.ExposeAdvertisement(a.adapter.id, a.properties, uint32(a.properties.Timeout)) + _, err := api.ExposeAdvertisement(a.adapter.ID, a.properties, uint32(a.properties.Timeout)) if err != nil { return err } diff --git a/vendor/tinygo.org/x/bluetooth/gatts_linux.go b/vendor/tinygo.org/x/bluetooth/gatts_linux.go index 0422c44..5e1d3ef 100644 --- a/vendor/tinygo.org/x/bluetooth/gatts_linux.go +++ b/vendor/tinygo.org/x/bluetooth/gatts_linux.go @@ -18,7 +18,7 @@ type Characteristic struct { // Service struct. func (a *Adapter) AddService(s *Service) error { app, err := service.NewApp(service.AppOptions{ - AdapterID: a.id, + AdapterID: a.ID, }) if err != nil { return err