Skip to content

Commit 997a050

Browse files
committed
[1.8.3] Update to changed ConnectorDataMqtt and remove Scral from code, because its an own project now, that uses the mqtt-backend
1 parent 17cd18a commit 997a050

File tree

7 files changed

+16
-220
lines changed

7 files changed

+16
-220
lines changed

Lora-Bot/Lora-Bot.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
</ItemGroup>
4545
<ItemGroup>
4646
<Compile Include="Moduls\Mqtt.cs" />
47-
<Compile Include="Moduls\Scral.cs" />
4847
<Compile Include="Moduls\Txtout.cs" />
4948
<Compile Include="Program.cs" />
5049
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -80,9 +79,6 @@
8079
</ProjectReference>
8180
</ItemGroup>
8281
<ItemGroup>
83-
<None Include="config-example\scral.conf.example">
84-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
85-
</None>
8682
<None Include="config-example\mqtt.conf.example">
8783
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8884
</None>

Lora-Bot/Moduls/Mqtt.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,10 @@
88

99
namespace Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls {
1010
class Mqtt : Mqtt<LoraController> {
11-
private Boolean mqttconnect = false;
12-
1311
public override event ModulEvent Update;
1412

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

17-
protected override void Connect() {
18-
this.mqtt = ABackend.GetInstance(this.config["settings"], ABackend.BackendType.Data);
19-
Console.WriteLine("Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls.Mqtt.Connect");
20-
this.mqttconnect = true;
21-
}
22-
23-
protected override void Disconnect() {
24-
this.mqttconnect = false;
25-
if (this.mqtt != null) {
26-
this.mqtt.Dispose();
27-
}
28-
this.mqtt = null;
29-
Console.WriteLine("Fraunhofer.Fit.IoT.Bots.LoraBot.Moduls.Mqtt.Disconnect");
30-
}
31-
3215
public override void EventLibSetter() {
3316
this.library.DataUpdate += this.HandleLibUpdate;
3417
this.library.PanicUpdate += this.HandleLibUpdate;
@@ -37,7 +20,7 @@ public override void EventLibSetter() {
3720

3821
protected override void LibUpadteThread(Object state) {
3922
try {
40-
if (this.mqttconnect) {
23+
if (this.mqtt.IsConnected) {
4124
if(state.GetType().HasInterface(typeof(IMqtt))) {
4225
IMqtt sensor = state as IMqtt;
4326
((ADataBackend)this.mqtt).Send("lora/" + sensor.MqttTopic(), sensor.ToJson());

Lora-Bot/Moduls/Scral.cs

Lines changed: 0 additions & 170 deletions
This file was deleted.

Lora-Bot/Moduls/Txtout.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ public Txtout(LoraController lib, InIReader settings) : base(lib, settings) {
2424

2525
}
2626

27-
public override void EventLibSetter() {
28-
this.library.DataUpdate += this.HandleLibUpdate;
29-
}
27+
public override void EventLibSetter() => this.library.DataUpdate += this.HandleLibUpdate;
3028

3129
protected override void LibUpadteThread(Object state) {
3230
try {

Lora-Bot/Program.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public Program(String[] args) {
2929
this.ModulEvents();
3030
lora.DataUpdate += this.LoraDataUpdate;
3131
lora.StatusUpdate += this.LoraStatusUpdate;
32+
lora.PanicUpdate += this.LoraPanicUpdate;
3233
this.WaitForShutdown();
3334
Console.WriteLine("after wait");
3435
this.ModulDispose();
@@ -47,13 +48,11 @@ public Program(String[] args) {
4748
}
4849
}
4950

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

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

5857
}
5958
}

Lora-Bot/Properties/AssemblyInfo.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
using System.Reflection;
2+
using System.Resources;
23
using System.Runtime.InteropServices;
34

45
// Allgemeine Informationen über eine Assembly werden über die folgenden
56
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
67
// die einer Assembly zugeordnet sind.
78
[assembly: AssemblyTitle("Lora-Bot")]
8-
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyDescription("Program that runs on a device and process the Lora traffic from the Lora library")]
910
[assembly: AssemblyConfiguration("")]
10-
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyCompany("Fraunhofer FIT")]
1112
[assembly: AssemblyProduct("Lora-Bot")]
12-
[assembly: AssemblyCopyright("Copyright © 2018 - 22.04.2019")]
13-
[assembly: AssemblyTrademark("")]
13+
[assembly: AssemblyCopyright("Copyright © 2018 - 31.05.2019")]
14+
[assembly: AssemblyTrademark("Fraunhofer FIT, BlubbFish")]
1415
[assembly: AssemblyCulture("")]
16+
[assembly: NeutralResourcesLanguage("de-DE")]
1517

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

Lora-Bot/config-example/scral.conf.example

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)