| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // For now, this plugin only works on Linux machines. |
| // TODO(bjornick): Make this work on Mac and Android. |
| "v.io/x/ref/lib/discovery" |
| "github.com/pborman/uuid" |
| trigger *discovery.Trigger |
| func (b *blePlugin) Advertise(ctx *context.T, ad *discovery.Advertisement) error { |
| b.b.addAdvertisement(newAdvertisment(*ad)) |
| b.b.removeService(ad.InstanceUuid) |
| func (b *blePlugin) Scan(ctx *context.T, serviceUuid uuid.UUID, scan chan<- *discovery.Advertisement) error { |
| ch, id := b.b.addScanner(serviceUuid) |
| func NewPlugin(name string) (discovery.Plugin, error) { |
| b, err := newBleNeighborhood(name) |
| return &blePlugin{b: b, trigger: discovery.NewTrigger()}, nil |