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)); } }
void IDisposable.Dispose() { IotList.RemoveItem(id); CleanUp(); }
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); }