This commit is contained in:
2017-02-06 20:00:33 +03:00
parent a829a3dd5c
commit 40c834f7e8
5 changed files with 47 additions and 31 deletions
+28
View File
@@ -0,0 +1,28 @@
package workers
import (
"fmt"
"github.com/currantlabs/gatt"
)
type Log struct {
Worker
}
func (s Log) OnDiscovery(p gatt.Peripheral, a *gatt.Advertisement, rssi int) bool {
fmt.Printf("\nPeripheral ID:%s, NAME:(%s)\n", p.ID(), p.Name())
fmt.Println(" Local Name =", a.LocalName)
fmt.Println(" Manufacturer Data =", a.ManufacturerData)
fmt.Println(" Service Data =", a.ServiceData)
fmt.Println(" RSSI =", rssi)
return false
}
func (s Log) OnConnect(p gatt.Peripheral, err error) error {
ID := p.ID()
fmt.Println("Connected to " + ID)
return nil
}