sirt broadcaster completed

This commit is contained in:
Stoyan Zlatev
2024-10-23 14:53:32 +02:00
parent 43ccb4e7b4
commit 125951e7de
35 changed files with 1145 additions and 1015 deletions
+3 -39
View File
@@ -40,8 +40,6 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http">
@@ -50,54 +48,20 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Parameters.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Hardware\Interfaces\Ports\Common.Hardware.Interfaces.Ports.SIRT\Common.Hardware.Interfaces.Ports.Sirt.csproj">
<ProjectReference Include="..\Hardware\Interfaces\Ports\Common.Hardware.Interfaces.Ports.SIRT\Common.Hardware.Interfaces.Ports.SIRT.csproj">
<Project>{B23BFAF9-08AE-4311-8C08-FB2BB49EA2AD}</Project>
<Name>Common.Hardware.Interfaces.Ports.Sirt</Name>
</ProjectReference>
<ProjectReference Include="..\Hardware\Interfaces\Ports\Common.Hardware.Interfaces.Ports\Common.Hardware.Interfaces.Ports.csproj">
<Project>{9ae071c0-db12-4e09-a3c7-43f6dcd518d6}</Project>
<Name>Common.Hardware.Interfaces.Ports</Name>
</ProjectReference>
<ProjectReference Include="..\Hardware\WaterMeter\eRegister\Common.Hardware.WaterMeter.eRegister.Features\Common.Hardware.WaterMeter.eRegister.Features.csproj">
<Project>{E19C1694-132E-477C-86CB-8E146D5F59B0}</Project>
<Name>Common.Hardware.WaterMeter.eRegister.Features</Name>
</ProjectReference>
<ProjectReference Include="..\Hardware\WaterMeter\eRegister\Common.Hardware.WaterMeter.eRegister\Common.Hardware.WaterMeter.eRegister.csproj">
<Project>{4E8BB839-D40A-488C-88CE-F21811F1F476}</Project>
<Name>Common.Hardware.WaterMeter.eRegister</Name>
</ProjectReference>
<ProjectReference Include="..\Hardware\WaterMeter\OmniPlus\Common.Hardware.WaterMeter.OmniPlus.Features\Common.Hardware.WaterMeter.OmniPlus.Features.csproj">
<Project>{9D89FA2A-1217-4CE9-B217-E7602B974EA9}</Project>
<Name>Common.Hardware.WaterMeter.OmniPlus.Features</Name>
</ProjectReference>
<ProjectReference Include="..\Hardware\WaterMeter\OmniPlus\Common.Hardware.WaterMeter.OmniPlus\Common.Hardware.WaterMeter.OmniPlus.csproj">
<Project>{6480cc2a-ab54-4a26-8413-d5141431c080}</Project>
<Name>Common.Hardware.WaterMeter.OmniPlus</Name>
</ProjectReference>
<ProjectReference Include="..\Logic\Common.Logic.Extensions.Http\Common.Logic.Extensions.Http.csproj">
<Project>{57ddae1e-fd6b-47e0-ad5e-8ccfad07f1d7}</Project>
<Name>Common.Logic.Extensions.Http</Name>
<Name>Common.Hardware.Interfaces.Ports.SIRT</Name>
</ProjectReference>
<ProjectReference Include="..\Logic\Common.Logic.Extensions.SQL\Common.Logic.Extensions.SQL.csproj">
<Project>{62490923-cd17-45a6-b79f-a027927c75b5}</Project>
<Project>{62490923-CD17-45A6-B79F-A027927C75B5}</Project>
<Name>Common.Logic.Extensions.SQL</Name>
</ProjectReference>
<ProjectReference Include="..\OmniPlus\OmniPlus\OmniPlus.csproj">
<Project>{F8D84B9A-0FCF-4083-B067-8C39B7314152}</Project>
<Name>OmniPlus</Name>
</ProjectReference>
<ProjectReference Include="..\Utils\Common.Utils.Extensions\Common.Utils.Extensions.csproj">
<Project>{05f0ccaf-9f2b-45f9-a7f8-12f29ad182f3}</Project>
<Name>Common.Utils.Extensions</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+8 -47
View File
@@ -1,60 +1,21 @@
namespace CommonConsole
{
using Common.Hardware.Interfaces.Ports.Sirt;
using System;
using System.Threading.Tasks;
public class Program
{
public static void Main()
{
var bytes = new Byte[] { 0x15, 0x33, 0x40, 0x01, 0x00, 0x00, 0x06, 0x12 };
var sirtId = BitConverter.ToUInt64(bytes, 0);
var rf = (sirtId >> 24 & 1) == 1 ? 433 : 868;
var broadcaster = new SirtBroadcaster("COM6");
broadcaster.Exception += Console.WriteLine;
broadcaster.Start();
Console.WriteLine(BitConverter.ToString(bytes));
Console.WriteLine(sirtId);
Console.WriteLine(rf);
Console.WriteLine();
Task.Delay(10000).Wait();
var bits = String.Empty;
for (var i = 0; i < 64; i++)
{
bits += $"{sirtId >> i & 1}";
if (i > 0 && (i + 1) % 4 == 0)
{
bits += " ";
}
}
Console.WriteLine(bits);
//var meterUnits = 5;
//var decimalPoint = 3;
//bits[0] = (Byte)(meterUnits >> 0 & 1);
//bits[1] = (Byte)(meterUnits >> 1 & 1);
//bits[2] = (Byte)(meterUnits >> 2 & 1);
//bits[3] = (Byte)(meterUnits >> 3 & 1);
//bits[4] = (Byte)(meterUnits >> 4 & 1);
//bits[5] = (Byte)(decimalPoint >> 0 & 1);
//bits[6] = (Byte)(decimalPoint >> 1 & 1);
//Console.WriteLine(BitConverter.ToString(bits));
//meterUnits = 0;
//meterUnits ^= bits[0];
//meterUnits ^= bits[1] << 1;
//meterUnits ^= bits[2] << 2;
//meterUnits ^= bits[3] << 3;
//meterUnits ^= bits[4] << 4;
//decimalPoint = 0;
//decimalPoint ^= bits[5];
//decimalPoint ^= bits[6] << 1;
//Console.WriteLine(meterUnits);
//Console.WriteLine(decimalPoint);
broadcaster.Stop();
}
}
}