Exemplo n.º 1
0
        public Mqtt(MQTTConnection connection)
        {
            _connection   = connection;
            _topicMatcher = new MqttTopicMatcher();
            _handlers     = new List <MqttHandler>();

            _connection.MqttMsgPublishReceived += OnConnectionOnMqttMsgPublishReceived;
        }
Exemplo n.º 2
0
        public Mqtt(MQTTConnection connection)
        {
            _connection = connection;
            _topicMatcher = new MqttTopicMatcher();
            _handlers = new List<MqttHandler>();

            _connection.MqttMsgPublishReceived += OnConnectionOnMqttMsgPublishReceived;
        }
Exemplo n.º 3
0
        protected MqttModule(string brokerHostName, int brokerPort, string username, string password)
        {
            _thishost = new MqttHost(brokerHostName, brokerPort, username);
            if (!Clients.ContainsKey(_thishost))
            {
                Clients[_thishost]        = new MQTTConnection(brokerHostName, brokerPort, username, password);
                ClientUseCount[_thishost] = 1;
            }
            else
            {
                ClientUseCount[_thishost]++;
            }

            On = new Mqtt(Clients[_thishost]);

            //Publish = (topic, message) =>
            //{
            //    On.Publish(topic, message);
            //};
        }