public void Run(IBackgroundTaskInstance taskInstance)
 {
     //
     // TODO: Insert code to start one or more asynchronous methods
     //
     broker = new MqttBroker();
     deferral = taskInstance.GetDeferral();
     taskInstance.Canceled += TaskInstance_Canceled;
     broker.UserAuth = (name, pwd) =>
     {
         return true;//every one can access
     };
     broker.Start();
 }
Пример #2
0
        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            this.broker = new MqttBroker();
        }
Пример #3
0
        static void Main(string[] args)
        {
#if TRACE
            //MqttUtility.Trace.TraceLevel = MqttUtility.TraceLevel.Verbose | MqttUtility.TraceLevel.Frame;
            //MqttUtility.Trace.TraceListener = (f, a) => System.Diagnostics.Trace.WriteLine(System.String.Format(f, a));
#endif

            // create and start broker
            MqttBroker broker = new MqttBroker();
            broker.Start();

            Console.ReadLine();

            broker.Stop();
        }
 public bool Connect()
 {
     bool success = false;
     //
     try
     {
         mqttService = new MqttBroker();
         mqttService.Start();
         success = true;
     }
     catch (Exception e)
     {
         Console.WriteLine("MQTT Broker could not be started: " + e.Message);
         Disconnect();
     }
     if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction() { Domain = this.Domain });
     //
     return success;
 }
 public void Disconnect()
 {
     try
     {
         mqttService.Stop();
     } catch { }
     mqttService = null;
 }
Пример #6
0
        public MainPage()
        {
            this.InitializeComponent();

            this.broker = new MqttBroker();
        }