first commit

This commit is contained in:
BlubbFish 2026-08-03 13:00:54 +02:00
commit 082f801300
5 changed files with 141 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.vs
GPSDMqtt/bin
GPSDMqtt/obj
settings.conf

67
GPSDMqtt.sln Normal file
View File

@ -0,0 +1,67 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GPSDMqtt", "GPSDMqtt\GPSDMqtt.csproj", "{727D4D8B-6B97-4463-A145-B8CB10838A01}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GPSDLib", "..\Librarys\GPSDLib\GPSDLib\GPSDLib.csproj", "{6F93B9BC-C9D5-4F1F-A2B2-B03226A9A188}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "litjson", "..\Librarys\litjson\litjson\litjson.csproj", "{C9269893-5493-4112-ADF4-F2E066FC6EA6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConnectorDataMqtt", "..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt.csproj", "{DC6F127A-5E04-4661-9ABB-E701ADF3D6F8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConnectorDataGpsd", "..\Utils\ConnectorDataGpsd\ConnectorDataGpsd\ConnectorDataGpsd.csproj", "{504AD4AC-3CC6-45D4-BEA7-C290DD77EB04}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot-Utils", "..\Utils\Bot-Utils\Bot-Utils\Bot-Utils.csproj", "{C836A12D-F30D-4662-843E-F1B466695463}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils", "..\Utils\Utils\Utils\Utils.csproj", "{EAF79574-F939-48C5-B5AE-39783F59C4A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils-IoT", "..\Utils\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{41B602DF-C8A9-47B4-A45E-6EDE74F56376}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{727D4D8B-6B97-4463-A145-B8CB10838A01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{727D4D8B-6B97-4463-A145-B8CB10838A01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{727D4D8B-6B97-4463-A145-B8CB10838A01}.Release|Any CPU.ActiveCfg = Release|Any CPU
{727D4D8B-6B97-4463-A145-B8CB10838A01}.Release|Any CPU.Build.0 = Release|Any CPU
{6F93B9BC-C9D5-4F1F-A2B2-B03226A9A188}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F93B9BC-C9D5-4F1F-A2B2-B03226A9A188}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F93B9BC-C9D5-4F1F-A2B2-B03226A9A188}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F93B9BC-C9D5-4F1F-A2B2-B03226A9A188}.Release|Any CPU.Build.0 = Release|Any CPU
{C9269893-5493-4112-ADF4-F2E066FC6EA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9269893-5493-4112-ADF4-F2E066FC6EA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9269893-5493-4112-ADF4-F2E066FC6EA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9269893-5493-4112-ADF4-F2E066FC6EA6}.Release|Any CPU.Build.0 = Release|Any CPU
{DC6F127A-5E04-4661-9ABB-E701ADF3D6F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC6F127A-5E04-4661-9ABB-E701ADF3D6F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC6F127A-5E04-4661-9ABB-E701ADF3D6F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC6F127A-5E04-4661-9ABB-E701ADF3D6F8}.Release|Any CPU.Build.0 = Release|Any CPU
{504AD4AC-3CC6-45D4-BEA7-C290DD77EB04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{504AD4AC-3CC6-45D4-BEA7-C290DD77EB04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{504AD4AC-3CC6-45D4-BEA7-C290DD77EB04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{504AD4AC-3CC6-45D4-BEA7-C290DD77EB04}.Release|Any CPU.Build.0 = Release|Any CPU
{C836A12D-F30D-4662-843E-F1B466695463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C836A12D-F30D-4662-843E-F1B466695463}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C836A12D-F30D-4662-843E-F1B466695463}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C836A12D-F30D-4662-843E-F1B466695463}.Release|Any CPU.Build.0 = Release|Any CPU
{EAF79574-F939-48C5-B5AE-39783F59C4A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EAF79574-F939-48C5-B5AE-39783F59C4A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAF79574-F939-48C5-B5AE-39783F59C4A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAF79574-F939-48C5-B5AE-39783F59C4A1}.Release|Any CPU.Build.0 = Release|Any CPU
{41B602DF-C8A9-47B4-A45E-6EDE74F56376}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41B602DF-C8A9-47B4-A45E-6EDE74F56376}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41B602DF-C8A9-47B4-A45E-6EDE74F56376}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41B602DF-C8A9-47B4-A45E-6EDE74F56376}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6493E376-FAED-4287-8283-6704A779740E}
EndGlobalSection
EndGlobal

22
GPSDMqtt/GPSDMqtt.csproj Normal file
View File

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Librarys\GPSDLib\GPSDLib\GPSDLib.csproj" />
<ProjectReference Include="..\..\Librarys\litjson\litjson\litjson.csproj" />
<ProjectReference Include="..\..\Utils\Bot-Utils\Bot-Utils\Bot-Utils.csproj" />
<ProjectReference Include="..\..\Utils\ConnectorDataGpsd\ConnectorDataGpsd\ConnectorDataGpsd.csproj" />
<ProjectReference Include="..\..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="config-example\settings.conf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

42
GPSDMqtt/Program.cs Normal file
View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using BlubbFish.Utils;
using BlubbFish.Utils.IoT.Bots;
using BlubbFish.Utils.IoT.Connector;
using BlubbFish.Utils.IoT.Connector.Data;
using BlubbFish.Utils.IoT.Events;
namespace GPSDMqtt {
class Program : ABot {
private ABackend mqtt;
private ABackend gpsd;
public Program(String[] args) : base(args, true, "gpsdmqtt") {
this.mqtt = ABackend.GetInstance(InIReader.GetInstance("settings").GetSection("mqtt"));
this.mqtt.MessageSending += this.Mqtt_MessageSending;
this.gpsd = ABackend.GetInstance(InIReader.GetInstance("settings").GetSection("gpsd"));
this.gpsd.MessageIncomming += this.Gpsd_MessageIncomming;
}
//private static Mqtt mqtt;
//private static Gpsd gpsd;
static void Main(string[] args) {
Console.WriteLine("Hello World!");
//etgpsd.MessageIncomming += Gpsd_MessageIncomming;
while(true) {
System.Threading.Thread.Sleep(500);
}
}
private void Gpsd_MessageIncomming(Object sender, BackendEvent e) {
GpsEvent x = e as GpsEvent;
((ADataBackend)this.mqtt).Send("lora/data", LitJson.JsonMapper.ToJson(x));
Console.WriteLine("-> Position [" + x.Gps.Latitude + "," + x.Gps.Longitude + "]");
}
}
}

View File

@ -0,0 +1,6 @@
[mqtt]
server=[mqtt-server]
[gpsd]
server=[gpsd-server]
name=2354