This commit is contained in:
BlubbFish 2018-09-06 20:26:38 +00:00
parent dd6f8a7e6a
commit a7c0a8906a
7 changed files with 12 additions and 2 deletions

Binary file not shown.

View File

@ -25,7 +25,16 @@ namespace BlubbFish.Utils.IoT.Connector.Data {
} else {
this.client.Connect(Guid.NewGuid().ToString());
}
this.client.Subscribe(new String[] { "#" }, new Byte[] { MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE });
if (this.settings.ContainsKey("topic")) {
Int32 l = this.settings["topic"].Split(';').Length;
Byte[] qos = new Byte[l];
for (Int32 i = 0; i < qos.Length; i++) {
qos[i] = MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE;
}
this.client.Subscribe(this.settings["topic"].Split(';'), qos);
} else {
this.client.Subscribe(new String[] { "#" }, new Byte[] { MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE });
}
}
private void Client_MqttMsgPublishReceived(Object sender, MqttMsgPublishEventArgs e) {

Binary file not shown.

View File

@ -9,7 +9,7 @@ namespace BlubbFish.Utils
public abstract class OwnModel<T> where T : class
{
private static readonly Lazy<T> _instance = new Lazy<T>(() => CreateInstanceOfT());
private List<OwnView> observer = new List<OwnView>();
private readonly List<OwnView> observer = new List<OwnView>();
public static T Instance
{
get {
@ -35,5 +35,6 @@ namespace BlubbFish.Utils
this.observer.ForEach(delegate (OwnView view) { view.Update(); });
}
abstract protected void Init();
abstract public void Dispose();
}
}

Binary file not shown.