Skip to content

Commit

Permalink
Rovecomm merge to implement into Raman-graph
Browse files Browse the repository at this point in the history
  • Loading branch information
frawgii committed Oct 14, 2024
2 parents 3c1217b + 99d8f97 commit 8e9bde9
Show file tree
Hide file tree
Showing 45 changed files with 5,605 additions and 1,269 deletions.
25 changes: 22 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"--name",
"Basestation_Software",
// Configure container to use the same network stack as the host machine.
"--network",
"host",
// "--network",
// "host",
// Grants permission to the container to access USBs.
"--privileged"
],
Expand Down Expand Up @@ -41,7 +41,26 @@
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"forwardPorts": [
11000,
12000
],

"portsAttributes": {
"11000": {
"label": "RoveComm UDP",
"onAutoForward": "notify"
},
"12000": {
"label": "RoveComm TCP",
"onAutoForward": "notify"
}
},

"appPort": [
"11000:11000/udp",
"12000:12000/tcp"
],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "dotnet tool install --global dotnet-ef --verbosity diagnostic && dotnet tool install --global dotnet-aspnet-codegenerator --verbosity diagnostic",
Expand Down
59 changes: 24 additions & 35 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ root = true

# Indentation and spacing
indent_size = 4
indent_style = tab
indent_style = space
tab_width = 4

# New line preferences
Expand Down Expand Up @@ -56,13 +56,13 @@ dotnet_style_prefer_conditional_expression_over_assignment = true
dotnet_style_prefer_conditional_expression_over_return = true
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
dotnet_style_prefer_inferred_anonymous_type_member_names = true
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_inferred_tuple_names = true:silent
dotnet_style_prefer_is_null_check_over_reference_equality_method = false
dotnet_style_prefer_simplified_boolean_expressions = true
dotnet_style_prefer_simplified_interpolation = true

# Field preferences
dotnet_style_readonly_field = true
dotnet_style_readonly_field = false:silent

# Parameter preferences
dotnet_code_quality_unused_parameters = all
Expand All @@ -72,7 +72,7 @@ dotnet_remove_unnecessary_suppression_exclusions = none

# New line preferences
dotnet_style_allow_multiple_blank_lines_experimental = false
dotnet_style_allow_statement_immediately_after_block_experimental = false:suggestion
dotnet_style_allow_statement_immediately_after_block_experimental = true

#### C# Coding Conventions ####

Expand All @@ -82,39 +82,39 @@ csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = false

# Expression-bodied members
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = false
csharp_style_expression_bodied_methods = false
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = true

# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_prefer_extended_property_pattern = true
csharp_style_prefer_not_pattern = false:silent
csharp_style_prefer_pattern_matching = false
csharp_style_prefer_switch_expression = true
csharp_style_prefer_switch_expression = true:silent

# Null-checking preferences
csharp_style_conditional_delegate_call = true

# Modifier preferences
csharp_prefer_static_anonymous_function = true
csharp_prefer_static_local_function = true
csharp_prefer_static_anonymous_function = false:silent
csharp_prefer_static_local_function = true:silent
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
csharp_style_prefer_readonly_struct = true
csharp_style_prefer_readonly_struct = false:silent
csharp_style_prefer_readonly_struct_member = true

# Code-block preferences
csharp_prefer_braces = when_multiline:suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_simple_using_statement = false
csharp_style_namespace_declarations = file_scoped:suggestion
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_primary_constructors = false
csharp_style_prefer_top_level_statements = false:warning

# Expression-level preferences
Expand Down Expand Up @@ -201,14 +201,14 @@ dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.private_or_internal_field_should_be_camel_case__begins_with__.severity = suggestion
dotnet_naming_rule.private_or_internal_field_should_be_camel_case__begins_with__.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_camel_case__begins_with__.style = camel_case__begins_with__

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
Expand Down Expand Up @@ -243,14 +243,3 @@ dotnet_naming_style.camel_case__begins_with__.required_prefix = _
dotnet_naming_style.camel_case__begins_with__.required_suffix =
dotnet_naming_style.camel_case__begins_with__.word_separator =
dotnet_naming_style.camel_case__begins_with__.capitalization = camel_case

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = false:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,6 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc
/.vs/ProjectEvaluation/basestation_software.metadata.v7.bin
/.vs/ProjectEvaluation/basestation_software.projects.v7.bin
172 changes: 85 additions & 87 deletions Basestation_Software.Api/Controllers/GPSWaypointController.cs
Original file line number Diff line number Diff line change
@@ -1,111 +1,109 @@
using Basestation_Software.Api.Entities;
using Basestation_Software.Models.Geospatial;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Basestation_Software.Api.Controllers
namespace Basestation_Software.Api.Controllers;

