Class ProxyDeviceController
- Namespace
- adas_core.Controllers
- Assembly
- adas-core.dll
[Route("proxy-devices")]
[ApiController]
public class ProxyDeviceController : ControllerBase
- Inheritance
-
ProxyDeviceController
- Inherited Members
- Extension Methods
Constructors
ProxyDeviceController(IProxyDeviceService)
public ProxyDeviceController(IProxyDeviceService proxyDeviceService)
Parameters
proxyDeviceServiceIProxyDeviceService
Methods
GetAsMpegStreamById(string)
Streams MJPEG video from the specified device by proxying the request through an external service and writing the response body to the client.
Forwards the upstream status code when the proxy call is not successful, defaults the response content type to multipart/x-mixed-replace when none is provided, and returns 404 (or the original status code) if the upstream request fails.
[HttpGet("{deviceId}/mjpeg-stream")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task GetAsMpegStreamById(string deviceId)
Parameters
deviceIdstringThe identifier of the device whose MJPEG stream should be retrieved and forwarded to the caller.
Returns
GetContentById(string)
Retrieves the content associated with the specified device by proxying the request through the device service. Forwards the upstream content length and content type headers to the response when available, and returns the resulting content as a stream.
[HttpGet("{deviceId}/content")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task<IActionResult> GetContentById(string deviceId)
Parameters
deviceIdstringThe unique identifier of the device whose content is being requested.
Returns
- Task<IActionResult>
An IActionResult containing the proxied content stream for the specified device.
GetStreamById(string)
Retrieves a media stream for the specified device by delegating the request to the proxy device service. When the proxy call is not successful, the upstream status code is returned as-is; otherwise the response stream is forwarded with the original content type, falling back to "multipart/x-mixed-replace" when no content type is provided, and the response content length is set when known.
[HttpGet("{deviceId}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
public Task<IActionResult> GetStreamById(string deviceId)
Parameters
deviceIdstringThe unique identifier of the device whose stream should be retrieved.
Returns
- Task<IActionResult>
A FileStreamResult containing the proxied device stream, or a StatusCodeResult reflecting the upstream HTTP status when the proxy call fails.