public static void Main() { netduino = NetduinoFactory.Get(config.AppSettings["LedPinType"]); netduino.Setup(); mqttClient = new MqttClient(IPAddress.Parse(config.AppSettings["MqttHost"]), int.Parse(config.AppSettings["MqttPort"]), false, null); mqttClient.Connect(config.AppSettings["MqttClientName"] + "-" + config.AppSettings["MqttPairingCode"], config.AppSettings["MqttUsername"], config.AppSettings["MqttPassword"]); mqttClient.MqttMsgPublishReceived += client_MqttMsgPublishReceived; mqttClient.MqttMsgSubscribed += client_MqttMsgSubscribed; mqttClient.Subscribe(new string[] { config.AppSettings["MqttTopic"] + config.AppSettings["MqttPairingCode"] }, new byte[] { MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE }); }
public static void Main() { netduino = NetduinoFactory.Get(ConfigurationManager.LedPinType); netduino.Setup(); mqttClient = new MqttClient(ConfigurationManager.MqttHost, ConfigurationManager.MqttPort, false, null); mqttClient.Connect(ConfigurationManager.MqttClientId, ConfigurationManager.MqttUsername, ConfigurationManager.MqttPassword); mqttClient.MqttMsgPublishReceived += client_MqttMsgPublishReceived; mqttClient.MqttMsgSubscribed += client_MqttMsgSubscribed; mqttClient.Subscribe(new string[] { ConfigurationManager.MqttTopic }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE }); }