-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
7 changed files
with
108 additions
and
9 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
13 changes: 13 additions & 0 deletions
13
...ca.drivers/automatica.driver.knx/P3.Knx.Core.Baos.Console/P3.Knx.Core.Baos.Console.csproj
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,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<LangVersion>7.3</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\P3.Knx.Core.Baos.Driver\P3.Knx.Core.Baos.Driver.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
24 changes: 24 additions & 0 deletions
24
src/automatica.drivers/automatica.driver.knx/P3.Knx.Core.Baos.Console/Program.cs
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,24 @@ | ||
using Microsoft.Extensions.Logging.Console; | ||
using P3.Knx.Core.Baos.Driver; | ||
using System.Threading.Tasks; | ||
|
||
namespace P3.Knx.Core.Baos.Console | ||
{ | ||
class Program | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
System.Console.WriteLine("Hello World!"); | ||
|
||
var logger = new ConsoleLoggerProvider((s, level) => true, true).CreateLogger("test"); | ||
|
||
var driver = new BaosDriver("/dev/ttyAMA0", logger); | ||
|
||
await driver.Start(); | ||
|
||
System.Console.ReadLine(); | ||
|
||
await driver.Stop(); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/automatica.drivers/automatica.driver.knx/P3.Knx.Core.Baos.Driver/BaosDriver.cs
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,29 @@ | ||
using Microsoft.Extensions.Logging; | ||
using System.Threading.Tasks; | ||
|
||
namespace P3.Knx.Core.Baos.Driver | ||
{ | ||
public class BaosDriver | ||
{ | ||
private readonly string _port; | ||
private readonly BaosSerial _serial; | ||
|
||
public BaosDriver(string port, ILogger logger) | ||
{ | ||
_port = port; | ||
_serial = new BaosSerial(_port, logger); | ||
} | ||
|
||
|
||
public Task<bool> Start() | ||
{ | ||
return Task.FromResult(_serial.Open()); | ||
} | ||
public Task<bool> Stop() | ||
{ | ||
return Task.FromResult(_serial.Close()); | ||
} | ||
|
||
|
||
} | ||
} |
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