updates to vendor packages to retrieve adapter ID
This commit is contained in:
parent
3132c37610
commit
4f40f4fe2b
@ -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
|
||||
|
4
vendor/tinygo.org/x/bluetooth/adapter_linux.go
generated
vendored
4
vendor/tinygo.org/x/bluetooth/adapter_linux.go
generated
vendored
@ -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
|
||||
}
|
||||
|
2
vendor/tinygo.org/x/bluetooth/gap_linux.go
generated
vendored
2
vendor/tinygo.org/x/bluetooth/gap_linux.go
generated
vendored
@ -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
|
||||
}
|
||||
|
2
vendor/tinygo.org/x/bluetooth/gatts_linux.go
generated
vendored
2
vendor/tinygo.org/x/bluetooth/gatts_linux.go
generated
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user