-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch media config from ISAR with API call
- Loading branch information
Showing
9 changed files
with
144 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Api.Controllers.Models; | ||
using Api.Services; | ||
using Api.Services.Models; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Api.Controllers | ||
{ | ||
[ApiController] | ||
[Route("media-stream")] | ||
public class MediaStreamController( | ||
ILogger<MediaStreamController> logger, | ||
IIsarService isarService, | ||
IRobotService robotService | ||
) : ControllerBase | ||
{ | ||
/// <summary> | ||
/// Request the config for a new media stream connection from ISAR | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> This query gets a new media stream connection config from ISAR </para> | ||
/// </remarks> | ||
[HttpGet] | ||
[Authorize(Roles = Role.Any)] | ||
[Route("{id}")] | ||
[ProducesResponseType(typeof(MediaConfig), StatusCodes.Status200OK)] | ||
[ProducesResponseType(StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||
[ProducesResponseType(StatusCodes.Status403Forbidden)] | ||
[ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||
public async Task<ActionResult<MediaConfig>> GetMediaStreamConfig([FromRoute] string id) | ||
{ | ||
try | ||
{ | ||
var robot = await robotService.ReadById(id); | ||
if (robot == null) | ||
{ | ||
return NotFound($"Could not find robot with ID {id}"); | ||
} | ||
|
||
var config = await isarService.GetMediaStreamConfig(robot); | ||
return Ok(config); | ||
} | ||
catch (Exception e) | ||
{ | ||
logger.LogError(e, "Error during GET of media stream config from ISAR"); | ||
throw; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Api.Services.Models | ||
{ | ||
#nullable disable | ||
public class IsarMediaConfigMessage | ||
{ | ||
[JsonPropertyName("url")] | ||
public string Url { get; set; } | ||
|
||
[JsonPropertyName("token")] | ||
public string Token { get; set; } | ||
|
||
[JsonPropertyName("media_connection_type")] | ||
public string MediaConnectionType { get; set; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters