示例#1
0
        public Mqtt(MQTTConnection connection)
        {
            _connection   = connection;
            _topicMatcher = new MqttTopicMatcher();
            _handlers     = new List <MqttHandler>();

            _connection.MqttMsgPublishReceived += OnConnectionOnMqttMsgPublishReceived;
        }
示例#2
0
文件: MQTT.cs 项目: lingxyd/Charlotte
        public Mqtt(MQTTConnection connection)
        {
            _connection = connection;
            _topicMatcher = new MqttTopicMatcher();
            _handlers = new List<MqttHandler>();

            _connection.MqttMsgPublishReceived += OnConnectionOnMqttMsgPublishReceived;
        }
示例#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);
            //};
        }