'Sends all scoreboard data to the HMI over the ScoreData topic.
Sub RefreshDataToHMI(Targetaddress As Int)
Dim Response As Map
Dim JSON As JSONGenerator
Response.Initialize
'Put Scoreboard scorekeeping data into JSON Map
Dim ScoreData As Map = Main.Scorekeepers(Targetaddress).GetScoreData
Dim Baseball As BaseballScoreData = ScoreData.Get("Baseball")
Dim GameClock As GameClockData = ScoreData.Get("GameClock")
Response.Put("ClockMinutes", GameClock.Minutes)
Response.Put("ClockSeconds", GameClock.Seconds)
Response.Put("ClockMilliseconds", GameClock.Milliseconds)
Response.Put("HomeScore", Baseball.Home)
Response.Put("GuestScore", Baseball.Guest)
Response.Put("Inning", Baseball.Inning)
Response.Put("Ball", Baseball.Ball)
Response.Put("Strike", Baseball.Strike)
Response.Put("Out", Baseball.Out)
JSON.Initialize(Response) 'Build the JSON Object
Dim JSONResponse As String = JSON.ToString 'Save it into a string
If mqtt.Connected = True Then mqtt.Publish("ScoreData/" & Targetaddress, JSONResponse.GetBytes("UTF-8")) 'Send JSON String to HMI
End Sub