[Route("api/[controller]")]
[ApiController]
public class GPSWaypointController : ControllerBase
{
[Route("api/[controller]")]
[ApiController]
public class GPSWaypointController : ControllerBase
// Declare member variables.
private readonly IGPSWaypointRepository _GPSWaypointRepository;

/// <summary>
/// Constructor
/// </summary>
/// <param name="GPSWaypointRepository">Implicitly passed in.</param>
public GPSWaypointController(IGPSWaypointRepository GPSWaypointRepository)
{
// Declare member variables.
private readonly IGPSWaypointRepository _GPSWaypointRepository;
_GPSWaypointRepository = GPSWaypointRepository;
}

/// <summary>
/// Constructor
/// </summary>
/// <param name="GPSWaypointRepository">Implicitly passed in.</param>
public GPSWaypointController(IGPSWaypointRepository GPSWaypointRepository)
/// <summary>
/// IN-Code API Endpoint for adding a waypoint to the DB.
/// </summary>
/// <param name="waypoint">The waypoint object.</param>
/// <returns>The API response object.</returns>
[HttpPut]
public async Task<IActionResult> AddGPSWaypoint(GPSWaypoint waypoint)
{
GPSWaypoint? dbWaypoint = await _GPSWaypointRepository.AddGPSWaypoint(waypoint);
if (dbWaypoint is not null)
{
_GPSWaypointRepository = GPSWaypointRepository;
return Ok();
}

/// <summary>
/// IN-Code API Endpoint for adding a waypoint to the DB.
/// </summary>
/// <param name="waypoint">The waypoint object.</param>
/// <returns>The API response object.</returns>
[HttpPut]
public async Task<IActionResult> AddGPSWaypoint(GPSWaypoint waypoint)
else
{
GPSWaypoint? dbWaypoint = await _GPSWaypointRepository.AddGPSWaypoint(waypoint);
if (dbWaypoint is not null)
{
return Ok();
}
else
{
return BadRequest();
}
return BadRequest();
}
}

/// <summary>
/// IN-Code API Endpoint for removing a waypoint from the DB.
/// </summary>
/// <param name="waypointID">The waypoint ID.</param>
/// <returns>The API response object.</returns>
[HttpDelete("{waypointID}")]
public async Task<IActionResult> DeleteGPSWaypoint(int waypointID)
/// <summary>
/// IN-Code API Endpoint for removing a waypoint from the DB.
/// </summary>
/// <param name="waypointID">The waypoint ID.</param>
/// <returns>The API response object.</returns>
[HttpDelete("{waypointID}")]
public async Task<IActionResult> DeleteGPSWaypoint(int waypointID)
{
GPSWaypoint? dbWaypoint = await _GPSWaypointRepository.DeleteGPSWaypoint(waypointID);
if (dbWaypoint is not null)
{
GPSWaypoint? dbWaypoint = await _GPSWaypointRepository.DeleteGPSWaypoint(waypointID);
if (dbWaypoint is not null)
{
return Ok();
}
else
{
return NotFound();
}
return Ok();
}

/// <summary>
/// IN-Code API Endpoint for getting a waypoint to the DB.
/// </summary>
/// <param name="waypointID">The waypoint id.</param>
/// <returns>The API response object.</returns>
[HttpGet("{waypointID}")]
public async Task<IActionResult> GetGPSWaypoint(int waypointID)
else
{
GPSWaypoint? dbWaypoint = await _GPSWaypointRepository.GetGPSWaypoint(waypointID);
if (dbWaypoint is not null)
{
return Ok(dbWaypoint);
}
else
{
return NotFound();
}
return NotFound();
}
}

/// <summary>
/// IN-Code API Endpoint for getting all waypoints from the DB.
/// </summary>
/// <returns>The API response object.</returns>
[HttpGet]
public async Task<IActionResult> GetAllGPSWaypoints()
/// <summary>
/// IN-Code API Endpoint for getting a waypoint to the DB.
/// </summary>
/// <param name="waypointID">The waypoint id.</param>
/// <returns>The API response object.</returns>
[HttpGet("{waypointID}")]
public async Task<IActionResult> GetGPSWaypoint(int waypointID)
{
GPSWaypoint? dbWaypoint = await _GPSWaypointRepository.GetGPSWaypoint(waypointID);
if (dbWaypoint is not null)
{
return Ok(await _GPSWaypointRepository.GetAllGPSWaypoints());
return Ok(dbWaypoint);
}

/// <summary>
/// IN-Code API Endpoint for updating a waypoint to the DB.
/// </summary>
/// <param name="waypoint">The waypoint object.</param>
/// <returns>The API response object.</returns>
[HttpPost]
public async Task<IActionResult> UpdateGPSWaypoint(GPSWaypoint waypoint)
else
{
GPSWaypoint? dbWaypoint = await _GPSWaypointRepository.UpdateGPSWaypoint(waypoint);
if (dbWaypoint is not null)
{
return Ok(dbWaypoint);
}
else
{
return NotFound();
}
return NotFound();
}
}

/// <summary>
/// IN-Code API Endpoint for getting all waypoints from the DB.
/// </summary>
/// <returns>The API response object.</returns>
[HttpGet]
public async Task<IActionResult> GetAllGPSWaypoints()
{
return Ok(await _GPSWaypointRepository.GetAllGPSWaypoints());
}

/// <summary>
/// IN-Code API Endpoint for updating a waypoint to the DB.
/// </summary>
/// <param name="waypoint">The waypoint object.</param>
/// <returns>The API response object.</returns>
[HttpPost]
public async Task<IActionResult> UpdateGPSWaypoint(GPSWaypoint waypoint)
{
GPSWaypoint? dbWaypoint = await _GPSWaypointRepository.UpdateGPSWaypoint(waypoint);
if (dbWaypoint is not null)
{
return Ok(dbWaypoint);
}
else
{
return NotFound();
}
}

}
Loading

0 comments on commit 8e9bde9

Please sign in to comment.