-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tried to add the camera and buzzer to the api, but it didn't like something
- Loading branch information
Showing
10 changed files
with
87 additions
and
8 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,28 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using skullOS.Modules.Interfaces; | ||
using static skullOS.Modules.BuzzerLibrary; | ||
|
||
namespace skullOS.API.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
public class BuzzerController : ControllerBase | ||
{ | ||
private readonly ILogger<BuzzerController> _logger; | ||
private IBuzzerModule _module; | ||
|
||
public BuzzerController(ILogger<BuzzerController> logger, IBuzzerModule buzzer) | ||
{ | ||
_logger = logger; | ||
_module = buzzer; | ||
} | ||
|
||
public string PlayTune(string tune) | ||
{ | ||
Tunes tuneToPlay = (Tunes)Enum.Parse(typeof(Tunes), tune); | ||
_module.PlayTune(tuneToPlay); | ||
return "Playing " + tuneToPlay.ToString(); | ||
} | ||
|
||
} | ||
} |
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,33 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using skullOS.Modules.Interfaces; | ||
|
||
namespace skullOS.API.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
public class CameraController : ControllerBase | ||
{ | ||
private readonly ILogger<CameraController> _logger; | ||
private ICameraModule _module; | ||
|
||
public CameraController(ILogger<CameraController> logger, ICameraModule camera) | ||
{ | ||
_logger = logger; | ||
_module = camera; | ||
} | ||
|
||
[HttpGet] | ||
public string TakePicture() | ||
{ | ||
_module.TakePicture(); | ||
return "Picture Taken!"; | ||
} | ||
|
||
[HttpGet] | ||
public string RecordVideo() | ||
{ | ||
_module.RecordShortVideo(); | ||
return "Video Recorded!"; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
namespace skullOS.Modules.Interfaces | ||
{ | ||
internal interface IBuzzerModule | ||
public interface IBuzzerModule | ||
{ | ||
void PlayTune(BuzzerLibrary.Tunes tuneToPlay); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
namespace skullOS.Modules.Interfaces | ||
{ | ||
internal interface ICameraModule | ||
public interface ICameraModule | ||
{ | ||
void RecordShortVideo(); | ||
void TakePicture(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ Downlink=True | |
Uplink=True | ||
Prop=True | ||
QrCodeReader=True | ||
|
||
Buzzer=True |
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