Cleanups
This commit is contained in:
parent
dd6f8a7e6a
commit
a7c0a8906a
Binary file not shown.
@ -25,8 +25,17 @@ namespace BlubbFish.Utils.IoT.Connector.Data {
|
|||||||
} else {
|
} else {
|
||||||
this.client.Connect(Guid.NewGuid().ToString());
|
this.client.Connect(Guid.NewGuid().ToString());
|
||||||
}
|
}
|
||||||
|
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 });
|
this.client.Subscribe(new String[] { "#" }, new Byte[] { MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Client_MqttMsgPublishReceived(Object sender, MqttMsgPublishEventArgs e) {
|
private void Client_MqttMsgPublishReceived(Object sender, MqttMsgPublishEventArgs e) {
|
||||||
this.NotifyClientIncomming(new DataEvent(Encoding.UTF8.GetString(e.Message), e.Topic, DateTime.Now));
|
this.NotifyClientIncomming(new DataEvent(Encoding.UTF8.GetString(e.Message), e.Topic, DateTime.Now));
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -9,7 +9,7 @@ namespace BlubbFish.Utils
|
|||||||
public abstract class OwnModel<T> where T : class
|
public abstract class OwnModel<T> where T : class
|
||||||
{
|
{
|
||||||
private static readonly Lazy<T> _instance = new Lazy<T>(() => CreateInstanceOfT());
|
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
|
public static T Instance
|
||||||
{
|
{
|
||||||
get {
|
get {
|
||||||
@ -35,5 +35,6 @@ namespace BlubbFish.Utils
|
|||||||
this.observer.ForEach(delegate (OwnView view) { view.Update(); });
|
this.observer.ForEach(delegate (OwnView view) { view.Update(); });
|
||||||
}
|
}
|
||||||
abstract protected void Init();
|
abstract protected void Init();
|
||||||
|
abstract public void Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user