# Class LightBeaconController

Namespace
  adas_core.Controllers

Assembly
  adas-core.dll

    [Route("beacons")]
    public class LightBeaconController : ControllerBase

Inheritance
  object
  ControllerBase
  LightBeaconController

Inherited Members
  ControllerBase.StatusCode(int)
  ControllerBase.StatusCode(int, object)
  ControllerBase.Content(string)
  ControllerBase.Content(string, string)
  ControllerBase.Content(string, string, Encoding)
  ControllerBase.Content(string, MediaTypeHeaderValue)
  ControllerBase.NoContent()
  ControllerBase.Ok()
  ControllerBase.Ok(object)
  ControllerBase.Redirect(string)
  ControllerBase.RedirectPermanent(string)
  ControllerBase.RedirectPreserveMethod(string)
  ControllerBase.RedirectPermanentPreserveMethod(string)
  ControllerBase.LocalRedirect(string)
  ControllerBase.LocalRedirectPermanent(string)
  ControllerBase.LocalRedirectPreserveMethod(string)
  ControllerBase.LocalRedirectPermanentPreserveMethod(string)
  ControllerBase.RedirectToAction()
  ControllerBase.RedirectToAction(string)
  ControllerBase.RedirectToAction(string, object)
  ControllerBase.RedirectToAction(string, string)
  ControllerBase.RedirectToAction(string, string, object)
  ControllerBase.RedirectToAction(string, string, string)
  ControllerBase.RedirectToAction(string, string, object, string)
  ControllerBase.RedirectToActionPreserveMethod(string, string, object, string)
  ControllerBase.RedirectToActionPermanent(string)
  ControllerBase.RedirectToActionPermanent(string, object)
  ControllerBase.RedirectToActionPermanent(string, string)
  ControllerBase.RedirectToActionPermanent(string, string, string)
  ControllerBase.RedirectToActionPermanent(string, string, object)
  ControllerBase.RedirectToActionPermanent(string, string, object, string)
  ControllerBase.RedirectToActionPermanentPreserveMethod(string, string, object, string)
  ControllerBase.RedirectToRoute(string)
  ControllerBase.RedirectToRoute(object)
  ControllerBase.RedirectToRoute(string, object)
  ControllerBase.RedirectToRoute(string, string)
  ControllerBase.RedirectToRoute(string, object, string)
  ControllerBase.RedirectToRoutePreserveMethod(string, object, string)
  ControllerBase.RedirectToRoutePermanent(string)
  ControllerBase.RedirectToRoutePermanent(object)
  ControllerBase.RedirectToRoutePermanent(string, object)
  ControllerBase.RedirectToRoutePermanent(string, string)
  ControllerBase.RedirectToRoutePermanent(string, object, string)
  ControllerBase.RedirectToRoutePermanentPreserveMethod(string, object, string)
  ControllerBase.RedirectToPage(string)
  ControllerBase.RedirectToPage(string, object)
  ControllerBase.RedirectToPage(string, string)
  ControllerBase.RedirectToPage(string, string, object)
  ControllerBase.RedirectToPage(string, string, string)
  ControllerBase.RedirectToPage(string, string, object, string)
  ControllerBase.RedirectToPagePermanent(string)
  ControllerBase.RedirectToPagePermanent(string, object)
  ControllerBase.RedirectToPagePermanent(string, string)
  ControllerBase.RedirectToPagePermanent(string, string, string)
  ControllerBase.RedirectToPagePermanent(string, string, object, string)
  ControllerBase.RedirectToPagePreserveMethod(string, string, object, string)
  ControllerBase.RedirectToPagePermanentPreserveMethod(string, string, object, string)
  ControllerBase.File(byte[], string)
  ControllerBase.File(byte[], string, bool)
  ControllerBase.File(byte[], string, string)
  ControllerBase.File(byte[], string, string, bool)
  ControllerBase.File(byte[], string, DateTimeOffset?, EntityTagHeaderValue)
  ControllerBase.File(byte[], string, DateTimeOffset?, EntityTagHeaderValue, bool)
  ControllerBase.File(byte[], string, string, DateTimeOffset?, EntityTagHeaderValue)
  ControllerBase.File(byte[], string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
  ControllerBase.File(Stream, string)
  ControllerBase.File(Stream, string, bool)
  ControllerBase.File(Stream, string, string)
  ControllerBase.File(Stream, string, string, bool)
  ControllerBase.File(Stream, string, DateTimeOffset?, EntityTagHeaderValue)
  ControllerBase.File(Stream, string, DateTimeOffset?, EntityTagHeaderValue, bool)
  ControllerBase.File(Stream, string, string, DateTimeOffset?, EntityTagHeaderValue)
  ControllerBase.File(Stream, string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
  ControllerBase.File(string, string)
  ControllerBase.File(string, string, bool)
  ControllerBase.File(string, string, string)
  ControllerBase.File(string, string, string, bool)
  ControllerBase.File(string, string, DateTimeOffset?, EntityTagHeaderValue)
  ControllerBase.File(string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
  ControllerBase.File(string, string, string, DateTimeOffset?, EntityTagHeaderValue)
  ControllerBase.File(string, string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
  ControllerBase.PhysicalFile(string, string)
  ControllerBase.PhysicalFile(string, string, bool)
  ControllerBase.PhysicalFile(string, string, string)
  ControllerBase.PhysicalFile(string, string, string, bool)
  ControllerBase.PhysicalFile(string, string, DateTimeOffset?, EntityTagHeaderValue)
  ControllerBase.PhysicalFile(string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
  ControllerBase.PhysicalFile(string, string, string, DateTimeOffset?, EntityTagHeaderValue)
  ControllerBase.PhysicalFile(string, string, string, DateTimeOffset?, EntityTagHeaderValue, bool)
  ControllerBase.Unauthorized()
  ControllerBase.Unauthorized(object)
  ControllerBase.NotFound()
  ControllerBase.NotFound(object)
  ControllerBase.BadRequest()
  ControllerBase.BadRequest(object)
  ControllerBase.BadRequest(ModelStateDictionary)
  ControllerBase.UnprocessableEntity()
  ControllerBase.UnprocessableEntity(object)
  ControllerBase.UnprocessableEntity(ModelStateDictionary)
  ControllerBase.Conflict()
  ControllerBase.Conflict(object)
  ControllerBase.Conflict(ModelStateDictionary)
  ControllerBase.Problem(string, string, int?, string, string)
  ControllerBase.ValidationProblem(ValidationProblemDetails)
  ControllerBase.ValidationProblem(ModelStateDictionary)
  ControllerBase.ValidationProblem()
  ControllerBase.ValidationProblem(string, string, int?, string, string, ModelStateDictionary)
  ControllerBase.Created()
  ControllerBase.Created(string, object)
  ControllerBase.Created(Uri, object)
  ControllerBase.CreatedAtAction(string, object)
  ControllerBase.CreatedAtAction(string, object, object)
  ControllerBase.CreatedAtAction(string, string, object, object)
  ControllerBase.CreatedAtRoute(string, object)
  ControllerBase.CreatedAtRoute(object, object)
  ControllerBase.CreatedAtRoute(string, object, object)
  ControllerBase.Accepted()
  ControllerBase.Accepted(object)
  ControllerBase.Accepted(Uri)
  ControllerBase.Accepted(string)
  ControllerBase.Accepted(string, object)
  ControllerBase.Accepted(Uri, object)
  ControllerBase.AcceptedAtAction(string)
  ControllerBase.AcceptedAtAction(string, string)
  ControllerBase.AcceptedAtAction(string, object)
  ControllerBase.AcceptedAtAction(string, string, object)
  ControllerBase.AcceptedAtAction(string, object, object)
  ControllerBase.AcceptedAtAction(string, string, object, object)
  ControllerBase.AcceptedAtRoute(object)
  ControllerBase.AcceptedAtRoute(string)
  ControllerBase.AcceptedAtRoute(string, object)
  ControllerBase.AcceptedAtRoute(object, object)
  ControllerBase.AcceptedAtRoute(string, object, object)
  ControllerBase.Challenge()
  ControllerBase.Challenge(params string[])
  ControllerBase.Challenge(AuthenticationProperties)
  ControllerBase.Challenge(AuthenticationProperties, params string[])
  ControllerBase.Forbid()
  ControllerBase.Forbid(params string[])
  ControllerBase.Forbid(AuthenticationProperties)
  ControllerBase.Forbid(AuthenticationProperties, params string[])
  ControllerBase.SignIn(ClaimsPrincipal)
  ControllerBase.SignIn(ClaimsPrincipal, string)
  ControllerBase.SignIn(ClaimsPrincipal, AuthenticationProperties)
  ControllerBase.SignIn(ClaimsPrincipal, AuthenticationProperties, string)
  ControllerBase.SignOut()
  ControllerBase.SignOut(AuthenticationProperties)
  ControllerBase.SignOut(params string[])
  ControllerBase.SignOut(AuthenticationProperties, params string[])
  ControllerBase.TryUpdateModelAsync<TModel>(TModel)
  ControllerBase.TryUpdateModelAsync<TModel>(TModel, string)
  ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, IValueProvider)
  ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, params Expression<Func<TModel, object>>[])
  ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, Func<ModelMetadata, bool>)
  ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, IValueProvider, params Expression<Func<TModel, object>>[])
  ControllerBase.TryUpdateModelAsync<TModel>(TModel, string, IValueProvider, Func<ModelMetadata, bool>)
  ControllerBase.TryUpdateModelAsync(object, Type, string)
  ControllerBase.TryUpdateModelAsync(object, Type, string, IValueProvider, Func<ModelMetadata, bool>)
  ControllerBase.TryValidateModel(object)
  ControllerBase.TryValidateModel(object, string)
  ControllerBase.HttpContext
  ControllerBase.Request
  ControllerBase.Response
  ControllerBase.RouteData
  ControllerBase.ModelState
  ControllerBase.ControllerContext
  ControllerBase.MetadataProvider
  ControllerBase.ModelBinderFactory
  ControllerBase.Url
  ControllerBase.ObjectValidator
  ControllerBase.ProblemDetailsFactory
  ControllerBase.User
  ControllerBase.Empty
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Constructors

### LightBeaconController(ILightBeaconService, IPatientService)

    public LightBeaconController(ILightBeaconService lightBeaconService, IPatientService patientService)

#### Parameters

`lightBeaconService` ILightBeaconService
`patientService` IPatientService

## Methods

### Create(LightBeacon)

Creates a new light beacon by inserting the provided beacon data into the system. Returns a conflict response if the insertion yields no result; otherwise, returns the inserted beacon.

    [HttpPost("create")]
    [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
    public Task<IActionResult> Create(LightBeacon beacon)

#### Parameters

`beacon` LightBeacon

  The light beacon data to be created, provided in the request body.

#### Returns

Task<IActionResult>

  An IActionResult containing the inserted beacon on success, or a conflict response if the insertion fails.

### CreateCamera(LightBeacon)

Creates a new camera record by inserting a light beacon into the system. Requires the caller to have the role associated with AuthSome.

    [HttpPost]
    [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
    public Task<IActionResult> CreateCamera(LightBeacon beac)

#### Parameters

`beac` LightBeacon

  The light beacon data to create the camera from, supplied in the request body.

#### Returns

Task<IActionResult>

  An IActionResult containing the created light beacon.

### GetPaginatedUnits(PaginationFilter)

Retrieves a paginated list of light beacons based on the provided pagination filter. Validates that the request payload is not null before delegating to the light beacon service.

    [HttpPost("paginated")]
    [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
    public Task<IActionResult> GetPaginatedUnits(PaginationFilter request)

#### Parameters

`request` PaginationFilter

  The pagination filter containing the paging parameters used to query the beacons.

#### Returns

Task<IActionResult>

  An IActionResult containing the paginated list of beacons returned by the service.

#### Exceptions

BadRequestException

  Thrown when the `request` parameter is null, indicating missing parameters.

### GetSearchByName(string)

Searches for a light beacon by the provided text and returns the matching result.

    [HttpGet("{textToSearch}")]
    [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
    public Task<IActionResult> GetSearchByName(string textToSearch)

#### Parameters

`textToSearch` string

  The text used to search for the light beacon by name.

#### Returns

Task<IActionResult>

  An IActionResult containing the matching beacon, or a not-found response if no match exists.

### Off(string)

Powers off the LED of the light beacon associated with the specified POC identifier.

    [HttpPost("off")]
    [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
    public IActionResult Off(string pocId)

#### Parameters

`pocId` string

  The string representation of the POC ObjectId whose light beacon LED should be powered off.

#### Returns

IActionResult

#### Exceptions

BadRequestException

  Thrown when `pocId` is not a valid ObjectId format.

### On(string, string)

Sets the light beacon color for the point of care associated with the specified patient. Maps the `color` route value (case-insensitive) to a LightBeaconColor and forwards it to the beacon service.

    [HttpPost("on/{color}")]
    public Task<IActionResult> On(string patientId, string color)

#### Parameters

`patientId` string

  The patient's identifier, supplied in the request body, used to locate the patient's point of care.

`color` string

  The color name from the route (e.g. "Yellow", "Blue", "Red", "Off", "Green", "Cyan", "Magenta", "White") to apply to the beacon.

#### Returns

Task<IActionResult>

  An IActionResult indicating successful completion.

#### Exceptions

BadRequestException

  Thrown when `patientId` is not a valid MongoDB.Bson.ObjectId format.

NotFoundException

  Thrown when the patient cannot be found or has no associated point of care.

### UpdateCamera(string, LightBeacon)

Updates an existing light beacon (camera) identified by the route parameter, applying the provided data from the request body.

    [HttpPut("{id}")]
    [AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
    public Task<IActionResult> UpdateCamera(string id, LightBeacon beacon)

#### Parameters

`id` string

  The string identifier of the light beacon to update, expected to be a valid ObjectId.

`beacon` LightBeacon

  The light beacon payload containing the updated information, sourced from the request body.

#### Returns

Task<IActionResult>

  An IActionResult containing the updated light beacon returned by the service.

#### Exceptions

BadRequestException

  Thrown when the provided `id` cannot be parsed as a valid ObjectId.