Skip to content

Commit 3b6970b

Browse files
committed
Restored APIs and removed unused intensity from Beat api
1 parent 563b0af commit 3b6970b

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

HueEntertainmentPro/Client/Pages/ProAreaPlay.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
<FluentButton Appearance="Appearance.Accent" OnClick="(() => LightDJService.StartAutoMode())" Style="margin-bottom: 8px;">Start Auto Mode</FluentButton>
9292
}
9393
<FluentButton Appearance="Appearance.Accent" OnClick="(() => LightDJService.StopEffects())" Style="margin-bottom: 8px;">Stop All Effects</FluentButton>
94-
<FluentButton Appearance="Appearance.Accent" OnClick="(() => LightDJService.Beat(new DoubleRequest(1)))" Style="margin-bottom: 8px;">Beat</FluentButton>
94+
<FluentButton Appearance="Appearance.Accent" OnClick="(() => LightDJService.Beat())" Style="margin-bottom: 8px;">Beat</FluentButton>
9595
</FluentStack>
9696
</FluentCard>
9797
</FluentGridItem>

HueEntertainmentPro/Server/Controllers/ApiController.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using HueLightDJ.Services; // ✅ KORREKT - Nicht . Internal
1+
using HueLightDJ.Services;
22
using Microsoft.AspNetCore.Mvc;
33

44
namespace HueEntertainmentPro.Server.Controllers
@@ -15,23 +15,36 @@ public ApiController(EffectService effectService)
1515
}
1616

1717
/// <summary>
18-
/// Triggers a beat effect with the specified intensity
18+
/// Triggers a beat effect
1919
/// </summary>
20-
/// <param name="intensity">Beat intensity (typically 0.0 to 1.0)</param>
21-
[HttpPost("beat")]
22-
public IActionResult Beat([FromBody] double intensity)
20+
[Route("beat")]
21+
[HttpPost]
22+
[HttpGet]
23+
public IActionResult Beat()
2324
{
2425
try
2526
{
26-
_effectService.Beat(intensity);
27-
return Ok(new { success = true, message = "Beat triggered successfully" });
27+
_effectService.Beat();
28+
return Ok(new { success = true });
2829
}
2930
catch (System.Exception ex)
3031
{
3132
return StatusCode(500, new { success = false, error = ex.Message });
3233
}
3334
}
3435

36+
[HttpPost("setcolors")]
37+
public void SetColors([FromBody] string[,] matrix)
38+
{
39+
ManualControlService.SetColors(matrix);
40+
}
41+
42+
[HttpPost("setcolorslist")]
43+
public void SetColors([FromBody] List<List<string>> matrix)
44+
{
45+
ManualControlService.SetColors(matrix);
46+
}
47+
3548
/// <summary>
3649
/// Test endpoint to verify API is working
3750
/// </summary>

HueLightDJ.Services.Interfaces/ILightDJService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public interface ILightDJService
5353
//void SetColorsList(List<List<string>> matrix);
5454

5555
[OperationContract]
56-
Task Beat(DoubleRequest value, CallContext context = default);
56+
Task Beat(CallContext context = default);
5757

5858
[OperationContract]
5959
Task Disconnect(CallContext context = default);

HueLightDJ.Services/Internal/EffectService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ public void StartRandomTouchEffect(double x, double y)
456456
StartTouchEffect(CancellationToken.None, randomTouch, waitTime, null, x, y);
457457
}
458458

459-
public void Beat(double intensity)
459+
public void Beat()
460460
{
461461
var effectLayer = GetLayer(isBaseLayer: false);
462462

HueLightDJ.Services/LightDJService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ public Task StopEffects(CallContext context = default)
128128
//{
129129
// ManualControlService.SetColors(matrix);
130130
//}
131-
public Task Beat(DoubleRequest req, CallContext context = default)
131+
public Task Beat(CallContext context = default)
132132
{
133-
effectService.Beat(req.Value);
133+
effectService.Beat();
134134
return Task.CompletedTask;
135135
}
136136

0 commit comments

Comments
 (0)