当前位置: 首页>>代码示例>>Golang>>正文


Golang EUI64.String方法代码示例

本文整理汇总了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
}
开发者ID:RedBeardLab,项目名称:lora-semtech-bridge,代码行数:14,代码来源:backend.go

示例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
}
开发者ID:RedBeardLab,项目名称:lora-semtech-bridge,代码行数:14,代码来源:backend.go

示例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)
}
开发者ID:RedBeardLab,项目名称:lora-semtech-bridge,代码行数:5,代码来源:backend.go

示例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)
}
开发者ID:RedBeardLab,项目名称:lora-semtech-bridge,代码行数:5,代码来源:backend.go


注:本文中的github.com/brocaar/lorawan.EUI64.String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。