本文整理匯總了Golang中github.com/paypal/gatt.Peripheral.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Peripheral.Name方法的具體用法?Golang Peripheral.Name怎麽用?Golang Peripheral.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/paypal/gatt.Peripheral
的用法示例。
在下文中一共展示了Peripheral.Name方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: onPeriphDiscovered
func onPeriphDiscovered(p gatt.Peripheral, a *gatt.Advertisement, rssi int) {
fmt.Printf("\nPeripheral ID:%s, NAME:(%s)\n", p.ID(), p.Name())
fmt.Println(" Local Name =", a.LocalName)
fmt.Println(" TX Power Level =", a.TxPowerLevel)
fmt.Println(" Manufacturer Data =", a.ManufacturerData)
fmt.Println(" Service Data =", a.ServiceData)
}
示例2: onPeriphDiscovered
func onPeriphDiscovered(p gatt.Peripheral, a *gatt.Advertisement, rssi int) {
if !strings.Contains(a.LocalName, "SensorTag") {
return
}
// Stop scanning once we've got the peripheral we're looking for.
p.Device().StopScanning()
log.Printf("\nPeripheral ID:%s, NAME:(%s)\n", p.ID(), p.Name())
log.Println(" Local Name =", a.LocalName)
log.Println(" TX Power Level =", a.TxPowerLevel)
log.Println(" Manufacturer Data =", a.ManufacturerData)
log.Println(" Service Data =", a.ServiceData)
log.Println("")
p.Device().Connect(p)
}
示例3: onPeriphDiscovered
func onPeriphDiscovered(p gatt.Peripheral, a *gatt.Advertisement, rssi int) {
id := strings.ToUpper(flag.Args()[0])
if strings.ToUpper(p.ID()) != id {
return
}
// Stop scanning once we've got the peripheral we're looking for.
p.Device().StopScanning()
fmt.Printf("\nPeripheral ID:%s, NAME:(%s)\n", p.ID(), p.Name())
fmt.Println(" Local Name =", a.LocalName)
fmt.Println(" TX Power Level =", a.TxPowerLevel)
fmt.Println(" Manufacturer Data =", a.ManufacturerData)
fmt.Println(" Service Data =", a.ServiceData)
fmt.Println("")
p.Device().Connect(p)
}
示例4: onPeriphDiscovered
func onPeriphDiscovered(p gatt.Peripheral, a *gatt.Advertisement, rssi int) {
if strings.ToUpper(p.ID()) != strings.ToUpper(baseDeviceId) {
return
}
// Stop scanning once we've got the peripheral we're looking for.
p.Device().StopScanning()
if len(p.Name()) > 0 {
log.Println("Device found: ", p.Name())
} else {
log.Println("Device found")
}
log.Println(" Local Name =", a.LocalName)
log.Println(" TX Power Level =", a.TxPowerLevel)
log.Println(" Manufacturer Data =", a.ManufacturerData)
log.Println(" Service Data =", a.ServiceData)
p.Device().Connect(p)
}