Esempio n. 1
0
        void mqtt_MqttMsgPublishReceived(object sender, uPLibrary.Networking.M2Mqtt.Messages.MqttMsgPublishEventArgs e)
        {
            DateTime now = DateTime.Now;

            if (now < lastSystemRequestTime.AddSeconds(2) || e.Message.Length > 4096 || e.Topic.Length > 256)
            {
                return;
            }

            lastSystemRequestTime = now;

            string[] result = IotList.Action(DecodeAction(e.Topic, Utilities.BytesToString(e.Message)));
            if (result != null)
            {
                Publish(ConfigurationManager.MqttDeviceAnnounce + ConfigurationManager.DeviceName, SystemConfig(result));
            }
        }
Esempio n. 2
0
 void IDisposable.Dispose()
 {
     IotList.RemoveItem(id);
     CleanUp();
 }
Esempio n. 3
0
 public IotBase(string name, string type)
 {
     this.name = name == null ? "unknown" : name.ToLower();
     this.type = type == null ? "unknown" : type.ToLower();
     this.id   = IotList.AddItem(this);
 }