Update project dependencys
fixing tiny stuff so that is compatible to the last version add .gitignore
This commit is contained in:
parent
4f9c6fd7db
commit
9596c46a2e
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/.vs
|
||||
/ConnectorDataMosquitto/obj
|
||||
/ConnectorDataMosquitto/bin
|
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMosquitto", "C
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -45,7 +45,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Utils-IoT.csproj">
|
||||
<ProjectReference Include="..\..\Utils-IoT\Utils-IoT\Utils-IoT.csproj">
|
||||
<Project>{b870e4d5-6806-4a0b-b233-8907eedc5afc}</Project>
|
||||
<Name>Utils-IoT</Name>
|
||||
</ProjectReference>
|
||||
|
@ -2,17 +2,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using BlubbFish.Utils.IoT.Events;
|
||||
|
||||
namespace BlubbFish.Utils.IoT.Connector.Data {
|
||||
public class Mosquitto : ADataBackend, IDisposable {
|
||||
private Process p;
|
||||
private String message;
|
||||
|
||||
public override event MqttMessage MessageIncomming;
|
||||
public override event MqttMessage MessageSending;
|
||||
|
||||
public Mosquitto(Dictionary<String, String> mqtt_settings) {
|
||||
this.settings = mqtt_settings;
|
||||
public Mosquitto(Dictionary<String, String> settings) : base(settings) {
|
||||
//mosquitto_sub --cafile ca.pem --cert cert.pem --key cert.key -h swb.broker.flex4grid.eu -p 8883 -t "#" -v -d
|
||||
this.message = "";
|
||||
this.p = new Process();
|
||||
@ -69,7 +66,7 @@ namespace BlubbFish.Utils.IoT.Connector.Data {
|
||||
send.StartInfo.RedirectStandardError = true;
|
||||
send.Start();
|
||||
send.WaitForExit();
|
||||
MessageSending?.Invoke(this, new MqttEventArgs(data, topic));
|
||||
this.NotifyClientSending(new DataEvent(data, topic, DateTime.Now));
|
||||
}
|
||||
|
||||
private void P_ErrorDataReceived(Object sender, DataReceivedEventArgs e) {
|
||||
@ -85,7 +82,7 @@ namespace BlubbFish.Utils.IoT.Connector.Data {
|
||||
MatchCollection matches = (new Regex("^Client mosqsub[\\|/].*received PUBLISH \\(.*,.*,.*,.*, '(.*)'.*\\)\\)\n[^ ]* (.*)$", RegexOptions.IgnoreCase | RegexOptions.Singleline)).Matches(this.message);
|
||||
String topic = matches[0].Groups[1].Value;
|
||||
String message = matches[0].Groups[2].Value.Trim();
|
||||
this.MessageIncomming?.Invoke(this, new MqttEventArgs(message, topic));
|
||||
this.NotifyClientIncomming(new DataEvent(message, topic, DateTime.Now));
|
||||
}
|
||||
this.message = e.Data + "\n";
|
||||
} else {
|
||||
@ -94,9 +91,18 @@ namespace BlubbFish.Utils.IoT.Connector.Data {
|
||||
}
|
||||
}
|
||||
|
||||
public override Boolean IsConnected {
|
||||
get {
|
||||
if (!this.p.HasExited) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region IDisposable Support
|
||||
private Boolean disposedValue = false; // Dient zur Erkennung redundanter Aufrufe.
|
||||
private readonly Dictionary<String, String> settings;
|
||||
|
||||
protected virtual void Dispose(Boolean disposing) {
|
||||
if (!this.disposedValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user