[BF] v.1.2.1.1 Next try to emulate F4G Events

This commit is contained in:
BlubbFish 2017-12-09 12:33:15 +00:00
parent 5fa97ea82b
commit c96b2393d3
8 changed files with 29 additions and 6 deletions

View File

@ -117,16 +117,38 @@ namespace ZwayBot.Moduls {
} }
private void RequestAlive() { private void RequestAlive() {
String raspi = this.ini.GetValue("f4g", "raspi");
lock (this.requestalivelock) { lock (this.requestalivelock) {
HttpWebRequest request = WebRequest.CreateHttp(this.ini.GetValue("f4g", "ping")); String req = "https://wiki.flex4grid.eu/rupdate/rupdate_general.yml.gpg.asc?gw=" + raspi;
HttpWebRequest request = WebRequest.CreateHttp(req);
try { try {
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {} using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
} catch(Exception) { } this.Update?.Invoke(this, new Flex4gridEvent(req, response.StatusCode.ToString()));
}
} catch (Exception) { }
}
lock (this.requestalivelock) {
String req = "https://wiki.flex4grid.eu/rupdate/rupdate_general.yml?gw=" + raspi;
HttpWebRequest request = WebRequest.CreateHttp(req);
try {
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
this.Update?.Invoke(this, new Flex4gridEvent(req, response.StatusCode.ToString()));
}
} catch (Exception) { }
}
lock (this.requestalivelock) {
String req = "http://swb.pcs.flex4grid.eu/gateway/" + raspi;
HttpWebRequest request = WebRequest.CreateHttp(req);
try {
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
this.Update?.Invoke(this, new Flex4gridEvent(req, response.StatusCode.ToString()));
}
} catch (Exception) { }
} }
} }
public override void Interconnect(Dictionary<String, AModul> moduls) { public override void Interconnect(Dictionary<String, AModul> moduls) {
if (this.ini.GetValue("f4g", "ping") != null) { if (this.ini.GetValue("f4g", "raspi") != null) {
foreach (KeyValuePair<String, AModul> item in moduls) { foreach (KeyValuePair<String, AModul> item in moduls) {
if (item.Value is CronJob) { if (item.Value is CronJob) {
item.Value.SetInterconnection("10,40 * * * *", this.RequestAlive); item.Value.SetInterconnection("10,40 * * * *", this.RequestAlive);

View File

@ -33,8 +33,8 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2.0")] [assembly: AssemblyVersion("1.1.2.1")]
[assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyFileVersion("1.1.2.1")]
[assembly: NeutralResourcesLanguage("de-DE")] [assembly: NeutralResourcesLanguage("de-DE")]
// “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com. // “Internet Of Things” icon by By Michael Wohlwend, US, from thenounproject.com.

View File

@ -58,6 +58,7 @@
<Compile Include="Moduls\CronJob.cs" /> <Compile Include="Moduls\CronJob.cs" />
<Compile Include="Helper.cs" /> <Compile Include="Helper.cs" />
<Compile Include="Moduls\Flex4Grid.cs" /> <Compile Include="Moduls\Flex4Grid.cs" />
<Compile Include="Moduls\Mqtt.cs" />
<Compile Include="Moduls\Overtaker.cs" /> <Compile Include="Moduls\Overtaker.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.