Init...
This commit is contained in:
parent
685eb5eebb
commit
cd764c7f69
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/.vs
|
||||||
|
/DuinoDCXBot/bin
|
||||||
|
/DuinoDCXBot/Builds
|
||||||
|
/DuinoDCXBot/obj
|
7
CHANGELOG.md
Normal file
7
CHANGELOG.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Changelogs
|
||||||
|
|
||||||
|
## 1.0.0 - Init...
|
||||||
|
### New Features
|
||||||
|
* Create the Bot
|
||||||
|
### Bugfixes
|
||||||
|
### Changes
|
92
CONTRIBUTING.md
Normal file
92
CONTRIBUTING.md
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
When contributing to this repository, please first discuss the change you wish to make via issue,
|
||||||
|
email, or any other method with the owners of this repository before making a change.
|
||||||
|
|
||||||
|
Please note we have a code of conduct, please follow it in all your interactions with the project.
|
||||||
|
|
||||||
|
## Pull Request Process
|
||||||
|
|
||||||
|
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
|
||||||
|
build.
|
||||||
|
2. Update the README.md with details of changes to the interface, this includes new environment
|
||||||
|
variables, exposed ports, useful file locations and container parameters.
|
||||||
|
3. Increase the version numbers in any examples files and the README.md to the new version that this
|
||||||
|
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
|
||||||
|
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
|
||||||
|
do not have permission to do that, you may request the second reviewer to merge it for you.
|
||||||
|
|
||||||
|
## Code of Conduct
|
||||||
|
|
||||||
|
### Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity and
|
||||||
|
orientation.
|
||||||
|
|
||||||
|
### Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
### Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
### Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
### Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at philip.schell ATTTT fit.fraunhofer.net. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
### Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at [http://contributor-covenant.org/version/1/4][version]
|
||||||
|
|
||||||
|
[homepage]: http://contributor-covenant.org
|
||||||
|
[version]: http://contributor-covenant.org/version/1/4/
|
55
DuinoDCXBot.sln
Normal file
55
DuinoDCXBot.sln
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31112.23
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DuinoDCXBot", "DuinoDCXBot\DuinoDCXBot.csproj", "{8DA0A6E0-7CD6-4B95-8A1D-2F6938CDCF9C}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DuinoDCX", "..\DuinoDCX\DuinoDCX\DuinoDCX.csproj", "{B218CFAA-88F5-47C1-8956-88199088B4EA}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot-Utils", "..\Utils\Bot-Utils\Bot-Utils\Bot-Utils.csproj", "{4C957856-8BA3-4CE3-9E22-97802FD52BC3}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils", "..\Utils\Utils\Utils\Utils.csproj", "{2B69FD52-32A1-4085-A1AE-FF1D2D5AA3F2}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils-IoT", "..\Utils\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{63A2E762-5ABA-4EF4-BE7D-64CEFFB2358E}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "litjson", "..\Librarys\litjson\litjson\litjson.csproj", "{16DDBA15-7346-4F01-9735-5AFE54E660DC}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{8DA0A6E0-7CD6-4B95-8A1D-2F6938CDCF9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8DA0A6E0-7CD6-4B95-8A1D-2F6938CDCF9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8DA0A6E0-7CD6-4B95-8A1D-2F6938CDCF9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8DA0A6E0-7CD6-4B95-8A1D-2F6938CDCF9C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B218CFAA-88F5-47C1-8956-88199088B4EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B218CFAA-88F5-47C1-8956-88199088B4EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B218CFAA-88F5-47C1-8956-88199088B4EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B218CFAA-88F5-47C1-8956-88199088B4EA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4C957856-8BA3-4CE3-9E22-97802FD52BC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4C957856-8BA3-4CE3-9E22-97802FD52BC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4C957856-8BA3-4CE3-9E22-97802FD52BC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4C957856-8BA3-4CE3-9E22-97802FD52BC3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{2B69FD52-32A1-4085-A1AE-FF1D2D5AA3F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2B69FD52-32A1-4085-A1AE-FF1D2D5AA3F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2B69FD52-32A1-4085-A1AE-FF1D2D5AA3F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2B69FD52-32A1-4085-A1AE-FF1D2D5AA3F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{63A2E762-5ABA-4EF4-BE7D-64CEFFB2358E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{63A2E762-5ABA-4EF4-BE7D-64CEFFB2358E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{63A2E762-5ABA-4EF4-BE7D-64CEFFB2358E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{63A2E762-5ABA-4EF4-BE7D-64CEFFB2358E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{16DDBA15-7346-4F01-9735-5AFE54E660DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{16DDBA15-7346-4F01-9735-5AFE54E660DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{16DDBA15-7346-4F01-9735-5AFE54E660DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{16DDBA15-7346-4F01-9735-5AFE54E660DC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {D1A08D07-FCD1-4E5F-A472-E2F0703D4868}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
11
DuinoDCXBot/Adminrights.manifest
Normal file
11
DuinoDCXBot/Adminrights.manifest
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
</assembly>
|
85
DuinoDCXBot/DuinoDCXBot.csproj
Normal file
85
DuinoDCXBot/DuinoDCXBot.csproj
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<RootNamespace>BlubbFish.IoT.Bots.DuinoDCXBot</RootNamespace>
|
||||||
|
<ApplicationManifest>Adminrights.manifest</ApplicationManifest>
|
||||||
|
<Version>0.0.39</Version>
|
||||||
|
<PackageId>DuinoDCXBot.Bots.IoT.BlubbFish</PackageId>
|
||||||
|
<Authors>BlubbFish</Authors>
|
||||||
|
<Company>BlubbFish</Company>
|
||||||
|
<Description>Bot for DCX2496 Ultradrive Pro Controller</Description>
|
||||||
|
<Copyright>Copyright © 2021 - 29.06.2021</Copyright>
|
||||||
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
|
<PackageProjectUrl>https://git.blubbfish.net/vs_projects/DuinoDCXBot</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://git.blubbfish.net/vs_projects/DuinoDCXBot.git</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<PackageReleaseNotes>0.0.39 Init</PackageReleaseNotes>
|
||||||
|
<NeutralLanguage>de-DE</NeutralLanguage>
|
||||||
|
<PackageIcon>favicon.ico</PackageIcon>
|
||||||
|
<ApplicationIcon>resources\favicon.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\DuinoDCX\DuinoDCX\DuinoDCX.csproj" />
|
||||||
|
<ProjectReference Include="..\..\Utils\Bot-Utils\Bot-Utils\Bot-Utils.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="config-example\settings.conf">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\favicon.ico">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\index.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\manifest.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\static\css\2.f0848b8c.chunk.css">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\static\css\2.f0848b8c.chunk.css.map">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\static\css\main.6da01cc7.chunk.css">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\static\css\main.6da01cc7.chunk.css.map">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\static\js\2.83c80600.chunk.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\static\js\2.83c80600.chunk.js.map">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\static\js\main.5abb877d.chunk.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="resources\static\js\main.5abb877d.chunk.js.map">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="..\LICENSE">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath></PackagePath>
|
||||||
|
</None>
|
||||||
|
<None Include="resources\favicon.ico">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath></PackagePath>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="../CHANGELOG.md" />
|
||||||
|
<Content Include="../CONTRIBUTING.md" />
|
||||||
|
<Content Include="../LICENSE" />
|
||||||
|
<Content Include="../README.md" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ProjectExtensions><VisualStudio><UserProperties resources_4manifest_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
|
||||||
|
|
||||||
|
</Project>
|
22
DuinoDCXBot/Program.cs
Normal file
22
DuinoDCXBot/Program.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using BlubbFish.Utils;
|
||||||
|
|
||||||
|
namespace BlubbFish.IoT.Bots.DuinoDCXBot {
|
||||||
|
class Program {
|
||||||
|
public Program(String[] _1) {
|
||||||
|
InIReader.SetSearchPath(new List<String>() { "/etc/duinodcx", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\duinodcx" });
|
||||||
|
if(!InIReader.ConfigExist("settings")) {
|
||||||
|
Helper.WriteError("settings.ini not found!");
|
||||||
|
_ = Console.ReadLine();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InIReader ini = InIReader.GetInstance("settings");
|
||||||
|
_ = new Server(ini.GetSection("general"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Main(String[] args) => new Program(args);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
118
DuinoDCXBot/Server.cs
Normal file
118
DuinoDCXBot/Server.cs
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
using BlubbFish.IoT.DuinoDCX;
|
||||||
|
using BlubbFish.Utils;
|
||||||
|
using BlubbFish.Utils.IoT.Bots;
|
||||||
|
|
||||||
|
namespace BlubbFish.IoT.Bots.DuinoDCXBot {
|
||||||
|
public class Server : AWebserver {
|
||||||
|
private readonly Ultradrive deviceManager;
|
||||||
|
|
||||||
|
public Server(Dictionary<String, String> settings) : base(settings, null) {
|
||||||
|
this.logger.SetPath(settings["loggingpath"]);
|
||||||
|
this.deviceManager = new Ultradrive(settings["serial"]);
|
||||||
|
this.StartListen();
|
||||||
|
Console.WriteLine("DCXBot gestartet....");
|
||||||
|
this.WaitForShutdown();
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Boolean SendWebserverResponse(HttpListenerContext cont) {
|
||||||
|
try {
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/state") && cont.Request.HttpMethod == "GET") {
|
||||||
|
cont.Response.ContentType = "application/binary";
|
||||||
|
Byte[] getSelected = { this.deviceManager.GetSelected() };
|
||||||
|
Byte[] writeDevice = this.deviceManager.WriteDevice();
|
||||||
|
Byte[] writeDevices = this.deviceManager.WriteDevices();
|
||||||
|
Byte[] buf = new Byte[getSelected.Length + writeDevice.Length + writeDevices.Length];
|
||||||
|
Array.Copy(getSelected, 0, buf, 0, getSelected.Length);
|
||||||
|
Array.Copy(writeDevice, 0, buf, getSelected.Length, writeDevice.Length);
|
||||||
|
Array.Copy(writeDevices, 0, buf, getSelected.Length + writeDevice.Length, writeDevices.Length);
|
||||||
|
cont.Response.ContentLength64 = buf.Length;
|
||||||
|
cont.Response.OutputStream.Write(buf, 0, buf.Length);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/status") && cont.Request.HttpMethod == "GET") {
|
||||||
|
cont.Response.ContentType = "application/binary";
|
||||||
|
Byte[] buf = this.deviceManager.WriteDeviceStatus();
|
||||||
|
cont.Response.ContentLength64 = buf.Length;
|
||||||
|
cont.Response.OutputStream.Write(buf, 0, buf.Length);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/selected") && cont.Request.HttpMethod == "PUT") {
|
||||||
|
StreamReader reader = new StreamReader(cont.Request.InputStream, cont.Request.ContentEncoding);
|
||||||
|
String rawData = reader.ReadToEnd();
|
||||||
|
cont.Request.InputStream.Close();
|
||||||
|
reader.Close();
|
||||||
|
|
||||||
|
if(Byte.TryParse(rawData, out Byte id)) {
|
||||||
|
this.deviceManager.SetSelected(id);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
cont.Response.StatusCode = 400;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/commands") && cont.Request.HttpMethod == "POST") {
|
||||||
|
MemoryStream reader = new MemoryStream();
|
||||||
|
cont.Request.InputStream.CopyTo(reader);
|
||||||
|
Byte[] rawData = reader.ToArray();
|
||||||
|
cont.Request.InputStream.Close();
|
||||||
|
reader.Close();
|
||||||
|
|
||||||
|
this.deviceManager.ProcessOutgoing(rawData);
|
||||||
|
|
||||||
|
cont.Response.StatusCode = 204;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/connection") && cont.Request.HttpMethod == "GET") {
|
||||||
|
return SendJsonResponse(new Dictionary<String, String>() { { "current", "LAN" }, { "ip", "127.0.0.1" } }, cont);
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/connection") && cont.Request.HttpMethod == "PATCH") {
|
||||||
|
return SendJsonResponse(new Dictionary<String, String>() { { "current", "LAN" }, { "ip", "127.0.0.1" } }, cont);
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/connection") && cont.Request.HttpMethod == "DELETE") {
|
||||||
|
cont.Response.StatusCode = 204;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/settings") && cont.Request.HttpMethod == "GET") {
|
||||||
|
return SendJsonResponse(new Dictionary<String, String>() {
|
||||||
|
{ "apSsid", "DCX2496" },
|
||||||
|
{ "apPassword", "Ultradrive" },
|
||||||
|
{ "auth", "Basic RENYMjQ5NjpVbHRyYWRyaXZl" },
|
||||||
|
{ "mdnsHost", "ultradrive" },
|
||||||
|
{ "flowControl", "false" },
|
||||||
|
{ "autoDisableAP", "false" }
|
||||||
|
}, cont);
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/settings") && cont.Request.HttpMethod == "PATCH") {
|
||||||
|
cont.Response.StatusCode = 204;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/networks") && cont.Request.HttpMethod == "GET") {
|
||||||
|
return SendJsonResponse(new List<String>() { "LAN" }, cont);
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/update") && cont.Request.HttpMethod == "POST") {
|
||||||
|
cont.Response.StatusCode = 204;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(cont.Request.Url.AbsolutePath.StartsWith("/api/version") && cont.Request.HttpMethod == "GET") {
|
||||||
|
return SendJsonResponse(new Dictionary<String, String>() { { "version", "v"+this.GetType().Assembly.GetName().Version.ToString().Substring(0, this.GetType().Assembly.GetName().Version.ToString().LastIndexOf(".")) }, { "buildDate", DateTime.Now.ToString() } }, cont);
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
Helper.WriteError("SendWebserverResponse(): 500 - " + e.Message + "\n\n" + e.StackTrace);
|
||||||
|
cont.Response.StatusCode = 500;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return SendFileResponse(cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Dispose() {
|
||||||
|
this.deviceManager.Dispose();
|
||||||
|
base.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
DuinoDCXBot/config-example/settings.conf
Normal file
4
DuinoDCXBot/config-example/settings.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[general]
|
||||||
|
prefix=http://+:3000/
|
||||||
|
loggingpath=/var/log/dcxbot.log
|
||||||
|
serial=/dev/ttyUSB0
|
37
DuinoDCXBot/dpkg/create-builds.sh
Normal file
37
DuinoDCXBot/dpkg/create-builds.sh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CSPROJFILE="DuinoDCXBot.csproj"
|
||||||
|
VMAJOR=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 1)
|
||||||
|
VMINOR=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 2)
|
||||||
|
VBUILD=$(grep -e "<Version>" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 3)
|
||||||
|
|
||||||
|
mkdir -p ../deb
|
||||||
|
mkdir -p ../Builds
|
||||||
|
|
||||||
|
export NAME=duinodcx
|
||||||
|
export MAINAINER="BlubbFish <dev@blubbfish.net>"
|
||||||
|
export VERSION="$VMAJOR.$VMINOR-$VBUILD"
|
||||||
|
export DESCRIPTION="duinodcx Creates a Webbased Managment for DCX2496 Ultradrive Pro"
|
||||||
|
|
||||||
|
export EXEPATH=DuinoDCXBot.dll
|
||||||
|
export EXEARGUMENTS=" "
|
||||||
|
export RUNNER=/usr/share/dotnet/dotnet
|
||||||
|
export COPYEXEC="../bin/Release/netcoreapp3.1/*.dll ../bin/Release/netcoreapp3.1/DuinoDCXBot.deps.json ../bin/Release/netcoreapp3.1/resources ../bin/Release/netcoreapp3.1/DuinoDCXBot.runtimeconfig.json ../bin/Release/netcoreapp3.1/runtimes"
|
||||||
|
|
||||||
|
export COPYCONFIG="../bin/Release/netcoreapp3.1/config-example/*.conf"
|
||||||
|
export CONFIGREPLACEASK=settings.conf
|
||||||
|
|
||||||
|
cd ../deb
|
||||||
|
export PLATFORM=armhf
|
||||||
|
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/control-build.sh | bash
|
||||||
|
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/pre-post-build.sh | bash
|
||||||
|
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/service-build.sh | bash
|
||||||
|
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/logrotate-build.sh | bash
|
||||||
|
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/build-deb.sh | bash
|
||||||
|
|
||||||
|
export PLATFORM=amd64
|
||||||
|
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/control-build.sh | bash
|
||||||
|
curl -s https://git.blubbfish.net/vs_utils/CI-Scripts/raw/branch/master/deb/build-deb.sh | bash
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
rm deb -rf
|
BIN
DuinoDCXBot/resources/favicon.ico
Normal file
BIN
DuinoDCXBot/resources/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
1
DuinoDCXBot/resources/index.html
Normal file
1
DuinoDCXBot/resources/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"><meta name="theme-color" content="#272b30"><meta name="msapplication-navbutton-color" content="#272b30"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><style>body{background-color:#272b30}#progress{position:absolute;width:100%;bottom:0;left:0;background-color:#1c1e22;border:1px solid rgba(0,0,0,.6)}#bar{width:100%;height:50px;background-image:linear-gradient(#484e55,#3a3f44 60%,#313539);background-repeat:no-repeat;border-right:1px solid rgba(0,0,0,.6);animation-name:reducetime;animation-duration:5s}@keyframes reducetime{0%{width:0}100%{width:100%}}@media (max-width:576px){#progress{top:0}}</style><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>DCX2496 Remote</title><link href="/static/css/2.f0848b8c.chunk.css" rel="stylesheet"><link href="/static/css/main.6da01cc7.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div id="progress"><div id="bar"></div></div></div><script>!function(e){function r(r){for(var n,i,l=r[0],f=r[1],a=r[2],p=0,s=[];p<l.length;p++)i=l[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var f=t[l];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="/";var l=this["webpackJsonpdcx-ui"]=this["webpackJsonpdcx-ui"]||[],f=l.push.bind(l);l.push=r,l=l.slice();for(var a=0;a<l.length;a++)r(l[a]);var c=f;t()}([])</script><script src="/static/js/2.83c80600.chunk.js"></script><script src="/static/js/main.5abb877d.chunk.js"></script></body></html>
|
15
DuinoDCXBot/resources/manifest.json
Normal file
15
DuinoDCXBot/resources/manifest.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"short_name": "DuinoDCX",
|
||||||
|
"name": "Behringer Ultradrive Remote Controller",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": "./index.html",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
16
DuinoDCXBot/resources/static/css/2.f0848b8c.chunk.css
Normal file
16
DuinoDCXBot/resources/static/css/2.f0848b8c.chunk.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
DuinoDCXBot/resources/static/css/main.6da01cc7.chunk.css
Normal file
2
DuinoDCXBot/resources/static/css/main.6da01cc7.chunk.css
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.number-param-container{display:table;width:100%;margin-bottom:-10px}.max-number,.min-number,.slider{display:table-cell;text-align:center}.max-number,.min-number{width:34px;vertical-align:top}.slider-container{margin:12px 24px 0}.current-value{font-size:12px;color:#aaa;margin-top:7px;background:none;border:none;padding:0;outline:inherit}.react-numeric-input{display:block!important}.react-numeric-input input{width:100%;height:38px;padding:8px 12px;font-size:14px!important;line-height:1.42857143!important;color:#272b30;background-color:#fff;background-image:none;border:1px solid #000!important;border-radius:4px 0 0 4px!important;box-shadow:inset 0 1px 1px rgba(0,0,0,.075);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.channels-container{margin:5px 10px}.channel-group{float:left}.channel-levels>.dropdown-menu{width:212px!important}.led-bar{float:left}.led-bar button{pointer-events:none;margin:1px;cursor:default;width:14px;height:36px;float:left;padding:0}@media (max-width:767px){.channels-container{display:block}}@media (min-width:576px){.channel-levels>.dropdown-menu{transform:rotate(270deg);left:118px;top:-66px}#mute-all svg,.responsive-rotate-90{transform:rotate(90deg)}}body{padding-top:70px;padding-bottom:50px}.block-ui{position:relative;min-height:3em}.block-ui-container{position:absolute;z-index:1010;top:0;right:0;bottom:0;left:0;height:100%;min-height:2em;cursor:not-allowed;overflow:hidden}.block-ui-container:focus{outline:none}.block-ui-overlay{width:100%;height:100%}.content-loader{margin-top:30px}.content-loader h5{margin-top:20px}.line-scale>div{width:30px;height:144px;border-radius:10px;margin:5px}:focus{outline:none!important}.card{margin-bottom:15px}.card-body{padding:15px 15px 5px!important}.end-button{width:25%}.end-button>.nav-item{width:100%;text-align:center}.middle-buttons{width:50%}.middle-buttons>.nav-item{width:50%;text-align:center}.middle-buttons>.nav-item>a{font-weight:700}.middle-buttons .nav-link.active{background-image:linear-gradient(#78cc78,#62c462 60%,#53be53);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ff78cc78",endColorstr="#ff53be53",GradientType=0);-webkit-filter:none;filter:none}.middle-buttons .nav-link.active:hover{background-image:linear-gradient(#2f7d2f,#379337 40%,#3a9a3a);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#ff2f7d2f",endColorstr="#ff3a9a3a",GradientType=0);-webkit-filter:none;filter:none}.end-button>li.open>a{color:#62c462!important}.recharts-default-tooltip{background-color:#272b30!important}.Toastify__toast-body{margin:auto 15px}.react-numeric-input input{height:48px}.no-caret>.dropdown-toggle:after{display:none}.right-0 .dropdown-menu{right:0;left:auto}.icon-menu{width:50px;text-align:center}#localization-dropup{width:260px;padding:10px 15px 0}.header-button{height:22px;font-size:10px;float:right}.nav-tabs .nav-link.active{color:#fff;background-color:#3e444c;border:1px solid #1c1e22;border-bottom-color:transparent}.wide-nav{margin-right:-15px!important;margin-left:-15px!important}.control-menu{margin-bottom:12px;justify-content:center}.control-menu>.nav-item{margin:2px}
|
||||||
|
/*# sourceMappingURL=main.6da01cc7.chunk.css.map */
|
File diff suppressed because one or more lines are too long
3
DuinoDCXBot/resources/static/js/2.83c80600.chunk.js
Normal file
3
DuinoDCXBot/resources/static/js/2.83c80600.chunk.js
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
object-assign
|
||||||
|
(c) Sindre Sorhus
|
||||||
|
@license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Copyright (c) 2017 Jed Watson.
|
||||||
|
Licensed under the MIT License (MIT), see
|
||||||
|
http://jedwatson.github.io/classnames
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! decimal.js-light v2.5.0 https://github.com/MikeMcl/decimal.js-light/LICENCE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @license Complex.js v2.0.11 11/02/2016
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016, Robert Eisele (robert@xarg.org)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
**/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @license Fraction.js v4.0.12 09/09/2015
|
||||||
|
* http://www.xarg.org/2014/03/rational-numbers-in-javascript/
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015, Robert Eisele (robert@xarg.org)
|
||||||
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
**/
|
||||||
|
|
||||||
|
/** @license React v0.19.1
|
||||||
|
* scheduler.production.min.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @license React v16.13.1
|
||||||
|
* react-dom.production.min.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @license React v16.13.1
|
||||||
|
* react.production.min.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
1
DuinoDCXBot/resources/static/js/2.83c80600.chunk.js.map
Normal file
1
DuinoDCXBot/resources/static/js/2.83c80600.chunk.js.map
Normal file
File diff suppressed because one or more lines are too long
2
DuinoDCXBot/resources/static/js/main.5abb877d.chunk.js
Normal file
2
DuinoDCXBot/resources/static/js/main.5abb877d.chunk.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
DuinoDCXBot/resources/static/js/runtime-main.266127ae.js
Normal file
2
DuinoDCXBot/resources/static/js/runtime-main.266127ae.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
!function(e){function r(r){for(var n,i,l=r[0],f=r[1],a=r[2],p=0,s=[];p<l.length;p++)i=l[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var f=t[l];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="/";var l=this["webpackJsonpdcx-ui"]=this["webpackJsonpdcx-ui"]||[],f=l.push.bind(l);l.push=r,l=l.slice();for(var a=0;a<l.length;a++)r(l[a]);var c=f;t()}([]);
|
||||||
|
//# sourceMappingURL=runtime-main.266127ae.js.map
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user