static void Main(string[] args) { XBeeMqtt sensor = new XBeeMqtt("COM22", 115200, "server", 1883); sensor.LogMsgEvent += Sensor_LogMsgEvent; sensor.Start(); //string host = deviceId.ToString("X16"); //sensor.send(deviceId, "/cmd/" + host + "/Query", null); System.Console.ReadLine(); }
protected override void OnStart(string[] args) { try { sensor = new XBeeMqtt(Properties.Settings.Default.SerialPortName, Properties.Settings.Default.SerialPortBaudRate, Properties.Settings.Default.MqttBrokerHost, Properties.Settings.Default.MqttBrokerPort ); sensor.LogMsgEvent += Sensor_LogMsgEvent; sensor.Start(); } catch (Exception ex) { Trace.TraceError(ex.ToString()); } }