-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace SoftBeckhoff.Controllers | ||
{ | ||
[ApiController] | ||
[Route("[controller]")] | ||
public class SoftBeckhoffController : ControllerBase | ||
{ | ||
private readonly ILogger<SoftBeckhoffController> logger; | ||
private readonly IPlcService plcService; | ||
|
||
public SoftBeckhoffController(ILogger<SoftBeckhoffController> logger, IPlcService plcService) | ||
{ | ||
this.logger = logger; | ||
this.plcService = plcService; | ||
} | ||
|
||
[HttpGet("/symbols")] | ||
public IEnumerable<object> GetSymbols() | ||
{ | ||
return plcService.GetSymbols(); | ||
} | ||
|
||
[HttpGet("/symbols/{name}")] | ||
public object GetSymbol([FromRoute]string name) | ||
{ | ||
return plcService.GetSymbol(name); | ||
} | ||
|
||
[HttpPut("/symbols/{name}")] | ||
public void SetSymbol([FromRoute]string name, [FromBody]object value) | ||
{ | ||
plcService.SetSymbol(name, value); | ||
} | ||
|
||
[HttpPost("/symbols")] | ||
public void CreateSymbol([FromBody]object symbol) | ||
{ | ||
plcService.CreateSymbol(symbol); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public interface IPlcService : IDisposable | ||
{ | ||
|
||
IEnumerable<object> GetSymbols(); | ||
object GetSymbol(string name); | ||
void SetSymbol(string name, object value); | ||
void CreateSymbol(object symbol); | ||
} |
This file was deleted.
Oops, something went wrong.