Sub mqtt_Connected (Success As Boolean)
If Success = False Then
Log(LastException)
lblStatus.Text = "Error connecting"
Else
lblStatus.Text = "Connected"
mqtt.Subscribe("outTopic", 0)
End If
End Sub
Private Sub mqtt_Disconnected
lblStatus.Text = "Disconnected"
End Sub
Private Sub mqtt_MessageArrived (Topic As String, Payload() As Byte)
Dim obj As Object = serializator.ConvertBytesToObject(Payload)
If obj Is CircleData Then
If Topic = mytopic Then Return 'the circle was already drawn
Dim cd As CircleData = obj
DrawCircleData(cd)
Else 'obj is string
Dim s As String = obj
Select s
Case "clear"
Canvas1.DrawColor(Colors.Black)
Activity.Invalidate
Case "close"
Activity.Finish
End Select
End If
End Sub