|
|
|
|
@ -1,10 +1,7 @@ |
|
|
|
|
using System; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Text; |
|
|
|
|
using M2Mqtt; |
|
|
|
|
using M2Mqtt.Messages; |
|
|
|
|
using System.Text.Json; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
|
|
|
|
|
|
namespace RaspiControl { |
|
|
|
|
class Programm { |
|
|
|
|
@ -49,7 +46,7 @@ namespace RaspiControl { |
|
|
|
|
|
|
|
|
|
private static void PublishSplitFlapDisplay(string message) { |
|
|
|
|
string payload = JsonSerializer.Serialize<Dictionary<string, string>>(new Dictionary<string, string>() { { "message", message } }); |
|
|
|
|
client.Publish(MqttConstants.SPLITFLAP_DISPLAY, Encoding.UTF8.GetBytes(payload),MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE,false); |
|
|
|
|
client.Publish(MqttConstants.SPLITFLAP_DISPLAY_TOPIC, Encoding.UTF8.GetBytes(payload),MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE,false); |
|
|
|
|
} |
|
|
|
|
private static void Client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e) { |
|
|
|
|
string deviceId = ""; |
|
|
|
|
@ -67,7 +64,7 @@ namespace RaspiControl { |
|
|
|
|
switch (appState) { |
|
|
|
|
case APP_STATE.STARTUP: |
|
|
|
|
Console.WriteLine("Startup"); |
|
|
|
|
client.Publish(MqttConstants.SPLITFLAP_INIT, new byte[] { }, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); |
|
|
|
|
client.Publish(MqttConstants.SPLITFLAP_INIT_TOPIC, new byte[] { }, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); |
|
|
|
|
break; |
|
|
|
|
case APP_STATE.INIT: |
|
|
|
|
Console.WriteLine("Init"); |
|
|
|
|
|