[NF] Umbenennung zu IoTBot Namespace
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Dashboard.Connector {
|
||||
namespace IoTBot.Connector {
|
||||
public abstract class ADataBackend {
|
||||
|
||||
public abstract event MqttMessage MessageIncomming;
|
||||
public abstract event MqttMessage MessageSending;
|
||||
public delegate void MqttMessage(Object sender, MqttEventArgs e);
|
||||
public delegate void MqttMessage(ADataBackend sender, MqttEventArgs e);
|
||||
|
||||
public static ADataBackend GetInstance(Dictionary<String, String> dictionary) {
|
||||
String object_sensor = "Dashboard.Connector." + Char.ToUpper(dictionary["type"][0]) + dictionary["type"].Substring(1).ToLower();
|
||||
String object_sensor = "IoTBot.Connector." + Char.ToUpper(dictionary["type"][0]) + dictionary["type"].Substring(1).ToLower();
|
||||
Type t = null;
|
||||
try {
|
||||
t = Type.GetType(object_sensor, true);
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Dashboard.Connector {
|
||||
namespace IoTBot.Connector {
|
||||
class Mosquitto : ADataBackend, IDisposable {
|
||||
private Process p;
|
||||
private String message;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using BlubbFish.Utils;
|
||||
using uPLibrary.Networking.M2Mqtt;
|
||||
using uPLibrary.Networking.M2Mqtt.Messages;
|
||||
|
||||
namespace Dashboard.Connector {
|
||||
namespace IoTBot.Connector {
|
||||
class Mqtt : ADataBackend, IDisposable {
|
||||
private MqttClient client;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using Telegram.Bot.Args;
|
||||
using Telegram.Bot.Exceptions;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace MqttToTelegram {
|
||||
namespace IoTBot.Connector {
|
||||
class Telegram {
|
||||
private static Telegram instance;
|
||||
private TelegramBotClient bot;
|
||||
@@ -17,8 +17,8 @@ namespace MqttToTelegram {
|
||||
public event TelegramMessage MessageSending;
|
||||
|
||||
private Telegram() {
|
||||
bot = new TelegramBotClient(InIReader.GetInstance("settings.ini").GetValue("general", "telegram-key"));
|
||||
bot.OnMessage += Bot_OnMessage;
|
||||
this.bot = new TelegramBotClient(InIReader.GetInstance("settings.ini").GetValue("general", "telegram-key"));
|
||||
this.bot.OnMessage += this.Bot_OnMessage;
|
||||
this.Connect();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace MqttToTelegram {
|
||||
}
|
||||
|
||||
private void Connect() {
|
||||
bot.StartReceiving();
|
||||
this.bot.StartReceiving();
|
||||
this.chat = new ChatId(InIReader.GetInstance("settings.ini").GetValue("general", "chatid"));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using BlubbFish.Utils;
|
||||
using Dashboard.Connector;
|
||||
using Dashboard.Sensor;
|
||||
using IoTBot.Connector;
|
||||
using IoTBot.Sensor;
|
||||
using Dashboard.Tracings;
|
||||
|
||||
namespace Dashboard {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Dashboard.Connector;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using IoTBot.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
namespace IoTBot.Sensor {
|
||||
public abstract class ASensor : IDisposable {
|
||||
protected String topic;
|
||||
protected Int32 pollcount;
|
||||
@@ -50,7 +50,7 @@ namespace Dashboard.Sensor {
|
||||
}
|
||||
|
||||
internal static ASensor GetInstance(ADataBackend backend, Dictionary<String, String> dictionary, String name) {
|
||||
String object_sensor = "Dashboard.Sensor." + Char.ToUpper(dictionary["type"][0]) + dictionary["type"].Substring(1).ToLower();
|
||||
String object_sensor = "IoTBot.Sensor." + Char.ToUpper(dictionary["type"][0]) + dictionary["type"].Substring(1).ToLower();
|
||||
Type t = null;
|
||||
try {
|
||||
t = Type.GetType(object_sensor, true);
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
using Dashboard.Connector;
|
||||
using IoTBot.Connector;
|
||||
using LitJson;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
namespace IoTBot.Sensor {
|
||||
class Flex4gridswitch : ASensor {
|
||||
private String id;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Dashboard.Connector;
|
||||
using IoTBot.Connector;
|
||||
using LitJson;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
namespace IoTBot.Sensor {
|
||||
class Flex4gridpower : ASensor {
|
||||
private String id;
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using uPLibrary.Networking.M2Mqtt.Messages;
|
||||
using IoTBot.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
namespace IoTBot.Sensor {
|
||||
class Luminanz : ASensor {
|
||||
public Luminanz(Dictionary<String, String> settings) : base(settings) {
|
||||
public Luminanz(Dictionary<String, String> settings, String name, ADataBackend backend) : base(settings, name, backend) {
|
||||
this.GetBool = true;
|
||||
this.GetFloat = 0.0f;
|
||||
this.GetInt = 0;
|
||||
this.Datatypes = Types.Int;
|
||||
}
|
||||
|
||||
protected override void UpdateValue(MqttMsgPublishEventArgs e) {
|
||||
this.GetInt = Int32.Parse(Encoding.UTF8.GetString(e.Message), new CultureInfo("en-US"));
|
||||
protected override Boolean UpdateValue(MqttEventArgs e) {
|
||||
this.GetInt = Int32.Parse(e.Message, new CultureInfo("en-US"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using uPLibrary.Networking.M2Mqtt.Messages;
|
||||
using IoTBot.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
namespace IoTBot.Sensor {
|
||||
class Pir : ASensor {
|
||||
public Pir(Dictionary<String, String> settings) : base(settings) {
|
||||
public Pir(Dictionary<String, String> settings, String name, ADataBackend backend) : base(settings, name, backend) {
|
||||
this.Datatypes = Types.Bool;
|
||||
}
|
||||
|
||||
protected override void UpdateValue(MqttMsgPublishEventArgs e) {
|
||||
this.GetBool = (Encoding.UTF8.GetString(e.Message).ToLower() == "on") ? true : false;
|
||||
protected override Boolean UpdateValue(MqttEventArgs e) {
|
||||
this.GetBool = (e.Message.ToLower() == "on") ? true : false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Dashboard.Connector;
|
||||
using IoTBot.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
namespace IoTBot.Sensor {
|
||||
class Power : ASensor {
|
||||
public Power(Dictionary<String, String> settings, String name, ADataBackend backend) : base(settings, name, backend) {
|
||||
this.GetBool = true;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dashboard.Connector;
|
||||
using IoTBot.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
namespace IoTBot.Sensor {
|
||||
class Switch : ASensor {
|
||||
public Switch(Dictionary<System.String, System.String> settings, String name, ADataBackend backend) : base(settings, name, backend) {
|
||||
this.Datatypes = Types.Bool;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using uPLibrary.Networking.M2Mqtt.Messages;
|
||||
using IoTBot.Connector;
|
||||
|
||||
namespace Dashboard.Sensor {
|
||||
namespace IoTBot.Sensor {
|
||||
class Temperatur : ASensor {
|
||||
public Temperatur(Dictionary<String, String> settings) : base(settings) {
|
||||
public Temperatur(Dictionary<String, String> settings, String name, ADataBackend backend) : base(settings, name, backend) {
|
||||
this.GetBool = true;
|
||||
this.GetFloat = 0.0f;
|
||||
this.GetInt = 0;
|
||||
this.Datatypes = Types.Float;
|
||||
}
|
||||
|
||||
protected override void UpdateValue(MqttMsgPublishEventArgs e) {
|
||||
this.GetFloat = Single.Parse(Encoding.UTF8.GetString(e.Message), new CultureInfo("en-US"));
|
||||
protected override Boolean UpdateValue(MqttEventArgs e) {
|
||||
this.GetFloat = Single.Parse(e.Message, new CultureInfo("en-US"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using Dashboard.Sensor;
|
||||
using IoTBot.Sensor;
|
||||
|
||||
namespace Dashboard.Tracings {
|
||||
public abstract class ATracings {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Dashboard.Sensor;
|
||||
using IoTBot.Sensor;
|
||||
using OxyPlot;
|
||||
using OxyPlot.Axes;
|
||||
using OxyPlot.Series;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Dashboard.Sensor;
|
||||
using IoTBot.Sensor;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Dashboard.Sensor;
|
||||
using IoTBot.Sensor;
|
||||
|
||||
namespace Dashboard.Tracings {
|
||||
class Powermeter : Meter {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using Dashboard.Connector;
|
||||
using Dashboard.Sensor;
|
||||
using IoTBot.Connector;
|
||||
using IoTBot.Sensor;
|
||||
|
||||
namespace Dashboard.Tracings {
|
||||
class Switcher : ATracings {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user