本文整理汇总了Golang中github.com/brocaar/lorawan.EUI64.String方法的典型用法代码示例。如果您正苦于以下问题:Golang EUI64.String方法的具体用法?Golang EUI64.String怎么用?Golang EUI64.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/brocaar/lorawan.EUI64
的用法示例。
在下文中一共展示了EUI64.String方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UnSubscribeGatewayTX
// UnSubscribeGatewayTX unsubscribes the backend from the gateway TXPacket
// topic.
func (b *Backend) UnSubscribeGatewayTX(mac lorawan.EUI64) error {
defer b.mutex.Unlock()
b.mutex.Lock()
topic := fmt.Sprintf("gateway/%s/tx", mac.String())
log.WithField("topic", topic).Info("backend/mqttpubsub: unsubscribing from topic")
if token := b.conn.Unsubscribe(topic); token.Wait() && token.Error() != nil {
return token.Error()
}
delete(b.gateways, mac)
return nil
}
示例2: SubscribeGatewayTX
// SubscribeGatewayTX subscribes the backend to the gateway TXPacket
// topic (packets the gateway needs to transmit).
func (b *Backend) SubscribeGatewayTX(mac lorawan.EUI64) error {
defer b.mutex.Unlock()
b.mutex.Lock()
topic := fmt.Sprintf("gateway/%s/tx", mac.String())
log.WithField("topic", topic).Info("backend/mqttpubsub: subscribing to topic")
if token := b.conn.Subscribe(topic, 0, b.txPacketHandler); token.Wait() && token.Error() != nil {
return token.Error()
}
b.gateways[mac] = struct{}{}
return nil
}
示例3: PublishGatewayStats
// PublishGatewayStats publishes a GatewayStatsPacket to the MQTT broker.
func (b *Backend) PublishGatewayStats(mac lorawan.EUI64, stats models.GatewayStatsPacket) error {
topic := fmt.Sprintf("gateway/%s/stats", mac.String())
return b.publish(topic, stats)
}
示例4: PublishGatewayRX
// PublishGatewayRX publishes a RX packet to the MQTT broker.
func (b *Backend) PublishGatewayRX(mac lorawan.EUI64, rxPacket models.RXPacket) error {
topic := fmt.Sprintf("gateway/%s/rx", mac.String())
return b.publish(topic, rxPacket)
}