Last active
July 11, 2024 11:22
-
-
Save BK1031/359f1c8e365dc258945827a3901c4442 to your computer and use it in GitHub Desktop.
racecar_analytics subscribe mqtt handlers with byte decoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func SubscribeECU() { | |
Client.Subscribe("ingest/ecu", 0, func(client mqtt.Client, msg mqtt.Message) { | |
ecu := ECUFromBytes(msg.Payload()) // add this | |
fmt.Printf("[MQ] Received ecu message: %v\n", ecu) | |
}) | |
} | |
func SubscribeBattery() { | |
Client.Subscribe("ingest/battery", 0, func(client mqtt.Client, msg mqtt.Message) { | |
battery := BatteryFromBytes(msg.Payload()) // add this | |
fmt.Printf("[MQ] Received battery message: %v\n", battery) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment