Created
May 26, 2019 09:52
-
-
Save alistairjevans/7f0d74b80e7a20b115af3330bc3834bf to your computer and use it in GitHub Desktop.
Simple data controller for taking incoming sensor data.
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
public class DataController : Controller | |
{ | |
private readonly SampleWriter sampleWriter; | |
public DataController(SampleWriter sampleWriter) | |
{ | |
this.sampleWriter = sampleWriter; | |
} | |
[HttpPost] | |
public async Task<ActionResult> ProvideReading(uint milliseconds, double speed) | |
{ | |
// sampleWriter is just a singleton dependency with an open file stream, | |
// writing each record to a CSV file as it arrives. | |
await sampleWriter.ProvideSample(milliseconds, speed); | |
return StatusCode(200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment