Skip to content

Commit

Permalink
Switch to using DCS-gRPC bindings package
Browse files Browse the repository at this point in the history
Switch to using the common DCS-gRPC C# bindings package
  • Loading branch information
rurounijones committed Jan 29, 2022
1 parent 9b17eec commit 53cda8d
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 43 deletions.
6 changes: 5 additions & 1 deletion Jupiter.Core/Jupiter.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Jupiter.Dcs\Jupiter.Dcs.csproj" />
<PackageReference Include="Geo" Version="1.0.0" />
<PackageReference Include="RurouniJones.Dcs.Grpc" Version="0.3.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Jupiter.Encyclopedia\Jupiter.Encyclopedia.csproj" />
</ItemGroup>

Expand Down
44 changes: 23 additions & 21 deletions Jupiter.Core/ViewModels/Commands/AddGroupCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Diagnostics;
using System.Windows.Input;
using Grpc.Net.Client;
using RurouniJones.Dcs.Grpc.V0.Coalition;
using RurouniJones.Dcs.Grpc.V0.Common;
using RurouniJones.Jupiter.Core.Models;

namespace RurouniJones.Jupiter.Core.ViewModels.Commands
Expand All @@ -23,84 +25,84 @@ public void Execute(object? parameter)
var rnd = new Random();
var randomNumber = rnd.Next();

var template = new Dcs.Coalition.AddGroupRequest.Types.GroundGroupTemplate()
var template = new AddGroupRequest.Types.GroundGroupTemplate()
{
Name = $"SAM Site {randomNumber}",
Position = new Dcs.Common.Position()
Position = new Position()
{
Lat = location.Latitude,
Lon = location.Longitude
},
Task = "Ground Nothing"
};

