Skip to content

Commit

Permalink
[1.8.3] Update to changed ConnectorDataMqtt and remove Scral from cod…
Browse files Browse the repository at this point in the history
…e, because its an own project now, that uses the mqtt-backend
  • Loading branch information
blubbfish committed May 31, 2019
1 parent 17cd18a commit 997a050
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 220 deletions.
4 changes: 0 additions & 4 deletions Lora-Bot/Lora-Bot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Moduls\Mqtt.cs" />
<Compile Include="Moduls\Scral.cs" />
<Compile Include="Moduls\Txtout.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down Expand Up @@ -80,9 +79,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="config-example\scral.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config-example\mqtt.conf.example">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
19 changes: 1 addition & 18 deletions Lora-Bot/Moduls/Mqtt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,10 @@

namespace Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls {
class Mqtt : Mqtt<LoraController> {
private Boolean mqttconnect = false;

public override event ModulEvent Update;

public Mqtt(LoraController lib, InIReader settings) : base(lib, settings) { }

protected override void Connect() {
this.mqtt = ABackend.GetInstance(this.config["settings"], ABackend.BackendType.Data);
Console.WriteLine("Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls.Mqtt.Connect");
this.mqttconnect = true;
}

protected override void Disconnect() {
this.mqttconnect = false;
if (this.mqtt != null) {
this.mqtt.Dispose();
}
this.mqtt = null;
Console.WriteLine("Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls.Mqtt.Disconnect");
}

public override void EventLibSetter() {
this.library.DataUpdate += this.HandleLibUpdate;
this.library.PanicUpdate += this.HandleLibUpdate;
Expand All @@ -37,7 +20,7 @@ class Mqtt : Mqtt<LoraController> {

protected override void LibUpadteThread(Object state) {
try {
if (this.mqttconnect) {
if (this.mqtt.IsConnected) {
if(state.GetType().HasInterface(typeof(IMqtt))) {
IMqtt sensor = state as IMqtt;
((ADataBackend)this.mqtt).Send("lora/" + sensor.MqttTopic(), sensor.ToJson());
Expand Down
170 changes: 0 additions & 170 deletions Lora-Bot/Moduls/Scral.cs

This file was deleted.

4 changes: 1 addition & 3 deletions Lora-Bot/Moduls/Txtout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ public class Txtout : AModul<LoraController> {

}

public override void EventLibSetter() {
this.library.DataUpdate += this.HandleLibUpdate;
}
public override void EventLibSetter() => this.library.DataUpdate += this.HandleLibUpdate;

protected override void LibUpadteThread(Object state) {
try {
Expand Down
11 changes: 5 additions & 6 deletions Lora-Bot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Program : Bot<LoraController> {
this.ModulEvents();
lora.DataUpdate += this.LoraDataUpdate;
lora.StatusUpdate += this.LoraStatusUpdate;
lora.PanicUpdate += this.LoraPanicUpdate;
this.WaitForShutdown();
Console.WriteLine("after wait");
this.ModulDispose();
Expand All @@ -47,13 +48,11 @@ class Program : Bot<LoraController> {
}
}

private void LoraStatusUpdate(Object sender, StatusUpdateEvent e) {
Console.WriteLine("-> Lora-Status: " + e.ToString());
}
private void LoraPanicUpdate(Object sender, PanicUpdateEvent e) => Console.WriteLine("-> Lora-Panic: " + e.ToString());

private void LoraDataUpdate(Object sender, DataUpdateEvent e) {
Console.WriteLine("-> Lora-Data: " + e.ToString());
}
private void LoraStatusUpdate(Object sender, StatusUpdateEvent e) => Console.WriteLine("-> Lora-Status: " + e.ToString());

private void LoraDataUpdate(Object sender, DataUpdateEvent e) => Console.WriteLine("-> Lora-Data: " + e.ToString());

}
}
15 changes: 9 additions & 6 deletions Lora-Bot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;

// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("Lora-Bot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Program that runs on a device and process the Lora traffic from the Lora library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Fraunhofer FIT")]
[assembly: AssemblyProduct("Lora-Bot")]
[assembly: AssemblyCopyright("Copyright © 2018 - 22.04.2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright © 2018 - 31.05.2019")]
[assembly: AssemblyTrademark("Fraunhofer FIT, BlubbFish")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("de-DE")]

// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
Expand All @@ -31,8 +33,8 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.8.2")]
[assembly: AssemblyFileVersion("1.8.2")]
[assembly: AssemblyVersion("1.8.3")]
[assembly: AssemblyFileVersion("1.8.3")]
/*
* 1.1.0 Update Scral addresses
* 1.2.0 Run Module Events in threads so that one Module can not block others, TXTOut now appends to the logfile
Expand All @@ -51,4 +53,5 @@
* 1.8.0 Add field that indicates when the last gps position was recieved, change all times to UTC
* 1.8.1 Add Hostname to MQTT, so you can see from witch device the data is recieved
* 1.8.2 Bugfix, create also an event for sending normal loradata when update panic
* 1.8.3 Update to changed ConnectorDataMqtt and remove Scral from code, because its an own project now, that uses the mqtt-backend
*/
13 changes: 0 additions & 13 deletions Lora-Bot/config-example/scral.conf.example

This file was deleted.

0 comments on commit 997a050

Please sign in to comment.