Skip to content

Commit

Permalink
Format to new csharper version
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddasol committed Jan 16, 2025
1 parent 34ad695 commit 363f5d9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 35 deletions.
21 changes: 10 additions & 11 deletions backend/api.test/Mocks/MissionLoaderMock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,16 @@ public class MockMissionLoader() : IMissionLoader
),
];

private readonly MissionDefinition _mockMissionDefinition =
new()
{
InspectionArea = new InspectionArea(),
Comment = "",
Id = "",
InstallationCode = "TTT",
IsDeprecated = false,
Name = "test",
Source = new Source { Id = "", SourceId = "" },
};
private readonly MissionDefinition _mockMissionDefinition = new()
{
InspectionArea = new InspectionArea(),
Comment = "",
Id = "",
InstallationCode = "TTT",
IsDeprecated = false,
Name = "test",
Source = new Source { Id = "", SourceId = "" },
};

public async Task<MissionDefinition?> GetMissionById(string sourceMissionId)
{
Expand Down
17 changes: 8 additions & 9 deletions backend/api/Database/Context/InitDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -576,15 +576,14 @@ public static void AddRobotModelsToContext(FlotillaDbContext context)
{
foreach (var type in Enum.GetValues<RobotType>())
{
RobotModel model =
new()
{
Type = type,
BatteryWarningThreshold = null,
BatteryMissionStartThreshold = null,
LowerPressureWarningThreshold = null,
UpperPressureWarningThreshold = null,
};
RobotModel model = new()
{
Type = type,
BatteryWarningThreshold = null,
BatteryMissionStartThreshold = null,
LowerPressureWarningThreshold = null,
UpperPressureWarningThreshold = null,
};
context.Add(model);
}
}
Expand Down
6 changes: 4 additions & 2 deletions backend/api/MQTT/MqttService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ public class MqttService : BackgroundService
private readonly int _serverPort;
private readonly bool _shouldFailOnMaxRetries;

private static readonly JsonSerializerOptions serializerOptions =
new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
private static readonly JsonSerializerOptions serializerOptions = new()
{
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) },
};

private CancellationToken _cancellationToken;
private int _reconnectAttempts;
Expand Down
25 changes: 12 additions & 13 deletions backend/api/MQTT/MqttTopics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ public static class MqttTopics
/// <summary>
/// A dictionary linking MQTT topics to their respective message models
/// </summary>
public static readonly Dictionary<string, Type> TopicsToMessages =
new()
{
{ "isar/+/status", typeof(IsarStatusMessage) },
{ "isar/+/robot_info", typeof(IsarRobotInfoMessage) },
{ "isar/+/robot_heartbeat", typeof(IsarRobotHeartbeatMessage) },
{ "isar/+/mission", typeof(IsarMissionMessage) },
{ "isar/+/task", typeof(IsarTaskMessage) },
{ "isar/+/battery", typeof(IsarBatteryMessage) },
{ "isar/+/pressure", typeof(IsarPressureMessage) },
{ "isar/+/pose", typeof(IsarPoseMessage) },
{ "isar/+/cloud_health", typeof(IsarCloudHealthMessage) },
};
public static readonly Dictionary<string, Type> TopicsToMessages = new()
{
{ "isar/+/status", typeof(IsarStatusMessage) },
{ "isar/+/robot_info", typeof(IsarRobotInfoMessage) },
{ "isar/+/robot_heartbeat", typeof(IsarRobotHeartbeatMessage) },
{ "isar/+/mission", typeof(IsarMissionMessage) },
{ "isar/+/task", typeof(IsarTaskMessage) },
{ "isar/+/battery", typeof(IsarBatteryMessage) },
{ "isar/+/pressure", typeof(IsarPressureMessage) },
{ "isar/+/pose", typeof(IsarPoseMessage) },
{ "isar/+/cloud_health", typeof(IsarCloudHealthMessage) },
};

/// <summary>
/// Searches a dictionary for a specific topic name and returns the corresponding value from the wildcarded dictionary
Expand Down

0 comments on commit 363f5d9

Please sign in to comment.