template.Units.Add(new Dcs.Coalition.AddGroupRequest.Types.GroundUnitTemplate() {
template.Units.Add(new AddGroupRequest.Types.GroundUnitTemplate() {
Name = $"SAM Site {randomNumber} Command Post",
Type = "NASAMS_Command_Post",
Position = new Dcs.Common.Position()
Position = new Position()
{
Lat = location.Latitude,
Lon = location.Longitude
},
Skill = Dcs.Coalition.AddGroupRequest.Types.Skill.Excellent
Skill = AddGroupRequest.Types.Skill.Excellent
});

template.Units.Add(new Dcs.Coalition.AddGroupRequest.Types.GroundUnitTemplate()
template.Units.Add(new AddGroupRequest.Types.GroundUnitTemplate()
{
Name = $"SAM Site {randomNumber} Command Post",
Type = "NASAMS_Radar_MPQ64F1",
Position = new Dcs.Common.Position()
Position = new Position()
{
Lat = location.Latitude - 0.001,
Lon = location.Longitude
},
Skill = Dcs.Coalition.AddGroupRequest.Types.Skill.Excellent
Skill = AddGroupRequest.Types.Skill.Excellent
});

template.Units.Add(new Dcs.Coalition.AddGroupRequest.Types.GroundUnitTemplate()
template.Units.Add(new AddGroupRequest.Types.GroundUnitTemplate()
{
Name = $"SAM Site {randomNumber} Launcher 1",
Type = "NASAMS_LN_C",
Position = new Dcs.Common.Position()
Position = new Position()
{
Lat = location.Latitude + 0.001,
Lon = location.Longitude
},
Skill = Dcs.Coalition.AddGroupRequest.Types.Skill.Excellent
Skill = AddGroupRequest.Types.Skill.Excellent
});

template.Units.Add(new Dcs.Coalition.AddGroupRequest.Types.GroundUnitTemplate()
template.Units.Add(new AddGroupRequest.Types.GroundUnitTemplate()
{
Name = $"SAM Site {randomNumber} Launcher 2",
Type = "NASAMS_LN_C",
Position = new Dcs.Common.Position()
Position = new Position()
{
Lat = location.Latitude + 0.001,
Lon = location.Longitude - 0.001
},
Skill = Dcs.Coalition.AddGroupRequest.Types.Skill.Excellent
Skill = AddGroupRequest.Types.Skill.Excellent
});

template.Units.Add(new Dcs.Coalition.AddGroupRequest.Types.GroundUnitTemplate()
template.Units.Add(new AddGroupRequest.Types.GroundUnitTemplate()
{
Name = $"SAM Site {randomNumber} Launcher 3",
Type = "NASAMS_LN_C",
Position = new Dcs.Common.Position()
Position = new Position()
{
Lat = location.Latitude + 0.001,
Lon = location.Longitude + 0.001
},
Skill = Dcs.Coalition.AddGroupRequest.Types.Skill.Excellent
Skill = AddGroupRequest.Types.Skill.Excellent
});

try
{
using var channel = GrpcChannel.ForAddress($"http://{Global.HostName}:{Global.Port}");
var client = new Dcs.Coalition.CoalitionService.CoalitionServiceClient(channel);
var result = client.AddGroup(new Dcs.Coalition.AddGroupRequest()
var client = new CoalitionService.CoalitionServiceClient(channel);
var result = client.AddGroup(new AddGroupRequest()
{
Country = Dcs.Common.Country.UnitedStatesOfAmerica,
GroupCategory = Dcs.Common.GroupCategory.Ground,
Country = Country.UnitedStatesOfAmerica,
GroupCategory = GroupCategory.Ground,
GroundTemplate = template
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Windows.Input;
using Grpc.Net.Client;
using RurouniJones.Dcs.Grpc.V0.Unit;

namespace RurouniJones.Jupiter.Core.ViewModels.Commands
{
Expand All @@ -21,8 +22,8 @@ public void Execute(object? parameter)
try
{
using var channel = GrpcChannel.ForAddress($"http://{Global.HostName}:{Global.Port}");
var client = new Dcs.Unit.UnitService.UnitServiceClient(channel);
client.SetEmissionAsync(new Dcs.Unit.SetEmissionRequest()
var client = new UnitService.UnitServiceClient(channel);
client.SetEmissionAsync(new SetEmissionRequest()
{
Name = unitName,
Emitting = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Diagnostics;
using System.Windows.Input;
using Grpc.Net.Client;
using RurouniJones.Jupiter.Dcs;
using RurouniJones.Dcs.Grpc.V0.Unit;

namespace RurouniJones.Jupiter.Core.ViewModels.Commands
{
Expand All @@ -22,8 +22,8 @@ public void Execute(object? parameter)
try
{
using var channel = GrpcChannel.ForAddress($"http://{Global.HostName}:{Global.Port}");
var client = new Dcs.Unit.UnitService.UnitServiceClient(channel);
client.SetEmissionAsync(new Dcs.Unit.SetEmissionRequest()
var client = new UnitService.UnitServiceClient(channel);
client.SetEmissionAsync(new SetEmissionRequest()
{
Name = unitName,
Emitting = true
Expand Down
4 changes: 2 additions & 2 deletions Jupiter.Core/ViewModels/Commands/IlluminationBombCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Diagnostics;
using System.Windows.Input;
using Grpc.Net.Client;
using RurouniJones.Dcs.Grpc.V0.Common;
using RurouniJones.Dcs.Grpc.V0.Trigger;
using RurouniJones.Jupiter.Core.Models;
using RurouniJones.Jupiter.Dcs.Common;
using RurouniJones.Jupiter.Dcs.Trigger;

namespace RurouniJones.Jupiter.Core.ViewModels.Commands
{
Expand Down
4 changes: 2 additions & 2 deletions Jupiter.Core/ViewModels/Commands/LaunchFlareCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System.Windows.Input;
using Grpc.Net.Client;
using RurouniJones.Jupiter.Core.Models;
using RurouniJones.Jupiter.Dcs.Common;
using RurouniJones.Jupiter.Dcs.Trigger;
using RurouniJones.Dcs.Grpc.V0.Common;
using RurouniJones.Dcs.Grpc.V0.Trigger;

namespace RurouniJones.Jupiter.Core.ViewModels.Commands
{
Expand Down
4 changes: 2 additions & 2 deletions Jupiter.Core/ViewModels/Commands/PopSmokeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
using System.Windows.Input;
using Grpc.Net.Client;
using RurouniJones.Jupiter.Core.Models;
using RurouniJones.Jupiter.Dcs.Common;
using RurouniJones.Jupiter.Dcs.Trigger;
using RurouniJones.Dcs.Grpc.V0.Common;
using RurouniJones.Dcs.Grpc.V0.Trigger;

namespace RurouniJones.Jupiter.Core.ViewModels.Commands
{
Expand Down
3 changes: 1 addition & 2 deletions Jupiter.Core/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
using System.Threading.Tasks;
using Grpc.Core;
using Grpc.Net.Client;
using RurouniJones.Dcs.Grpc.V0.Mission;
using RurouniJones.Jupiter.Core.Models;
using RurouniJones.Jupiter.Core.ViewModels.Commands;
using RurouniJones.Jupiter.Dcs;
using RurouniJones.Jupiter.Dcs.Mission;
using Coalition = RurouniJones.Jupiter.Core.Models.Coalition;
using Group = RurouniJones.Jupiter.Core.Models.Group;
using Unit = RurouniJones.Jupiter.Core.Models.Unit;
Expand Down
10 changes: 2 additions & 8 deletions Jupiter.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jupiter.UI", "Jupiter.UI\Jupiter.UI.csproj", "{AC078637-EAA8-4200-BDB8-C6B56252DF8D}"
EndProject
Expand All @@ -12,8 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jupiter.Dcs", "Jupiter.Dcs\Jupiter.Dcs.csproj", "{1A561D48-1E2F-4470-80E5-45BE93381F05}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jupiter.Core", "Jupiter.Core\Jupiter.Core.csproj", "{5CF77010-0755-4D3D-839F-2F1F3C776FEF}"
ProjectSection(ProjectDependencies) = postProject
{3D700DBE-595B-467A-8F0D-83A9B285C81E} = {3D700DBE-595B-467A-8F0D-83A9B285C81E}
Expand All @@ -31,10 +29,6 @@ Global
{AC078637-EAA8-4200-BDB8-C6B56252DF8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC078637-EAA8-4200-BDB8-C6B56252DF8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC078637-EAA8-4200-BDB8-C6B56252DF8D}.Release|Any CPU.Build.0 = Release|Any CPU
{1A561D48-1E2F-4470-80E5-45BE93381F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A561D48-1E2F-4470-80E5-45BE93381F05}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A561D48-1E2F-4470-80E5-45BE93381F05}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A561D48-1E2F-4470-80E5-45BE93381F05}.Release|Any CPU.Build.0 = Release|Any CPU
{5CF77010-0755-4D3D-839F-2F1F3C776FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5CF77010-0755-4D3D-839F-2F1F3C776FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CF77010-0755-4D3D-839F-2F1F3C776FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down

0 comments on commit 53cda8d

Please sign in to comment.